MATLAB: Cross Section of PointCloud

cross-sectionpoint cloud

Hello everyone,
I have a 3D point cloud, and I want to find the cross section of it by slicing it with a plane that is defined by a point and a perpendicular vector. Then I wish to detect and store the points close to the plane on either side. Any ideas on how to do this? Thanks in advance.

Best Answer

Ok. Given a tolerance in the form of a distance, then just compute the distance to the plane!
Retain any points that lie within the tolerance.
Personally, I'd probably color code the points as plotted, based on how far they lie off the plane, but within the tolerance.
If you know how to define a plane, based on a point and the normal to the plane, then the distance is given by a simple dot product. So if pointInPlane is the point, and normalToPlane is the normal vector (assume it is of unit length)
D = dot(P-pointInPlane,normalToPlane);
If you do this carefully, the above computation is vectorized. Even simpler, you can do it as a simple matrix multiply, without even needing the function dot. After all, a matrix*vector multiply is just a dot product anyway. Use find to choose the points that are closer than the indicated tolerance. Then I'd just use a tool like scatter to plot the points with my chosen color mapping.
Related Question