Identifying Boundary Nodes in a Point Cloud

I have 2 point clouds which represent the nodes of 2 3D separate lattices. There is a small gap between the lattices where they don't join together correctly. The boundary face closest to the other body is jagged. I want to identify these bounadry nodes so I can connect them and join my lattices (but the joining part is something I can do in external softwares). Does anyone have any suggestions on how I could go about identifying these boudary nodes? I have tried using the "boundary" function but I am trying with a criteria for identifying the nodes. Any help would be greatly appreciated. I have attached a picture of the nodes for reference.

4 Comments

So to confirm I understand what your goal is, in the second of the pictures above (the first one in 2-dimensional view) you'd want to identify specifically that the point at around Z = 36 and Y = 21 is missing as are Z = 33 and Y = 18 or 19, Z = 30 and Y = 15, and Z = 27 and Y = 11 or 12? And then your next step would be to somehow include them in either the red or blue points using some criteria to decide which color they should be?
Would you also want to detect that (for example) Z = 39 and Y = 11 or 12 is also missing even though it's not next to or on the boundary between the red and blue points?
Or do you just want to turn this grid with holes into a grid without holes to represent the union of the red and blue regions? Since you mentioned you're planning to "join my lattices" this would probably be easiest, identifying the unique Z and Y coordinates (perhaps with a tolerance by using uniquetol) and then doing some sort of gridding and/or interpolation.
I guess I just don't understand the problem either. You have two sets of points, the red and the blue points, and you want to join them and have a single set of points, right? So why do you have to find the boundary points? What is a boundary point is up for discussion unless you're talking about the convex hull. It depends on how closely you want the boundary to follow the individual points versus just skipping over some and considering those as part of the interior. But I'm wondering why you just don't concatenate the two coordinate sets into one variable of all (x,y) locations, like allPoints = [redPoints; bluePoints]. That would give you a single point cloud.
My apologies, maybe I haven't explained the context of my problem. So each point cloud represents the node points of a lattice. In this case obviously there are 2 separate lattices. Critically, these lattices are not joined to each other and also not of the same type of unit cell, hence their nodes don't align. I am trying to find the closest nodes to each other so I can find joining pairs. I will use these nodes coordinates to create a series of struts through which will attach the lattices. Does that make sense?
And did the suggestions of pdist2 or knnsearch not work? I've seen other people use them for that situation.

Sign in to comment.

Answers (3)

If the regions are supposed to be convex, you can use convhull or convhulln.

8 Comments

That’s what I started with but it creates a convhull for the whole structure, not just the jagged face region. These are the nodes I need to isolate to be able to join my lattices.
But it should be an easy post-processing step to discard the vertices that do not belong to the jagged face, at least if the situation is like in your illustrations. The discarded points will belong to elementary planes z=0, x=0, y=0, etc... which you can easily check.
Yes that’s correct, however I only want the closest (e.g) red points to the blue points, not all the other red internals. See the image I’ve attached below. This is where I am having problems as I am struggling to find a way to define or create a criteria to identify only the nodes on that jagged face that as closest to the blue nodes. I have .step files which wholly contains each set of points. So one file for the red points and one file for the blue points if you think that would help.
Matt J
Matt J on 23 Nov 2024
Edited: Matt J on 23 Nov 2024
See the image I’ve attached below.
There are no images below.
however I only want the closest (e.g) red points to the blue points, not all the other red internals.
But convhull doesn't give you the internal points. It gives you only the points on the boundary of the cloud's convex envelope. Some of those boundary faces you are not interested, the ones on the planes x=0, y=0, etc... But you said you agree that the vertices on those other faces can easily be located and eliminated from the list of points convhull() gives you. If so, I don't see the problem. If you eliminate the vertices you are not looking for, what's left has to be the vertices that you are looking for.
Apologies, not sure why my image didn't send. I am also having probelms with convhull not creating a boundary from all my points. Some points it misses.
I am also having probelms with convhull not creating a boundary from all my points. Some points it misses.
It misses them because they are not at the boundary of the convex hull (green line below). You need to articulate why any of the red points below the green line should be considered part of the boundary.
Do you have any suggestions on how to identify these points? I know this is a bit of a wild shot haha
You're the one who has made the decision that they belong in the boundary. Once you tell us why, we might have some suggestions.

Sign in to comment.

Your red nodes are sometimes immediately adjacent to your blue nodes. There is no way you will be automatically able to differentiate the nodes -- not unless there is some attached property that can tell them apart (such as color or reflectivity or infrared emission.)

1 Comment

I can differentiate between both the red and blue points okay. They are derived from two separate .csv’s which contain their xyz coordinates. It’s more identify the closest ones to each other on those jagged faces :/

Sign in to comment.

Maybe use either pdist2 or knnsearch to identify blue points that are closest to red points. In other words, pairs that have minimum distance between them.

Asked:

on 22 Nov 2024

Commented:

on 23 Nov 2024

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!