How to test if points are inside a point cloud model

I have a point cloud of a tree trunk, imported as a ply file. It is a point cloud so the tree trunk is not a surface, but points with gaps in between.
I also have the 3D coordinates of a bunch of points. How do I remove those points that are not inside the tree trunk? The model is not parallel with the axes by the way.
Here's a dropbox link for the ply file. Coordinates and values of the points are in the attached all_control_points.mat file. There's no code yet except the ones to generate this data.
https://www.dropbox.com/s/vf5id1hv0anruzx/Trunk%20Only.ply?dl=0

2 Comments

Can you post your code and data please?
Sorry for not including this. I have updated the question with the data. The ply file of the point cloud is too big so I'm sharing a dropbox link for it. There's no code yet except the ones used to generate the data.

Sign in to comment.

 Accepted Answer

Hi. I wrote a script and somehow it works 0_0. See attached script
This is what i ahieved
img0.png img1.png img2.png
Maybe someone can please explain why (and how) it works
% xc,yc,zc - control points (red on the image)
% xt,yt,zt - tree point (blue on the image)
ri = sqrt(xt(it).^2 + yt(it).^2); % radius of tree points
ri1 = griddata(xt(it), yt(it), zt(it), ri, ...
xc,yc,zc);
griddata() generates radius for points inside only (NaN for other)

2 Comments

Thank you so much, it works! I don't know why the griddata works either though.
Also, how did you determine that the model should be rotated by 75 degrees?
It's approximately. Just wanted the tree axis to be parallel to Z

Sign in to comment.

More Answers (0)

Products

Release

R2019a

Asked:

on 1 Aug 2019

Commented:

on 2 Aug 2019

Community Treasure Hunt

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

Start Hunting!