01.02.2023 - 18:31
*
[entrada más valorada]
Some hints:
1. Make a projection matrix from eye to view point
2. Extract all faces from the polhedron, calculate the normal, and if the normal points to the eye point, then flatten the face by multiplying each point of the face in the correct order with that matrix. Caution : The face can have holes! You have to deal with it!
3. The result is a projected 2d-polygon. If the normal is perpendicular to the eye-view-point axis, the polygon is collapsed to a line, and have no area! So you have to filter this cases. Now combine this 2d-polygon with the other visible 2d-face-polygons by doing a boolean union operation. The result is the visible so called silhouette polygone of the polhedron.
This is one "brute force" algorithm for doing this. Another algorithm could be to extract all edges, which two adjacent faces have different visibility from view point. Project this edges to 2d lines and find the outer border of this line collection, to chain it to a closed polygon. Here also have to deal with holes!
This algorithm works only for polyhedren with straight bordered , flat faces. I would not try this with BReps. Good luck!