From 961804f0ba2a90f5beaa4e6d70504a4ffd80ead0 Mon Sep 17 00:00:00 2001
From: AfonsoDGBatista <113676683+AfonsoDGBatista@users.noreply.github.com>
Date: Thu, 17 Sep 2026 19:01:24 +0100
Subject: [PATCH 1/5] Implement abs and absLocal methods in Vector2f
Add methods to compute absolute values of Vector2f components.
---
.../src/main/java/com/jme3/math/Vector2f.java | 22 +++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/jme3-core/src/main/java/com/jme3/math/Vector2f.java b/jme3-core/src/main/java/com/jme3/math/Vector2f.java
index e32871d75b..429f64828a 100644
--- a/jme3-core/src/main/java/com/jme3/math/Vector2f.java
+++ b/jme3-core/src/main/java/com/jme3/math/Vector2f.java
@@ -629,6 +629,28 @@ public Vector2f normalizeLocal() {
return divideLocal(1);
}
+ /**
+ * Computes the absolute value of each component and returns the result as a
+ * new instance. The current instance is unaffected.
+ *
+ * @return a new Vector2f with non-negative components
+ */
+ public Vector2f abs() {
+ return new Vector2f(Math.abs(x), Math.abs(y));
+ }
+
+ /**
+ * Computes the absolute value of each component and returns the (modified)
+ * current instance.
+ *
+ * @return the (modified) current instance (for chaining)
+ */
+ public Vector2f absLocal() {
+ x = Math.abs(x);
+ y = Math.abs(y);
+ return this;
+ }
+
/**
* Returns the unsigned angle between the current instance and the argument,
* provided both vectors have length=1. If {@code otherVector} is null, Pi/2
From 5e13c22ad570554a59695f093d17aafc9f01244b Mon Sep 17 00:00:00 2001
From: AfonsoDGBatista <113676683+AfonsoDGBatista@users.noreply.github.com>
Date: Thu, 17 Sep 2026 19:05:17 +0100
Subject: [PATCH 2/5] Add abs and absLocal methods to Vector3f
Added methods to compute absolute values of vector components.
---
.../src/main/java/com/jme3/math/Vector3f.java | 23 +++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/jme3-core/src/main/java/com/jme3/math/Vector3f.java b/jme3-core/src/main/java/com/jme3/math/Vector3f.java
index fa5a8539cd..8a7786ee90 100644
--- a/jme3-core/src/main/java/com/jme3/math/Vector3f.java
+++ b/jme3-core/src/main/java/com/jme3/math/Vector3f.java
@@ -828,6 +828,29 @@ public Vector3f normalizeLocal() {
return this;
}
+ /**
+ * Computes the absolute value of each component and returns the result as a
+ * new instance. The current instance is unaffected.
+ *
+ * @return a new Vector3f with non-negative components
+ */
+ public Vector3f abs() {
+ return new Vector3f(Math.abs(x), Math.abs(y),Math.abs(z));
+ }
+
+ /**
+ * Computes the absolute value of each component and returns the (modified)
+ * current instance.
+ *
+ * @return the (modified) current instance (for chaining)
+ */
+ public Vector3f absLocal() {
+ x = Math.abs(x);
+ y = Math.abs(y);
+ z = Math.abs(z);
+ return this;
+ }
+
/**
* Compares this vector component-wise with the argument (keeping the most
* positive value for each component) and returns the (modified) current
From d631110c9f88935c6a791557051ca57b97992112 Mon Sep 17 00:00:00 2001
From: AfonsoDGBatista <113676683+AfonsoDGBatista@users.noreply.github.com>
Date: Thu, 17 Sep 2026 19:21:10 +0100
Subject: [PATCH 3/5] Implement abs and absLocal methods in Vector4f
Added methods to compute absolute values of vector components.
---
.../src/main/java/com/jme3/math/Vector4f.java | 24 +++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/jme3-core/src/main/java/com/jme3/math/Vector4f.java b/jme3-core/src/main/java/com/jme3/math/Vector4f.java
index cf18c4be50..66677fd958 100644
--- a/jme3-core/src/main/java/com/jme3/math/Vector4f.java
+++ b/jme3-core/src/main/java/com/jme3/math/Vector4f.java
@@ -782,6 +782,30 @@ public Vector4f normalizeLocal() {
return this;
}
+ /**
+ * Computes the absolute value of each component and returns the result as a
+ * new instance. The current instance is unaffected.
+ *
+ * @return a new Vector4f with non-negative components
+ */
+ public Vector4f abs() {
+ return new Vector4f(Math.abs(x), Math.abs(y),Math.abs(z),Math.abs(w));
+ }
+
+ /**
+ * Computes the absolute value of each component and returns the (modified)
+ * current instance.
+ *
+ * @return the (modified) current instance (for chaining)
+ */
+ public Vector4f absLocal() {
+ x = Math.abs(x);
+ y = Math.abs(y);
+ z = Math.abs(z);
+ w = Math.abs(w);
+ return this;
+ }
+
/**
* maxLocal computes the maximum value for each
* component in this and other vector. The result is stored
From 02752ca6fee6aa292c39fcd02ed4172cde9965e0 Mon Sep 17 00:00:00 2001
From: AfonsoDGBatista <113676683+AfonsoDGBatista@users.noreply.github.com>
Date: Sat, 19 Sep 2026 23:20:39 +0100
Subject: [PATCH 4/5] Update
jme3-core/src/main/java/com/jme3/math/Vector3f.java
Added missing space
Co-authored-by: Jaime Bot
---
jme3-core/src/main/java/com/jme3/math/Vector3f.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/jme3-core/src/main/java/com/jme3/math/Vector3f.java b/jme3-core/src/main/java/com/jme3/math/Vector3f.java
index 8a7786ee90..240a5f4653 100644
--- a/jme3-core/src/main/java/com/jme3/math/Vector3f.java
+++ b/jme3-core/src/main/java/com/jme3/math/Vector3f.java
@@ -835,7 +835,7 @@ public Vector3f normalizeLocal() {
* @return a new Vector3f with non-negative components
*/
public Vector3f abs() {
- return new Vector3f(Math.abs(x), Math.abs(y),Math.abs(z));
+ return new Vector3f(Math.abs(x), Math.abs(y), Math.abs(z));
}
/**
From 68f12f3e403646b4ff362819fa82f26ef77a4e7b Mon Sep 17 00:00:00 2001
From: AfonsoDGBatista <113676683+AfonsoDGBatista@users.noreply.github.com>
Date: Sat, 19 Sep 2026 23:20:52 +0100
Subject: [PATCH 5/5] Update
jme3-core/src/main/java/com/jme3/math/Vector4f.java
Added missing spaces
Co-authored-by: Jaime Bot
---
jme3-core/src/main/java/com/jme3/math/Vector4f.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/jme3-core/src/main/java/com/jme3/math/Vector4f.java b/jme3-core/src/main/java/com/jme3/math/Vector4f.java
index 66677fd958..d2173d02e5 100644
--- a/jme3-core/src/main/java/com/jme3/math/Vector4f.java
+++ b/jme3-core/src/main/java/com/jme3/math/Vector4f.java
@@ -789,7 +789,7 @@ public Vector4f normalizeLocal() {
* @return a new Vector4f with non-negative components
*/
public Vector4f abs() {
- return new Vector4f(Math.abs(x), Math.abs(y),Math.abs(z),Math.abs(w));
+ return new Vector4f(Math.abs(x), Math.abs(y), Math.abs(z), Math.abs(w));
}
/**