Is a closed polygon mesh upside down?

I have an application for 3D modeling. Right now I'm drawing the mesh two-way, but I want to switch to one-way when the object is closed.

If the polygon mesh is closed (without boundary edges / fully periodic), it seems that I should always be able to determine if the object is currently upside down and automatically fix it.

Dropping means my normals point to an object, not an object. Being flipped is the result of a mismatch between my winding rules and the current foreground setting, but I calculate the normals directly from the geometry, so looking at the normals is an easy way to detect it.

One thing that I was thinking about is to take the bounding box, find the highest point and see if its normal points will be up or down - if it is omitted, then the object is upside down.

But it looks like this solution may be prone to degenerate geometry errors or floating point errors, since I will only consider one point. I could probably get all 6 axis-oriented extents, but this seems like a slightly better kludge, not the right solution.

Is there a simple and easy way to do this? Reliable and hard will work too. :)

+3
source share
2 answers

This is a reliable but slow way to get there:

( ), .

.

( , ).

, < 180. , > 180.

, .

, .

+5

" "

? OpenGL, . :

glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 1);

.
, , - , - , , .

, , , AFAIK, , . , , .
"--": . , , , ​​. . , , , .

+2

Source: https://habr.com/ru/post/1706597/


All Articles