Question

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?

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top