Reputation: 133118
Given: A 3D mesh defined with a set of vertices and triangles building up the mesh with these points.
Problem: Find the 2d outline of the projected arbitrarily rotated mesh on an arbitrary plane.
The projection is easy. The challenge lies in finding the "hull" of the projected triangle edges in the plane. I need some help with input/pointers on researching this algorithm. For simplicity, we can assume the 3D edges are projected straight down onto the xy plane.
Upvotes: 31
Views: 16726
Reputation: 21
see a demo of finding outline for a bunny Here is an implementation of the algorithm described above.
Upvotes: 1
Reputation: 5068
Just to add: A very intuitive way to find edges in a projection is back face culling! Any edge between a culled and non-culled face should be an outline. If you want to hide interior edges, just use the z-buffer. Back face culling is simply the post projection vertex order and very cheap to compute.
Upvotes: 4
Reputation: 1025
The 2D outline of the mesh projection is a subset of the projection of its edges.
Using this observation, one can determine the 2D outline using the following method:
Note that this method will report all the edges that are orthogonal to the projection plane, even those which are not visible from the projection plane's point of view. For example, with a torus, it will find the interior and the exterior outlines, even when the torus is rotated in such a way that its interior hole isn't visible from the projection plane's point of view. To sort out which edges are visible, you will need some sort of visibility test. If the intended use is for user display, you can use a depth buffer computed with an orthogonal projection matrix to render the geometry from the projection plane's point-of-view and do some z-testing to determine which edges are visible from the plane. If you need precision, you will need to perform ray/triangle intersection to determine visibility.
Upvotes: 3
Reputation: 712
I only see answers for convex solutions, so here is mine for non-convex. (It was a little confusing what was the intention.)
Take all edges from your 2D-triangles and group them. If two edges share both endpoints, they are in the same group. All groups, with only one edge, is then a part of the shell.
Finally you can combine the shell-edges to one ring, by joining them together.
Upvotes: 3
Reputation: 51531
Upvotes: 15
Reputation: 12656
The alpha shapes technique mentioned in this question handles a general set of points where the vertex connections are not known:
Is there an efficient algorithm to generate a 2D concave hull?
However, since you already know "face" information which can be preserved through the projection, it is probably not the best approach.
A brute force algorithm might feasible, especially if spatial sorting structures where used. eg for each facet:
Another idea, depending on the fidelity you require, is just shoot a bunch of rays normal from your projection plane to your original geometry. Create a 2d hit/miss and use that to determine your extents.
Upvotes: 3