Shkyrockett / engine

MIT License
5 stars 0 forks source link

Implement Geometry Clipping #15

Open Shkyrockett opened 7 years ago

Shkyrockett commented 7 years ago

A Polygon clipping system is needed. It will most likely be used by the Editor more than anything else, but is needed.

Requirements:

Shkyrockett commented 7 years ago

While researching, I have found that there are several interesting algorithms.

Shkyrockett commented 7 years ago

Have implementations of Sutherland Hodgman, Greiner Hormann, and Martinez. Martinez is looking promising. If I could separate the clipping algorithm from Clipper, it would be interesting to see how Vatti works, and whether it meets the qualifications.

Shkyrockett commented 7 years ago

The current implementation of the Martinez polygon clipping algorithm here does not work quite right when an inside shape node intersects an outer shape line. The following picture is supposed to be an intersection clipping. The red should be the intersection, the blue green is what it should look like. clipping error The current implementation of the Martinez polygon clipping algorithm uses the older version of the algorithm. This could possibly have been fixed in the later update that has been released.