Mesh the pentagon (with the minimum number of triangles) - MATLAB Cody - MATLAB Central

Problem 60981. Mesh the pentagon (with the minimum number of triangles)

Difficulty:Rate
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

100.0% Correct | 0.0% Incorrect
Last Solution submitted on Aug 05, 2025

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers8

Suggested Problems

More from this Author42

Community Treasure Hunt

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

Start Hunting!