Function to find points in pointcloud

Hi all
My issue is that i have a big pointbloud in XYZ coord. Ive got 2 XYZ points, where i need to find all the points in the cloud, which is between this two given points. Does anyone know which kind of funktion i need to use for this? i have tried the find-function, but couldent get it to work.
thanks in advance.

1 Commento

As Image points out, your question lacks definition. Find did not work, because it is not designed to do what you did not explain well.
In a 3-dimensional point cloud, what does it mean to be "between" two points? I can certainly think of several ways to define between in that context, and all of them are potentially wrong by your definition.
As well, I often find that when someone does not explain something like this clearly, it often means they have not really thought out what they wanted to do. And if you don't know what you want, how can we know?

Accedi per commentare.

 Risposta accettata

Image Analyst
Image Analyst il 20 Dic 2014
So you have a scattering of points in 3D space, specified by an N by 3 array of [x,y,z] coordinates, right? Now, exactly what does it mean if a point is "between" two arbitrary points somewhere in 3D space? Do you want to connect those two points with a vector, then consider two planes (one at each point) that is normal to the vector, and then any points that are between the two planes are "in between" the points? Or do you have another definition?

6 Commenti

Yes, you are spot on. Bit what i mean is, if you imagine a cloud of points, you get defined two or even four points that defines a space (or you could think of it as a box), where i want to make a function that is in between this space.
A box has eight vertices. The smallest volume, a tetrahedron, has 4. I can't visualize what you want - two points that completely define a box in 3D space. Please attach a diagram that illustrates what you want.
i tried to make a fast skitse of my problem. i got all the 8 points to define the corners, but theoretiaclly it should be possible to draw the box just from the two selected points. but anyway... my problem is to find out which red points is in between the green points.
OK, thanks. That helps. Let's say the two diagonal corner coordinates are (x1,y1,z1) and (x2,y2,z2). Let's first extract the x values and find out which are in the range [x1, x2]. Then we'll do the same thing for y and z and AND the logical indexes together and extract the points.
x = xyz(:, 1);
y = xyz(:, 2);
z = xyz(:, 3);
inRangeX = x >= x1 & x <= x2;
inRangeY = y >= y1 & y <= y2;
inRangeZ = z >= z1 & z <= z2;
% Find out rows where it's in range on all three axes.
pointsInRange = inRangeX & inRangeY & inRangeZ;
% Extract those points in the box to an output array.
boxPoints = xyz(pointsInRange, :);
If that works, please "Vote" for the Answer and mark it officially as "Accepted".
Thank you very much. i will try it out then i get to the university and reply to you.
I discoverd a error in my cloud, but it looks like your function works. Thanks...

Accedi per commentare.

Più risposte (0)

Richiesto:

il 20 Dic 2014

Commentato:

il 22 Dic 2014

Community Treasure Hunt

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

Start Hunting!

Translated by