From 09c256e2f26938cc2015176e259164bd7421dbdd Mon Sep 17 00:00:00 2001 From: Sven Göthel Date: Fri, 26 Jan 2024 01:18:21 +0100 Subject: Math Vec*: Rename {scale->mul}(..) for non-scalar types (n-dim); Add div(..) --- src/jogl/classes/com/jogamp/math/Vec2f.java | 30 +++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'src/jogl/classes/com/jogamp/math/Vec2f.java') 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) { -- cgit v1.2.3