法线方向

发布于 2024-11-08 11:34:36 字数 207 浏览 0 评论 0原文

目前,我有一个程序可以围绕 x 轴旋转一个简单的 2d 多边形来创建 3D 形状。问题是,为了确保曲面的法线正确对齐,我需要找到一个点并确保法线背向该点。我一直使用 2D 多边形的 x 和 y 坐标的平均值来查找参考点。然而,有时这个参考点会产生误导。如果我尝试使用尖锐的凹形形状,参考点完全位于形状之外,这将导致一些侧面具有向内的法线。是否有一种准确的方法来对齐多边形的法线,使它们始终背向多边形?

Currently, I have a program that will revolve a simple 2d polygon around the x-axis to create a 3D shape. The problem is that in order to make sure that the normals for the surfaces are aligned correctly, I need to find a point and make sure that the normal is facing away from that point. I have been using the mean values of the x and y coordinates of the 2D polygon to find the reference point. However, sometimes this reference point is misleading. If I try to use a sharp, concave shape, the reference point lies outside of the shape entirely, which will cause a few of the sides to have inwards-facing normals. Is there an accurate way to align the normals of a polygon so that they are always facing away from it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

鹿港小镇 2024-11-15 11:34:36

您是否希望在旋转之前为多边形的每个面提供 2D 向外法线?在 xy 平面中多边形的右手坐标系中,一条边的向外法线与沿该边指向逆时针方向的向量的叉积将具有正 z 分量。向内法线将具有负 z 分量。 (叉积应该是正态 × 边。)

Is it right that you want the 2D outward normal for each face of the polygon before the rotation? In a right-handed coordinate system with the polygon in the x-y plane, the cross product of the outward normal of a side with the vector along the side pointing in the counter-clockwise direction will have a positive z component. The inward normal will have a negative z component. (The cross product should be normal × side.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文