[#2050] Fix carets rotation in top view

This commit is contained in:
SiboVG 2023-02-14 00:47:13 +00:00
parent 4113f023f8
commit 8a691759b7
2 changed files with 11 additions and 6 deletions

View File

@ -125,10 +125,17 @@ public class RocketFigure extends AbstractScaleFigure {
updateFigure();
fireChangeEvent();
}
public double getRotation(boolean applyTopViewOffset) {
if (applyTopViewOffset && currentViewType == RocketPanel.VIEW_TYPE.TopView) {
return this.rotation - Math.PI/2;
} else {
return this.rotation;
}
}
public double getRotation() {
return rotation;
return getRotation(false);
}
public void setRotation(double rot) {
@ -142,7 +149,7 @@ public class RocketFigure extends AbstractScaleFigure {
private Transformation getFigureRotation() {
if (currentViewType == RocketPanel.VIEW_TYPE.TopView) {
return this.axialRotation.applyTransformation(Transformation.rotate_x(-Math.PI / 2));
return this.axialRotation.applyTransformation(Transformation.rotate_x(-Math.PI/2));
} else {
return this.axialRotation;
}
@ -299,10 +306,8 @@ public class RocketFigure extends AbstractScaleFigure {
Coordinate[] mountLocations = mount.getLocations();
double mountLength = mountComponent.getLength();
// System.err.println("Drawing Motor: "+motor.getDesignation()+" (x"+mountLocations.length+")");
for (Coordinate curMountLocation : mountLocations) {
Coordinate curMotorLocation = curMountLocation.add(mountLength - motorLength + mount.getMotorOverhang(), 0, 0);
// System.err.println(String.format(" mount instance: %s => %s", curMountLocation.toString(), curMotorLocation.toString() ));
// rotate by figure's axial rotation:
curMotorLocation = getFigureRotation().transform(curMotorLocation);

View File

@ -732,7 +732,7 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change
double cgy = Double.NaN;
double cpx = Double.NaN;
double cpy = Double.NaN;
final double rotation = rotationModel.getValue();
final double rotation = figure.getRotation(true);
FlightConfiguration curConfig = document.getSelectedConfiguration();
// TODO: MEDIUM: User-definable conditions