Selecting points which belong to parallel planes
Ältere Kommentare anzeigen
Hi and thanks for looking
I have a cloud of points, which very roughly form an irregular cylinder. I need to draw a number of parallel planes through it and calculate which points belong to which plane. Then, I need to calculate the squared sum of distances from those points to the principal axis. So, for each plane there will be 1 value (sq sum of distances). I have calculated its principal axis and am not sure how to proceed next. I know that the principal axis is the normal to the planes
Thank you for your help
Akzeptierte Antwort
Weitere Antworten (1)
Image Analyst
am 19 Apr. 2016
First of all, rotate the array so that your principal axis is along the Z direction. Then get the center of the rotated cloud: xCenter, yCenter.
Then, assuming you have 3 vectors for x, y, and z, then you can find all points in a slice within "tolerance" of some z value, zSlice, like this (untested):
tolerance = 0.4; % Whatever thickness you want.
indexesInSlice = abs(z - zSlice) < tolerance;
% Then extract x and y that "belong" to that slice
inSliceX = x(indexesInSlice);
inSliceY = y(indexesInSlice);
Now compute "the squared sum of distances from those points to the principal axis."
sumOfDistances = sum(sqrt((inSliceX - xCenter).^2 + (inSliceY - yCenter).^2));
squaredSumOfDistances = sumOfDistances .^ 2;
Or if you really meant "the sum of squared distances from those points to the principal axis."
sumOfSquaredDistances = sum((inSliceX - xCenter).^2 + (inSliceY - yCenter).^2);
3 Kommentare
Tim Navr
am 19 Apr. 2016
Image Analyst
am 19 Apr. 2016
I don't see why you say that, but whatever....good luck.
Tim Navr
am 19 Apr. 2016
Kategorien
Mehr zu Point Cloud Processing finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!