aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/math/Vec4f.java
diff options
context:
space:
mode:
authorSven Göthel <[email protected]>2024-01-26 01:18:21 +0100
committerSven Göthel <[email protected]>2024-01-26 01:18:21 +0100
commit09c256e2f26938cc2015176e259164bd7421dbdd (patch)
tree22e35811b481d4dd1e2688b4257fbb59af1b1831 /src/jogl/classes/com/jogamp/math/Vec4f.java
parent8fe39d3a524e5e580cf2667988965f1e27fed95b (diff)
Math Vec*: Rename {scale->mul}(..) for non-scalar types (n-dim); Add div(..)
Diffstat (limited to 'src/jogl/classes/com/jogamp/math/Vec4f.java')
-rw-r--r--src/jogl/classes/com/jogamp/math/Vec4f.java38
1 files changed, 28 insertions, 10 deletions
diff --git a/src/jogl/classes/com/jogamp/math/Vec4f.java b/src/jogl/classes/com/jogamp/math/Vec4f.java
index 45afea7f8..5b17d7a4c 100644
--- a/src/jogl/classes/com/jogamp/math/Vec4f.java
+++ b/src/jogl/classes/com/jogamp/math/Vec4f.java
@@ -172,16 +172,10 @@ public final class Vec4f {
}
/** this = this * s, returns this. */
- public Vec4f scale(final float s) {
- x *= s;
- y *= s;
- z *= s;
- w *= s;
- return this;
- }
+ public Vec4f mul(final Vec4f s) { return mul(s.x, s.y, s.z, s.w); }
/** this = this * { sx, sy, sz, sw }, returns this. */
- public Vec4f scale(final float sx, final float sy, final float sz, final float sw) {
+ public Vec4f mul(final float sx, final float sy, final float sz, final float sw) {
x *= sx;
y *= sy;
z *= sz;
@@ -189,8 +183,32 @@ public final class Vec4f {
return this;
}
- /** this = this * { s.x, s.y, s.z, s.w }, returns this. */
- public Vec4f scale(final Vec4f s) { return scale(s.x, s.y, s.z, s.w); }
+ /** this = a / b, returns this. */
+ public Vec4f div(final Vec4f a, final Vec4f b) {
+ x = a.x / b.x;
+ y = a.y / b.y;
+ z = a.z / b.z;
+ w = a.w / b.w;
+ return this;
+ }
+
+ /** this = this / a, returns this. */
+ public Vec4f div(final Vec4f a) {
+ x /= a.x;
+ y /= a.y;
+ z /= a.z;
+ w /= a.w;
+ return this;
+ }
+
+ /** this = this * s, returns this. */
+ public Vec4f scale(final float s) {
+ x *= s;
+ y *= s;
+ z *= s;
+ w *= s;
+ return this;
+ }
/** Returns this + arg; creates new vector */
public Vec4f plus(final Vec4f arg) {