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.

before and after

  • 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!

    3. Change the list of rows to polygons off

    • 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

    4. Now you have closed the convex polygon list

    • then just divide it into triangles
    • (triangle Fan)

    grid from triangle


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -