PolygonIntersection | Cellzilla2D Home |

Description

Determines which edges of the polygon a line through its centroid intersects.

Needs["Cellzilla2D`"];

Return Value

PolygonIntersection[{v1,v2}, {{x1,y1},
{x2,y2},...}] returns a list
{{{i,{x_{i},y_{i}}}, {j,
{x_{j},y_{j}}}, ...} of intersections. The integers i,
j, ... refer to the edge number; the pairs {x,y} give the intersection
coordinates.

{v1,v2} is any direction vector of the line (does not need to be normalized}.

{{x1,y1}, {x2,y2}, ...} are the coordinates of the vertices of the polygon.

Options

Example

[ Download Example as Zipped Mathematica Notebook ]

Implementation Notes

See Also