Jump to content
  • Advertisement
Sign in to follow this  
PhillipHamlyn

Finding Points on a Irregular 2D Shape

This topic is 2143 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, can anyone give me a suggestion ?

 

For various reasons I have a 3D mesh projected orthoganally into a 2D representation so that it shows the "front" of my object as if it were going to be rendered. I want to work out which of my mass of vertexes represent the hull of the shape. The hull isn't neccessarily convex, but I have the triangle indexes and all the vertexes have been welded, so I know "what connects with what". I need to bear in mind that the vertexes that make up the visible hull of the shape aren't neccessarily connected to each other (i.e. they are not part of the same triangle) since the triangles are 3D projected onto a 2D surface.

 

I could just render the image onto a surface and use simple edge finding to locate the vertexes, but this seems a low quality approach. I hoped there might be a better solution.

 

Does anyone have any suggestions ?

 

Thanks

 

Phillip

Share this post


Link to post
Share on other sites
Advertisement

I think the rendering and subsequent edge-detection method might be the best way, if that achieves what you want. The first problem that springs to my mind is that mesh edges could overlap at different depths in such a way that the corners of you're silhouette are formed by intersecting edges, rather than by vertices.

Share this post


Link to post
Share on other sites

If you project the mesh as a group of triangles to the 2D surface you'll have a series of segments and triangles.  Sort the triangles by axis aligned left-most points.  Remove segments, the degenerate case.  Then loop through your triangles and maintain a list of shapes.  For each new triangle attempt to merge against any of the maintained shapes.   If it merges, attempt to see if the newly merged shape can be merged with other shapes on the list.  If no new shapes can be merged grab the next triangle.  Continue until you have your projected image.  All points on the border of your image are external points.  If a point is not on this list then it's one of two things:  (1) an existing internal point that you want to remove, or (2) a newly created point that is constructed from two triangles that intersect somewhere other than their endpoints.

 

If your original 3D shape is convex in 3D then its project should also be convex and you only need to take the convex hull of your points.

 

I'm guessing the above might be computationally expensive.

Edited by Cosmic314

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!