Question about lines/triangles with adjacency

I’m learning about the added GS primitives and have some questions.

Q1. Regarding the lines/triangles with adjacency primitives: When I specify the vertex data in the application code, how do I indicate that an edge does not have an adjacent vertex? For example, assume I am using triangles with adjacency and the current triangle is at the edge of the geometry and one of the triangles edges does not have an adjacent vertex…

Q2. Is there a library (hopefully open source) that will take in arbitrary geometry vertex data (made of triangles) and output the same geometry described in triangles with adjacency (instead of simply triangles). I would also love a link to a good algorithm and description of the algo if possible.


Q1. Since these primitive types expect a fixed number if vertices, you’d probably have to supply degenerates (just duplicate either the beginning or ending verts).

Q2. For a simple do-it-yourselfer, look into something like the winged-edge data structure for processing your model (really all you need is the edge vertex pointers and the 2 opposite triangle verts). Each triangle in your model would consist of 3 such edges.