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

• nucloxylon
In summary, The speaker describes a method for slicing a 3D shape and computing the intersections of the plane and triangle faces to obtain line segments for a 2D polygon. The problems faced include unordered line segments, rounding errors, and disjointed polygons. The speaker suggests considering slicing segments instead of triangles to potentially simplify the process.

#### nucloxylon

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, anyone know a fast method to do this and how to deal with the multiple polygons?

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.