Polygons facing each other [SOLVED]

On 28/04/2016 at 15:23, xxxxxxxx wrote:

I have a list with all the normals of all the polygons of an object, that I calculated with this code:

for p in polygons:
     a,b,d = points[p.a],points[p.b],points[p.d]
     normals.append((b - a).Cross(d - a).GetNormalized())

With this information available, how can I check if two faces are:

- roughly facing each other
- roughly facing in the same direction
- roughly facing opposite directions

?

On 29/04/2016 at 11:00, xxxxxxxx wrote:

These are the possible cases. How can I detect them all? Anyone?

http://s32.postimg.org/q1libis7p/Normals.jpg

On 29/04/2016 at 12:43, xxxxxxxx wrote:

You can compute the angle between the normal vectors of the polygons using the dot product.

On 29/04/2016 at 12:50, xxxxxxxx wrote:

I know that, Niklas.
But in my image, for example, the angles between the normals in the second and third case is the same: around 180°
How can I differentiate them?

On 29/04/2016 at 15:45, xxxxxxxx wrote:

I guess I found a way.
If the angle between the normal is less than 90°, they are pointing in the same general direction.
If the angle is between 90° and 180°, I check if a point of one of the polygons(the center of a polygon) is in front of the other polygon or not.
If it is, the polygons are facing each other.
if not, they are facing in opposite directions.
Am I right?

On 30/04/2016 at 12:39, xxxxxxxx wrote:

Just to let everyone know that it worked