diff options
author | Sven Göthel <[email protected]> | 2024-02-01 13:46:27 +0100 |
---|---|---|
committer | Sven Göthel <[email protected]> | 2024-02-01 13:46:27 +0100 |
commit | ca846bc67e6a074a182e97f29b3c34b90a12cac3 (patch) | |
tree | eddc1615a3947634c17ed8af071f76f51ccf06be | |
parent | 9fe460aecf8509c8305416bb9d77aadf6165c677 (diff) |
Vec[234][ifd]: Add toArray(..) method
-rw-r--r-- | src/jogl/classes/com/jogamp/math/Vec2f.java | 7 | ||||
-rw-r--r-- | src/jogl/classes/com/jogamp/math/Vec2i.java | 7 | ||||
-rw-r--r-- | src/jogl/classes/com/jogamp/math/Vec3d.java | 8 | ||||
-rw-r--r-- | src/jogl/classes/com/jogamp/math/Vec3f.java | 8 | ||||
-rw-r--r-- | src/jogl/classes/com/jogamp/math/Vec4f.java | 9 |
5 files changed, 39 insertions, 0 deletions
diff --git a/src/jogl/classes/com/jogamp/math/Vec2f.java b/src/jogl/classes/com/jogamp/math/Vec2f.java index 94a2ffc62..03820775d 100644 --- a/src/jogl/classes/com/jogamp/math/Vec2f.java +++ b/src/jogl/classes/com/jogamp/math/Vec2f.java @@ -100,6 +100,13 @@ public final class Vec2f { return this; } + /** xy[0..1] = this.{x, y}, returns this. */ + public Vec2f toArray(final float[/*2*/] xy) { + xy[0] = this.x; + xy[1] = this.y; + return this; + } + /** Sets the ith component, 0 <= i < 2 */ public void set(final int i, final float val) { switch (i) { diff --git a/src/jogl/classes/com/jogamp/math/Vec2i.java b/src/jogl/classes/com/jogamp/math/Vec2i.java index 73906120d..49a089ec5 100644 --- a/src/jogl/classes/com/jogamp/math/Vec2i.java +++ b/src/jogl/classes/com/jogamp/math/Vec2i.java @@ -72,6 +72,13 @@ public final class Vec2i { return this; } + /** xy[0..1] = this.{x, y}, returns this. */ + public Vec2i toArray(final int[/*2*/] xy) { + xy[0] = this.x; + xy[1] = this.y; + return this; + } + /** xy = this, returns xy. */ public int[] get(final int[/*2*/] xy) { xy[0] = this.x; diff --git a/src/jogl/classes/com/jogamp/math/Vec3d.java b/src/jogl/classes/com/jogamp/math/Vec3d.java index 7fb4477e0..0b66fe852 100644 --- a/src/jogl/classes/com/jogamp/math/Vec3d.java +++ b/src/jogl/classes/com/jogamp/math/Vec3d.java @@ -108,6 +108,14 @@ public final class Vec3d { return this; } + /** xyz[0..2] = this.{x, y, z}, returns this. */ + public Vec3d toArray(final double[/*3*/] xyz) { + xyz[0] = this.x; + xyz[1] = this.y; + xyz[2] = this.z; + return this; + } + /** Sets the ith component, 0 <= i < 3 */ public void set(final int i, final double val) { switch (i) { diff --git a/src/jogl/classes/com/jogamp/math/Vec3f.java b/src/jogl/classes/com/jogamp/math/Vec3f.java index 2dc399ef1..3459c2ad1 100644 --- a/src/jogl/classes/com/jogamp/math/Vec3f.java +++ b/src/jogl/classes/com/jogamp/math/Vec3f.java @@ -115,6 +115,14 @@ public final class Vec3f { return this; } + /** xyz[0..2] = this.{x, y, z}, returns this. */ + public Vec3f toArray(final float[/*3*/] xyz) { + xyz[0] = this.x; + xyz[1] = this.y; + xyz[2] = this.z; + return this; + } + /** Sets the ith component, 0 <= i < 3 */ public void set(final int i, final float val) { switch (i) { diff --git a/src/jogl/classes/com/jogamp/math/Vec4f.java b/src/jogl/classes/com/jogamp/math/Vec4f.java index 5b17d7a4c..c2d0ccd3d 100644 --- a/src/jogl/classes/com/jogamp/math/Vec4f.java +++ b/src/jogl/classes/com/jogamp/math/Vec4f.java @@ -99,6 +99,15 @@ public final class Vec4f { return this; } + /** xyzw[0..3] = this.{x, y, z, w}, returns this. */ + public Vec4f toArray(final float[/*4*/] xyzw) { + xyzw[0] = this.x; + xyzw[1] = this.y; + xyzw[2] = this.z; + xyzw[3] = this.w; + return this; + } + /** Sets the ith component, 0 <= i < 4 */ public void set(final int i, final float val) { switch (i) { |