Rename frontline vector to bounds, add a class.

This isn't actually the data that callers usually want. Most of the
callers just want the bounds. The heading and length are trivially
computed from that. Add a class to contain the result so it's easier to
refactor.
This commit is contained in:
Dan Albert
2022-09-11 14:12:07 -07:00
committed by Raffson
parent 46ddd884a2
commit a9f6e3a0c3
6 changed files with 65 additions and 58 deletions

View File

@@ -77,11 +77,16 @@ class Builder(IBuilder[CasFlightPlan, CasLayout]):
FrontLineConflictDescription,
)
ingress, heading, distance = FrontLineConflictDescription.frontline_vector(
bounds = FrontLineConflictDescription.frontline_bounds(
location, self.theater, self.coalition.game.settings
)
center = ingress.point_from_heading(heading.degrees, distance / 2)
egress = ingress.point_from_heading(heading.degrees, distance)
ingress = bounds.left_position
center = ingress.point_from_heading(
bounds.heading_from_left_to_right.degrees, bounds.length / 2
)
egress = ingress.point_from_heading(
bounds.heading_from_left_to_right.degrees, bounds.length
)
ingress_distance = ingress.distance_to_point(self.flight.departure.position)
egress_distance = egress.distance_to_point(self.flight.departure.position)