Problem 60981. Mesh the pentagon (with the minimum number of triangles)
Problem statement
An pentagon is a regular polygon with 5 vertices and 5 edges. Here below is an example of the vertex set V, corresponding to the XYZ coordinates column vectors of a pentagon included in the unit circle.
V = [1 0 0;
cos(2*pi/5) sin(2*pi/5) 0;
cos(4*pi/5) sin(4*pi/5) 0;
cos(4*pi/5) sin(-4*pi/5) 0;
cos(2*pi/5) sin(-2*pi/5) 0];
A triangulated mesh T (stands for triangles here) -or a triangulation- is simply a N x 3 matrix of positive integers where each row contains the vertex indices of a triangle, and where N is the number of triangles.
Your task here is to mesh this pentagon with the minimum possible number of triangles. To do so, you will list the pentagons/rows in a matrix of faces, F. The row order of the triangles in the list doesn't matter.
Example
The first triangle here can be [1, 2, 3] if counterclockwise oriented.
Tip
Beware to avoid self intersecting triangles.
Forbidden functions / expressions
- regexp
- assignin
- str2num
- echo
See also
Solution Stats
Problem Comments
-
1 Comment
Nicolas Douillet
on 23 Jul 2025 at 16:04
To visualize and check your result you can do for instance :
trisurf(T,V(:,1),V(:,2),V(:,3));
colormap([0 1 1]);
axis equal, alpha(0.5);
Solution Comments
Show commentsProblem Recent Solvers8
Suggested Problems
More from this Author42
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!