# Given a set of Vertices: Determine Boundary Vertices and Connection Order

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

## Recommended Posts

Hello

I am looking for suggestions on algorithms I can use to determine the boundary points/vertices of a list of vertices. I also need to determine which boundary point connects to which other boundary point.

I have my own solution but it involves alot of steps and is more procedurally based rather than mathematically based. Can you suggest any algorithms (both procedural and mathematic)?

My approach:

•    - Organise the vertices into a Dictionary <int, List<Triangle>> vertexTriangleMap. Where the keys are the indexes of the vertices and the values are lists of the triangles that involve that vertex
•    - Pick a random vertex(RV) then pick a random triangle involving that vertex. For eg; vertexTriangleMap[9][0]
•    - Of the 2 other vertices in this triangle: Determine which involves the least triangles (the point w the least triangles = OV)
•        - Search through OV's triangles looking for another triangle that involves the vertices OV AND RV:
•            - if there is more than 1 triangle that involves these 2 points then that means that OV is NOT a boundary point else OV is a boundary point AND I know it connects to RV. OV now becomes RV and I can now repeat the process and I will determine which boundary points connect to which. I'll know when to stop when I reach the beginning again (the first RV).

Edited by gretty

##### Share on other sites

Look for edges... a boundary vertex is on an edge which is only included in 1 triangle.

##### Share on other sites

That will help me ensure that the first random point is infact a boundary point but not all boundary vertices involve 1 triangle. Look at the example picture on my OP. The top left corner involves 2 and the next 2 boundary points below involve even more triangles.

Determining the number of triangles each vertex is involved in and using the least as the boundary points was my original approach but it doesn't work. For irregular TINs (Triangular Irregular Networks), like ones that aren't rectangular, a boundary point can have as much as 5 triangles or more.

Edited by gretty

##### Share on other sites

A boundary edge does involve just 1 triangle though. Do you not know edge information for your vertices? Find the edges then classify the vertices.

##### Share on other sites

Not clear if you already have a triangulation. If not, there are an infinite number of ways to triangulate a vertex cloud; to define connectivity between vertices. If you only need to connect vertices on the boundary, computing the convex hull (QuickHull algorithm) probably makes most sense. If you want to allow concavities in the hull, you could insert vertices into a Delaunay triangulation.

Edited by eppo

##### Share on other sites

Not clear if you already have a triangulation. If not, there are an infinite number of ways to triangulate a vertex cloud; to define connectivity between vertices. If you only need to connect vertices on the boundary, computing the convex hull (QuickHull algorithm) probably makes most sense. If you want to allow concavities in the hull, you could insert vertices into a Delaunay triangulation.

Thanks QuickHull looks like a nice elegant solution but unfortunately wont work for the tins I am working with - they are tins of roads so imagine a loose 'J' shape. With QuickHull I'll end up having the end of the J joined to the start of the J I believe.

I'll look into Delaunay, at first glance it looks like this algorithm calculates all vertex connections/triangles and not just the boundary points? Is that correct?

Yes, the information I have is the triangulation and the vertices, thats the only information I have but not the boundary vertices or their connection order.

Edited by gretty

##### Share on other sites

Well it's not hard to build a list of edges from triangulation data if neighbouring triangles share vertices. Once you have edge information it is easy to find boundary edges and vertices.

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 18
• 34
• 9
• 16
• 22