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!