RandallDavis / roll20-areaMapper

Script using Roll20's API to draw and manage area maps.
3 stars 0 forks source link

Embedded gaps in polygons #15

Open RandallDavis opened 9 years ago

RandallDavis commented 9 years ago

Completely embedded within a polygon, have "cutouts". This could be used for floors to create gaps where other areas could be viewed when interlacing.

Design approach:

RandallDavis commented 9 years ago

Inverted polygons are a basic form of this logic, but there's only one gap to account for.

RandallDavis commented 9 years ago

Handle this as a larger use of the inverted polygon (single island) approach.

Each positive space polygon has a control point that has the greatest y value of its least x value points. Each positive space polygon bridges out to the left from the control point and from the pixel below the control point.

Positive space polygons are dependent on other positive space polygons if their bridges intersect the other polygon. Dependencies are built such that any positive space polygon depends on 0 or 1 other positive space polygons (directed acyclic graph of clusters). There might be an edge case where the bridge simultaneously hits 2 polygons - in this case, shift the bridge to prevent this?

A positive space polygon with no dependency will bridge to the negative space border. Positive space polygons with with a dependency will bridge to its dependency.

Create the border with bridges to the polygons that depend on it. Inject dependent polygons (insertion with a DAG ordering) with bridges to their dependencies.