Selecting points which belong to parallel planes
古いコメントを表示
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
採用された回答
その他の回答 (1 件)
Image Analyst
2016 年 4 月 19 日
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 件のコメント
Tim Navr
2016 年 4 月 19 日
Image Analyst
2016 年 4 月 19 日
I don't see why you say that, but whatever....good luck.
Tim Navr
2016 年 4 月 19 日
カテゴリ
ヘルプ センター および File Exchange で Process Point Clouds についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!