diff options
author | Sven Göthel <[email protected]> | 2024-01-26 01:18:21 +0100 |
---|---|---|
committer | Sven Göthel <[email protected]> | 2024-01-26 01:18:21 +0100 |
commit | 09c256e2f26938cc2015176e259164bd7421dbdd (patch) | |
tree | 22e35811b481d4dd1e2688b4257fbb59af1b1831 /src/jogl/classes/com/jogamp/math/Vec2f.java | |
parent | 8fe39d3a524e5e580cf2667988965f1e27fed95b (diff) |
Math Vec*: Rename {scale->mul}(..) for non-scalar types (n-dim); Add div(..)
Diffstat (limited to 'src/jogl/classes/com/jogamp/math/Vec2f.java')
-rw-r--r-- | src/jogl/classes/com/jogamp/math/Vec2f.java | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/src/jogl/classes/com/jogamp/math/Vec2f.java b/src/jogl/classes/com/jogamp/math/Vec2f.java index 27371401a..547f63a05 100644 --- a/src/jogl/classes/com/jogamp/math/Vec2f.java +++ b/src/jogl/classes/com/jogamp/math/Vec2f.java @@ -147,21 +147,35 @@ public final class Vec2f { } /** this = this * s, returns this. */ - public Vec2f scale(final float s) { - x *= s; - y *= s; - return this; - } + public Vec2f mul(final Vec2f s) { return mul(s.x, s.y); } /** this = this * { sx, sy }, returns this. */ - public Vec2f scale(final float sx, final float sy) { + public Vec2f mul(final float sx, final float sy) { x *= sx; y *= sy; return this; } - /** this = this * { s.x, s.y }, returns this. */ - public Vec2f scale(final Vec2f s) { return scale(s.x, s.y); } + /** this = a / b, returns this. */ + public Vec2f div(final Vec2f a, final Vec2f b) { + x = a.x / b.x; + y = a.y / b.y; + return this; + } + + /** this = this / a, returns this. */ + public Vec2f div(final Vec2f a) { + x /= a.x; + y /= a.y; + return this; + } + + /** this = this * s, returns this. */ + public Vec2f scale(final float s) { + x *= s; + y *= s; + return this; + } /** Returns this + arg; creates new vector */ public Vec2f plus(final Vec2f arg) { |