How to split a convex polygon into right triangles aligned along the X and Y axes?

For a convex polygon represented by many vertices (we can assume that they are in counterclockwise order), how can this polygon be divided into many right triangles whose legs are aligned with X- and Y -axes?

Since I probably lack mathematical terminology, “legs” is what I call these two lines, which are not hypotenuse (apologies in advance if I hit mathematical jargon in the face - short corrections are an additional credit).

+3
source share
6 answers

I'm not sure about writing an algorithm for this, but it's entirely possible to do this for any convex polygon on a piece of paper. For each vertex, project a line vertically or horizontally from that vertex until it meets the other of these vertical or horizontal lines. For vertices with small angle changes, where the adjacent sides move in the same direction in terms of x and y, you will need to add two lines from the vertex, one horizontal and one virtual. Once you do this, you should stay with the polygon in the center of the polygon, but with sides that are vertical or horizontal, because the sides were formed by lines made from the vertices of the original polygon. Since these sides are vertical or horizontal,this shape can be easily divided into several triangles with one horizontal side, one vertical side and one hypotenuse.

+1

, , , .

. V , V . , :

  • , , / Y- ( , , , )
  • Y- , ( ).

"" .

. - . - , , . , - Y-. , .

. ( , ), , , . . , 0-2 , / Y-, .

, , . . ; , , .

.

+1

, . , X Y. , , X, Y?

, x, y. , . , , , - .

0

, . X Y. , X, Y, , . , . , ( ​​ ), .

, Neil N .

0

, . , - .

, X, . .

, X, - , .

(.. min max y) .

, .

0

, .

{(0, 1), (1, 0), (2, 0)}

.
 ..

This triangle cannot be split into a finite number of triangles, as you describe.

0
source

Source: https://habr.com/ru/post/1703042/


All Articles