MATLAB Answers

Export a plane in 3D coordinate as a surface mesh (STL file)

12 views (last 30 days)
Torkan Gholamalizadeh
Torkan Gholamalizadeh on 11 Sep 2020
Answered: Aditya Patil on 25 Sep 2020
I have four points in 3D space which are coplanar. I want to export the plane created by these 4 points as a STL file. I have tried to use "delaunayTriangulation" function as follow
x = [-86.0789; -98.9967; -96.7493; -88.3263];
y = [-67.3229; -82.9531; -72.5115; -77.7645];
z = [45.9099; 23.8005; 35.4591; 34.2513];
tri = delaunayTriangulation(x,y,z);
stlwrite(tri,'plane.stl');
However I get a warning stating that "The triangulation is empty - the points may be coplanar or collinear." and the "tri" variable is empty. Do you have any suggestions for exporting such a plane in 3D space as a STL file?
Could it be due to the reason that the triangulation does not fit in the Delaunay triangulation criterion as mentioned here? if it is the case, how can I sample more points such that I can garantee that they would fit in the critetion and can export the plane as surface mesh?

  4 Comments

Show 1 older comment
Aditya Patil
Aditya Patil on 24 Sep 2020
Can you provide the output of version command. I am unable to reproduce it with 2020a.
Torkan Gholamalizadeh
Torkan Gholamalizadeh on 25 Sep 2020
I am using the following version '9.8.0.1323502 (R2020a)'. However, I can't reproduce the problem with those points.
Would you please check this simpler example where the data points are all on a plane. After calling the stlwrite function, I get the following warning and error:
Warning: The triangulation is empty - the points may be coplanar or collinear.
Error using stlwrite (line 27)
Input triangulation is empty.
x =[0; 0; 1; 1];
y =[0; 0; 1; 1];
z =[0; 1; 1; 0];
tri = delaunayTriangulation(x,y,z);
stlwrite(tri,'plane.stl');

Sign in to comment.

Answers (1)

Aditya Patil
Aditya Patil on 25 Sep 2020
delaunayTriangulation tries to create a 3D triangulation if three parameters, viz x,y, and z are provided. In your case, as you are providing 3 parameters, it goes for 3D triangulation . However your points are planar, hence it cannot create the triangulation.
You need to rotate your plane to fit 2D coordinates, and then create the triangulation.

  0 Comments

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!