diff --git a/core/src/net/sf/openrocket/file/wavefrontobj/CoordTransform.java b/core/src/net/sf/openrocket/file/wavefrontobj/CoordTransform.java
index 547b76384..6b70aeb0d 100644
--- a/core/src/net/sf/openrocket/file/wavefrontobj/CoordTransform.java
+++ b/core/src/net/sf/openrocket/file/wavefrontobj/CoordTransform.java
@@ -60,9 +60,9 @@ public class CoordTransform {
* Create a new coordinate system converter.
* @param axialAxis the OBJ axis that corresponds to the OpenRocket axial (x-)axis
* @param forwardAxis the OBJ axis that corresponds to the OpenRocket forward (y-)axis
- * @param origXOffs the x-offset of the origin of the OBJ coordinate system, in the OBJ coordinate system
- * @param origYOffs the y-offset of the origin of the OBJ coordinate system, in the OBJ coordinate system
- * @param origZOffs the z-offset of the origin of the OBJ coordinate system, in the OBJ coordinate system
+ * @param origXOffs the x-offset of the origin of the OBJ coordinate system, in the OpenRocket coordinate system
+ * @param origYOffs the y-offset of the origin of the OBJ coordinate system, in the OpenRocket coordinate system
+ * @param origZOffs the z-offset of the origin of the OBJ coordinate system, in the OpenRocket coordinate system
*/
public static CoordTransform generateUsingLongitudinalAndForwardAxes(Axis axialAxis, Axis forwardAxis,
double origXOffs, double origYOffs, double origZOffs) {
@@ -79,12 +79,13 @@ public class CoordTransform {
Axis zAxis = null;
switch (axialAxis) {
- case X -> xAxis = Axis.X;
- case X_MIN -> xAxis = Axis.X_MIN;
- case Y -> yAxis = Axis.X;
- case Y_MIN -> yAxis = Axis.X_MIN;
- case Z -> zAxis = Axis.X;
- case Z_MIN -> zAxis = Axis.X_MIN;
+ // X-axis points from the tip to the bottom, so invert it
+ case X -> xAxis = Axis.X_MIN;
+ case X_MIN -> xAxis = Axis.X;
+ case Y -> yAxis = Axis.X_MIN;
+ case Y_MIN -> yAxis = Axis.X;
+ case Z -> zAxis = Axis.X_MIN;
+ case Z_MIN -> zAxis = Axis.X;
}
switch (forwardAxis) {
case X -> xAxis = Axis.Y;
@@ -109,11 +110,7 @@ public class CoordTransform {
throw new IllegalStateException("Axes should not be null");
}
- final double origXTrans = getTransformedOriginOffset(xAxis, origXOffs, origYOffs, origZOffs);
- final double origYTrans = getTransformedOriginOffset(yAxis, origXOffs, origYOffs, origZOffs);
- final double origZTrans = getTransformedOriginOffset(zAxis, origXOffs, origYOffs, origZOffs);
-
- return new CoordTransform(xAxis, yAxis, zAxis, origXTrans, origYTrans, origZTrans);
+ return new CoordTransform(xAxis, yAxis, zAxis, origXOffs, origYOffs, origZOffs);
}
@@ -179,6 +176,10 @@ public class CoordTransform {
return convertLoc(x, y, z, 0, 0, 0);
}
+ public FloatTuple convertLocWithoutOriginOffs(Coordinate coordinate) {
+ return convertLoc(coordinate.x, coordinate.y, coordinate.z, 0, 0, 0);
+ }
+
/**
* Converts the rotation coordinates from OpenRocket to OBJ coordinates.
* @param xRot OpenRocket rotation in radians around the x-axis
diff --git a/core/src/net/sf/openrocket/file/wavefrontobj/DefaultCoordTransform.java b/core/src/net/sf/openrocket/file/wavefrontobj/DefaultCoordTransform.java
index 9ab625751..c1554c907 100644
--- a/core/src/net/sf/openrocket/file/wavefrontobj/DefaultCoordTransform.java
+++ b/core/src/net/sf/openrocket/file/wavefrontobj/DefaultCoordTransform.java
@@ -11,6 +11,6 @@ package net.sf.openrocket.file.wavefrontobj;
*/
public class DefaultCoordTransform extends CoordTransform {
public DefaultCoordTransform(double rocketLength) {
- super(Axis.Y, Axis.Z, Axis.X_MIN, 0, 0, rocketLength);
+ super(Axis.Y, Axis.Z, Axis.X_MIN, rocketLength, 0, 0);
}
}
diff --git a/core/src/net/sf/openrocket/file/wavefrontobj/ObjUtils.java b/core/src/net/sf/openrocket/file/wavefrontobj/ObjUtils.java
index 6878d41a0..3a31365cb 100644
--- a/core/src/net/sf/openrocket/file/wavefrontobj/ObjUtils.java
+++ b/core/src/net/sf/openrocket/file/wavefrontobj/ObjUtils.java
@@ -143,7 +143,7 @@ public class ObjUtils {
*/
public static void translateVerticesFromComponentLocation(DefaultObj obj, CoordTransform transformer,
int startIdx, int endIdx, Coordinate translation) {
- FloatTuple translatedLoc = transformer.convertLoc(translation);
+ FloatTuple translatedLoc = transformer.convertLocWithoutOriginOffs(translation);
ObjUtils.translateVertices(obj, startIdx, endIdx, translatedLoc.getX(), translatedLoc.getY(), translatedLoc.getZ());
}