MapAnalyzer.Polygon

Module Contents

Classes

Buildables(polygon)

Represents the Buildable Points in a Polygon,

Polygon(map_data: MapData, array: ndarray)

Base Class for Representing an “Area”

class MapAnalyzer.Polygon.Buildables(polygon)[source]

Represents the Buildable Points in a Polygon,

“Lazy” class that will only update information when it is needed

Tip

BuildablePoints that belong to a ChokeArea

are always the edges, this is useful for walling off

property free_pct(self)[source]

A simple method for knowing what % of the points is left available out of the total

update(self)[source]

To be called only by Polygon, this ensures that updates are done in a lazy fashion,

the update is evaluated only when there is need for the information, otherwise it is ignored

class MapAnalyzer.Polygon.Polygon(map_data: MapData, array: ndarray)[source]

Base Class for Representing an “Area”

property buildables(self)[source]
Return type

BuildablePoints

Is a responsible for holding and updating the buildable points of it’s respected Polygon

property regions(self)[source]
Return type

List[Region]

Filters out every Polygon that is not a region, and is inside / bordering with self

plot(self, testing: bool = False)[source]

plot

property nodes(self)[source]

List of Point2

property corner_array(self)[source]
Return type

ndarray

property width(self)[source]

Lazy width calculation, will be approx 0.5 < x < 1.5 of real width

property corner_points(self)[source]
Return type

List[Point2]

property center(self)[source]

Since the center is always going to be a float,

and for performance considerations we use integer coordinates.

We will return the closest point registered

is_inside_point(self, point: Union[Point2, tuple])[source]

Query via Set(Point2) ‘’fast’’

is_inside_indices(self, point: Union[Point2, tuple])[source]

Query via 2d np.array ‘’slower’’

property perimeter(self)[source]

The perimeter is interpolated between inner and outer cell-types using broadcasting

property perimeter_points(self)[source]

Useful method for getting perimeter points

property area(self)[source]

Sum of all points

Indices and tables