Skip to content

Commit 76c5b3d

Browse files
authored
deprecate Quaternion.negate() (#1702)
* add Quaternion.negateLocal() and deprecate Quaternion.negate() * Quaternion: simplify negateLocal() slightly * Quaternion: revert some unintended changes * Quaternion: revert another unintended change
1 parent e79340a commit 76c5b3d

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

jme3-core/src/main/java/com/jme3/math/Quaternion.java

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,12 +1264,27 @@ public Quaternion inverseLocal() {
12641264

12651265
/**
12661266
* Flip the signs of all components of this Quaternion.
1267+
*
1268+
* @deprecated The naming of this method doesn't follow convention. Please
1269+
* use {@link #normalizeLocal()} instead.
12671270
*/
1271+
@Deprecated
12681272
public void negate() {
1269-
x *= -1;
1270-
y *= -1;
1271-
z *= -1;
1272-
w *= -1;
1273+
negateLocal();
1274+
}
1275+
1276+
/**
1277+
* Flip the signs of all components.
1278+
*
1279+
* @return the (modified) current instance (for chaining)
1280+
*/
1281+
public Quaternion negateLocal() {
1282+
x = -x;
1283+
y = -y;
1284+
z = -z;
1285+
w = -w;
1286+
1287+
return this;
12731288
}
12741289

12751290
/**

jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/anim/FbxToJmeTrack.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ private Track toJmeTrackInternal(int boneIndex, Transform inverseBindPose) {
154154
if (i > 0) {
155155
if (rotations[i - 1].dot(rotations[i]) < 0) {
156156
System.out.println("rotation will go the long way, oh noes");
157-
rotations[i - 1].negate();
157+
rotations[i - 1].negateLocal();
158158
}
159159
}
160160
} else {

0 commit comments

Comments
 (0)