[#1849] Only apply component context transforms once

This commit is contained in:
SiboVG 2022-11-24 16:55:35 +01:00
parent f723508491
commit ca007d7e93

View File

@ -748,7 +748,12 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
} else {
// Legacy Case: These components do not implement the BoxBounded Interface.
Collection<Coordinate> instanceCoordinates = component.getComponentBounds();
List<RocketComponent> parsedContexts = new ArrayList<>();
for (InstanceContext context : contexts) {
// Don't parse the same context component twice (e.g. multiple copies in a pod set).
if (parsedContexts.contains(context.component)) {
continue;
}
Collection<Coordinate> transformedCoords = new ArrayList<>(instanceCoordinates);
// mutating. Transforms coordinates in place.
context.transform.transform(instanceCoordinates);
@ -759,7 +764,9 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
}
componentBounds.update(tc);
}
parsedContexts.add(context.component);
}
parsedContexts.clear();
}
rocketBoundsAerodynamic.update(componentBoundsAerodynamic);