Problem 42821. Polygon division
Given the number of vertices (or sides), n, of a planar convex polygon, return the number of ways, w, in which you can divide the polygon into triangles, such that:
1. The division is done by drawing straight lines between existing vertices.
2. The triangles are made of existing vertices.
3. Different orientations of a similar solution are counted as different solutions.
Assume that n is a positive integer greater than 2.
Example 1:
n = 4 (square)
w = 2 (you can draw a line between vertices 1 and 3, as well as a line between vertices 2 and 4)
Example 2:
n = 5 (pentagon)
w = 5
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers21
Suggested Problems
-
2353 Solvers
-
Replace NaNs with the number that appears to its left in the row.
3037 Solvers
-
How to find the position of an element in a vector without using the find function
2776 Solvers
-
Omit columns averages from a matrix
606 Solvers
-
Find the sides of an isosceles triangle when given its area and height from its base to apex
2072 Solvers
More from this Author45
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!