如何镶嵌贝塞尔三角形?
我关心的是二次贝塞尔三角形,我试图对其进行细分以渲染它们。
我已经通过像维基百科页面中描述的那样递归地细分三角形来实现这一点。虽然我想获得更精确的细分。问题是,我要么得到太少的细分,要么得到太多细分,因为该算法的每次迭代中曲面的数量都会加倍。
特别是,我需要一种自适应曲面细分算法,该算法允许我定义边缘处的分段数量。我不确定我是否能做到这一点,所以我也想听听统一的镶嵌技术。
最困难的问题是我在计算贝塞尔曲面中某个点的法线时遇到了麻烦,我不确定是否需要,但一直在尝试解决。
My concern are quadratic bezier triangles which I'm trying to tesselate for rendering them.
I've managed to implement this by subdividing the triangle recursively like described in a wikipedia page. Though I'd like to get more precision to subdivision. The problem is that I'll either get too few subdivisions or too many because the amount of surfaces doubles on every iteration of that algorithm.
In particular I would need an adaptive tesselation algorithm that allows me to define the amount of segments at the edges. I'm not sure whether I can get that though so I'd also like to hear about uniform tesselation techniques.
Hardest trouble I have trouble with calculating normals for a point in bezier surface, which I'm not sure whether I need, but been trying to solve out.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
自适应曲面细分。有很多算法可以实现这一点。但有一个问题:
对于以这种方式细分三角形,事情会变得很复杂。您需要根据边缘贝塞尔曲线的角度驱动自适应镶嵌器算法。细分时,三角形可以通过三种独特的方式进行分割。
为这些图案定义细分结果,您就一切顺利了。维基百科文章中仅描述了具有一条边的镶嵌。
通过研究一侧边缘分割的情况可以获得另外两个曲面细分结果。
通过先分割一条边,然后分割另一条边,可以直接获得“2 条边”。
找出“3条边”需要更多的工作。但您可以看到“2 个边缘”-案例为您带来了中间边缘。对于二次贝塞尔三角形,它是出现在那里的菱形的平均和:
Adaptive tesselation. There are many algorithms to this. But here's one:
For tesselating triangles this way there are complications to the matter. You need to drive the adaptive tesselator algorithm according to the angles of the edge beziers. There's three unique ways how your triangle can split when tesselating.
Define tesselation results for these patterns and you're well off. Only the tesselation with one edge is described in wikipedia article.
Two other tesselation results can be obtained by studying the case of one edge split.
"2 edges" can be obtained straight out by splitting first one edge and then another.
"3 edges" is a bit more work to find out. But you can see the "2 edges" -case brings you a mid-edge. In the case of quadratic bezier triangle it is an averaged sum of diamond appearing there: