c++ - triangulating a triangle into a grid -
Is there an algorithm for dividing a triangle that can dissolve many grid elements into several triangles, where a triangle Which is not that many grid elements?
I have included a glance hand-graphic of a triangle in a 2x2 grid which is applied in seven small triangles.
- Your triangle closes the polygon to the 3 rows
- The arrangement of points gives you the winding rule (CW or CCW)
1. Queue all the rows by the grid lines
- But still the single closed polygon Leave the triangle as
- < Li>
- Simply group all the rows related to the same grid cell together
- then all the points are inside the cell or on the side
- Do not change the rotation!
- Start from the first line in the first line in your direction
- If not, then the cell line in the same winding direction
- Any other line point Or do not hit the cell corner
- Stop it until it stops
- Similar to other cells
- then just divide it into triangles
- (triangle Fan)
3. Change the list of rows to polygons off
4. Now you have closed the convex polygon list
Comments
Post a Comment