开发者

Direction of normals

开发者 https://www.devze.com 2023-03-07 08:47 出处:网络
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 correc

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 faci开发者_高级运维ng away from it?


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.)

0

精彩评论

暂无评论...
验证码 换一张
取 消