Use shapely projection instead of brute force.

Converts the landmap to use MultiPolygon instead of a collection of
polygons, since Shapely has explicit support for this.

Because we've done that, we can use a single projection from a line
instead of brute forcing the extent of the front line.

This makes turn processing ~66% faster (3 seconds to 1.8).

There are probably other places this should be used.
This commit is contained in:
Dan Albert
2020-12-24 00:54:57 -08:00
parent 2a65916f7c
commit b9138acbc8
11 changed files with 42 additions and 23 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -2,6 +2,9 @@ import pickle
from dcs.mission import Mission
from shapely import geometry
from shapely.geometry import MultiPolygon
from game.theater.landmap import Landmap
for terrain in ["cau", "nev", "syria", "channel", "normandy", "gulf"]:
print("Terrain " + terrain)
@@ -29,4 +32,6 @@ for terrain in ["cau", "nev", "syria", "channel", "normandy", "gulf"]:
with open("../{}landmap.p".format(terrain), "wb") as f:
print(len(inclusion_zones), len(exclusion_zones), len(seas_zones))
pickle.dump((inclusion_zones, exclusion_zones, seas_zones), f)
pickle.dump(Landmap(MultiPolygon(inclusion_zones),
MultiPolygon(exclusion_zones),
MultiPolygon(seas_zones)), f)