I need to make a surface triangulation of stones (aggregates) point cloud in Matlab. For this I have x,y,z
in Cartesian coordinate system.
For the simplicity I have started with spherical object.
DT = delaunayTriangulation(x,y,z);
figure
trisurf(DT.ConnectivityList,DT.Points(:,1),DT.Points(:,2),DT.Points(:,3), ...
'FaceColor','cyan','FaceAlpha', 0.8);
Run the code and result is: Triangulation of Spherical Object
It makes triangles inside the sphere too. Connecting one point to another one in opposite or somewhere else.
Also, delaunayTriangulation()
function triangulates for idealized surfaces and do not works for sensitive surfaces. Think about the surface of stone, there are a lot of irregularity on it.
Then I have tried DelaunayTri()
function. It worked for sphere object, triangulated only surface. But when tried more complex (stone) shape, the function just idealized the shape and not considered all protrusions (irregularity) of stone.
tri = DelaunayTri(x,y,z);
[FBtri,FBpoints] = freeBoundary(tri);
figure
trisurf(FBtri,FBpoints(:,1),FBpoints(:,2),FBpoints(:,3), ...
'FaceColor','cyan','FaceAlpha', 0.8);
When freeBoundary()
function removed from above code, result is same (idealized) and triangulation made inside the object, which is not acceptable.
Finally, I have used the delaunay()
function. Which is even not correctly triangulated the sphere.
tri = delaunay(x,y,z);
figure
trisurf(tri,x,y,z,'FaceColor','cyan','FaceAlpha', 0.8);
Question: With which function and how (please detailed) can I make the detailed 3D triangulation of any shaped stone surface? What was my mistakes above codes?
None of the pure delaunay
-based methods you tried will do what you want -- they all tessellate the full convex-hull of the input, not just the surface.
Reconstructing general surfaces from point-clouds is not a straight-forward task. I don't believe it can be done directly using a built-in MATLAB
function.
You may wish to look into other options, such as the surface-reconstruction tools provided by CGAL.