Some adjustments to coordtrans
This commit is contained in:
parent
855adcab13
commit
b1c8bbc895
@ -64,8 +64,8 @@ public class CoordTransform {
|
|||||||
* @param origYOffs the y-offset of the origin of the OBJ coordinate system, <b>in the OpenRocket coordinate system</b>
|
* @param origYOffs the y-offset of the origin of the OBJ coordinate system, <b>in the OpenRocket coordinate system</b>
|
||||||
* @param origZOffs the z-offset of the origin of the OBJ coordinate system, <b>in the OpenRocket coordinate system</b>
|
* @param origZOffs the z-offset of the origin of the OBJ coordinate system, <b>in the OpenRocket coordinate system</b>
|
||||||
*/
|
*/
|
||||||
public static CoordTransform generateUsingLongitudinalAndForwardAxes(Axis axialAxis, Axis forwardAxis,
|
public static CoordTransform generateUsingAxialAndForwardAxes(Axis axialAxis, Axis forwardAxis,
|
||||||
double origXOffs, double origYOffs, double origZOffs) {
|
double origXOffs, double origYOffs, double origZOffs) {
|
||||||
if (axialAxis == null || forwardAxis == null) {
|
if (axialAxis == null || forwardAxis == null) {
|
||||||
throw new IllegalArgumentException("Axes cannot be null");
|
throw new IllegalArgumentException("Axes cannot be null");
|
||||||
}
|
}
|
||||||
@ -74,6 +74,8 @@ public class CoordTransform {
|
|||||||
throw new IllegalArgumentException("Axes must be different");
|
throw new IllegalArgumentException("Axes must be different");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Axis depthAxis = Axis.getThirdAxis(axialAxis, forwardAxis);
|
||||||
|
|
||||||
Axis xAxis = null;
|
Axis xAxis = null;
|
||||||
Axis yAxis = null;
|
Axis yAxis = null;
|
||||||
Axis zAxis = null;
|
Axis zAxis = null;
|
||||||
@ -96,14 +98,15 @@ public class CoordTransform {
|
|||||||
case Z_MIN -> zAxis = Axis.Y_MIN;
|
case Z_MIN -> zAxis = Axis.Y_MIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
Axis depthAxis = Axis.getThirdAxis(axialAxis, forwardAxis);
|
|
||||||
switch (depthAxis) {
|
switch (depthAxis) {
|
||||||
case X -> xAxis = Axis.Z;
|
// OpenRocket uses left-handed coordinate system, so invert the axis
|
||||||
case X_MIN -> xAxis = Axis.Z_MIN;
|
case X -> xAxis = Axis.Z_MIN;
|
||||||
case Y -> yAxis = Axis.Z;
|
case X_MIN -> xAxis = Axis.Z;
|
||||||
case Y_MIN -> yAxis = Axis.Z_MIN;
|
case Y -> yAxis = Axis.Z_MIN;
|
||||||
case Z -> zAxis = Axis.Z;
|
case Y_MIN -> yAxis = Axis.Z;
|
||||||
case Z_MIN -> zAxis = Axis.Z_MIN;
|
case Z -> zAxis = Axis.Z_MIN;
|
||||||
|
case Z_MIN -> zAxis = Axis.Z;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xAxis == null || yAxis == null || zAxis == null) {
|
if (xAxis == null || yAxis == null || zAxis == null) {
|
||||||
|
@ -223,7 +223,7 @@ public class OBJOptionChooser extends JPanel {
|
|||||||
opts.setScaling((float) scalingModel.getValue());
|
opts.setScaling((float) scalingModel.getValue());
|
||||||
opts.setLOD((ObjUtils.LevelOfDetail) LOD.getSelectedItem());
|
opts.setLOD((ObjUtils.LevelOfDetail) LOD.getSelectedItem());
|
||||||
|
|
||||||
CoordTransform transformer = CoordTransform.generateUsingLongitudinalAndForwardAxes(
|
CoordTransform transformer = CoordTransform.generateUsingAxialAndForwardAxes(
|
||||||
(Axis) axialCombo.getSelectedItem(), (Axis) forwardCombo.getSelectedItem(),
|
(Axis) axialCombo.getSelectedItem(), (Axis) forwardCombo.getSelectedItem(),
|
||||||
rocket.getLength(), 0, 0);
|
rocket.getLength(), 0, 0);
|
||||||
opts.setTransformer(transformer);
|
opts.setTransformer(transformer);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user