GLU NURBS - 如何设置控制点权重?
我正在编写一个 NURBS 类,它使用 OpenGL 的 GLU 扩展来进行渲染,但我刚刚意识到我不知道如何设置控制点权重。它不在红皮书或 GLU 文档中,网络上也没有提及太多。 GLU 的 NURBS 实现是否可能不包含此功能?如果是这样,我很惊讶他们居然把它称为 NURBS 而不仅仅是 B 样条线。
编辑:将“结权重”更改为“控制点权重”。
I'm writing a NURBS class that uses OpenGL's GLU extension to do rendering, but I just realized I have no idea how to set the control point weights. It's not in the Red Book or the GLU documentation, and the web doesn't mention much of it, either. Is it possible that GLU's NURBS implementation just doesn't include this feature? If so, I'm surprised they got away with calling it NURBS and not just B-splines.
Edit: Changed "knot weights" to "control point weights".
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
NURBS 术语中所述的问题是您想要一条有理曲线而不是非有理曲线。
看看 gluNurbsCurve 原型,我们有
:参数是
*knot
,但是它不是权重数组。 glu 处理结权重的方式有点混乱,您可以在此处阅读相关内容。ctlarray 和最后一个参数是您感兴趣的。最后一个参数 type 是二维求值器类型之一。通常,您可以分别对非有理控制点使用 GL_MAP2_VERTEX_3 或对有理控制点使用 GL_MAP2_VERTEX_4。
请参阅红皮书了解更多详情。
Your problem stated in NURBS terminology is that you want a rational curve instead of a non-rational.
Looking at the gluNurbsCurve prototype we have:
One of the parameters is
*knot
, HOWEVER it's not an array of weights. The way glu handles knot weights is a little confusion, you can read about it here.The ctlarray and last parameter is the ones that interests you. The last parameter, type, is one of the two-dimensional evaluator types. Commonly, you might use GL_MAP2_VERTEX_3 for nonrational or GL_MAP2_VERTEX_4 for rational control points, respectively.
See the Red Book for further details.