# How to find points over a single border of a surface

5 views (last 30 days)
ENRICO FAIELLA on 22 May 2023
Commented: Image Analyst on 1 Jun 2023
Hi guys,
i'm dealing with a 3D surface which has straight and curved borders. I have a matrix which contains all the points laying on the borders, now i want to extract the points on each border. Since i work with different kind of surface, i can't select the points by the way of x y or z values, bcs I can have also an inclined surface, and so no chance to select points which share the same x, y or z coordinates.
Do u have some suggestions?
Hope the question is clear and thanks in advance.
Image Analyst on 1 Jun 2023

Shubham on 1 Jun 2023
Hi ENRICO,
Since you have a mesh representation of the surface and a matrix of points on the borders, you can use the connectivity information to identify and separate the points that belong to each border. Here's one approach you could try:
1. First, you need to find the vertices in the mesh that correspond to the points in your Nx3 matrix. You can do this by computing the Euclidean distance between each point in the matrix and every vertex in the mesh. If the distance between a matrix point and a mesh vertex is below a certain threshold (e.g., 10^-3), you can assume that they represent the same point.
2. Once you have identified the mesh vertices that correspond to the points in your matrix, you can use the connectivity information to separate the vertices that belong to each border. You can start by identifying all the vertices that are adjacent to the points in the matrix. Then, you can traverse the mesh along the edges to find all the vertices that are connected to the previously identified vertices. Repeat this process until you have identified all the vertices that form a closed loop around the border.
3. After identifying the vertices that belong to each border, you can generate a new mesh for each border by selecting the vertices that belong to the current border and their corresponding triangles. You can then save each mesh as a separate file or use it for further processing.
I hope this approach helps!