Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Ordering Line Segments to form a 2D Polygon after slicing a 3D Tri Map

  1. Nov 3, 2011 #1
    I have a 3D shape described by a triangulation map i.e. a map between the vertices to the faces of the shape which are all triangles.

    I then sliced the shape by a plane and computed the intersections of the plane and the triangle faces. Each triangle face that intersects the plane, will have two intersection points on two of it's edges thus giving me a line segment that would be apart of the 2D polygon I'm hoping to get out of slicing.

    There are a few problems though. For one thing the Line Segments are not ordered. Also, because of some rounding errors, two adjacent line segments might not share the EXACT same point so there has to be some kind of tolerance. Finally the biggest problem I'm facing is that the polygon might be disjointed i.e. the 3D object is not convex, so the polygon slice might be made up of several different polygons.

    From a programming perspective, any one know a fast method to do this and how to deal with the multiple polygons?
  2. jcsd
  3. Nov 5, 2011 #2
    Maybe instead of thinking about slicing triangles to get segments (whose endpoints you then have to match up, worrying about rounding errors and such), you could think about slicing segments to get points. You know which segments belong to the same triangle, and therefore which pairs of resulting points need to have an edge between them, as well as an ordering for each pair (i.e. a normal vector). That might be all you need.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook