Closed ThSGM closed 3 years ago
I just realised with a moment of thinking this morning that what I might be asking for are those faces whose normal are approximately perpendicular with the direction vector...I shall attempt to think more about this.
Ah, yes indeed a much rougher scheme can be done by just finding those locations on the surface where the normal is perpendicular to the directional normal from the observer. For example, I calculated the per-edge normal for each edge, then plotted those edges satisfying that condition.
It does not work amazingly well, so I am curious if there are better schemes out there (what do ray tracers do?).
But this is sufficient for now. Thank you to Alec and his team for creating such a great package.
Check out split_backfacing
. The idea is to classify each face as front or back facing. Then you can take the boundaries of those to get a set of silhouette or occluding contour curves.
Check out
split_backfacing
. The idea is to classify each face as front or back facing. Then you can take the boundaries of those to get a set of silhouette or occluding contour curves.
I am ashamed to see that a handful of lines of code with split_backfacing
were enough to generate something better than what I had above.
It's a better idea to find the set of faces with relevant dot product > 0 and those faces with dot product < 0 and plot the outline---than it is to try and find that contour with dot = 0 (which I was doing above).
Thanks!
This is perhaps a better question for the Math Stack Exchange, but
gptoolbox
has proven to be such a powerful set of tools for me that I wonder if it has a functionality for this.Given a triangular mesh, I was interested in computing the visible 'outer' edges. These are highlighted by the white markers below.
The red edge can be computed, either using
exterior_edges
oroutline
(I am actually not sure what the difference is).I coded up my own ad-hoc way of doing it. Basically along this procedure:
Basically, I construct a cone about the source point, oriented towards each vertex point. I shoot a bunch of rays in that cone and look for those points where at least one ray fails to intersect the surface 'nearby'.
It's not a terrible algorithm but it seems awfully ad hoc, requires manual tweaking of the cone dimensions, and can also miss sections of the edge.
Is there a better way to do this?
I have uploaded the script here.