aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/math/Vec2f.java13
-rw-r--r--src/jogl/classes/com/jogamp/opengl/math/Vec3f.java15
-rw-r--r--src/jogl/classes/com/jogamp/opengl/math/Vec4f.java17
3 files changed, 45 insertions, 0 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/math/Vec2f.java b/src/jogl/classes/com/jogamp/opengl/math/Vec2f.java
index 20628d949..47d1a78dc 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/Vec2f.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/Vec2f.java
@@ -121,6 +121,19 @@ public final class Vec2f {
public void setX(final float x) { this.x = x; }
public void setY(final float y) { this.y = y; }
+ /** this = max(this, m), returns this. */
+ public Vec2f max(final Vec2f m) {
+ this.x = Math.max(this.x, m.x);
+ this.y = Math.max(this.y, m.y);
+ return this;
+ }
+ /** this = min(this, m), returns this. */
+ public Vec2f min(final Vec2f m) {
+ this.x = Math.min(this.x, m.x);
+ this.y = Math.min(this.y, m.y);
+ return this;
+ }
+
/** Returns this * val; creates new vector */
public Vec2f mul(final float val) {
return new Vec2f(this).scale(val);
diff --git a/src/jogl/classes/com/jogamp/opengl/math/Vec3f.java b/src/jogl/classes/com/jogamp/opengl/math/Vec3f.java
index fbcd1e9a5..eb1144c07 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/Vec3f.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/Vec3f.java
@@ -149,6 +149,21 @@ public final class Vec3f {
public void setY(final float y) { this.y = y; }
public void setZ(final float z) { this.z = z; }
+ /** this = max(this, m), returns this. */
+ public Vec3f max(final Vec3f m) {
+ this.x = Math.max(this.x, m.x);
+ this.y = Math.max(this.y, m.y);
+ this.z = Math.max(this.z, m.z);
+ return this;
+ }
+ /** this = min(this, m), returns this. */
+ public Vec3f min(final Vec3f m) {
+ this.x = Math.min(this.x, m.x);
+ this.y = Math.min(this.y, m.y);
+ this.z = Math.min(this.z, m.z);
+ return this;
+ }
+
/** Returns this * val; creates new vector */
public Vec3f mul(final float val) {
return new Vec3f(this).scale(val);
diff --git a/src/jogl/classes/com/jogamp/opengl/math/Vec4f.java b/src/jogl/classes/com/jogamp/opengl/math/Vec4f.java
index 254566ae0..f86fe5dad 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/Vec4f.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/Vec4f.java
@@ -140,6 +140,23 @@ public final class Vec4f {
public void setZ(final float z) { this.z = z; }
public void setW(final float w) { this.w = w; }
+ /** this = max(this, m), returns this. */
+ public Vec4f max(final Vec4f m) {
+ this.x = Math.max(this.x, m.x);
+ this.y = Math.max(this.y, m.y);
+ this.z = Math.max(this.z, m.z);
+ this.w = Math.max(this.w, m.w);
+ return this;
+ }
+ /** this = min(this, m), returns this. */
+ public Vec4f min(final Vec4f m) {
+ this.x = Math.min(this.x, m.x);
+ this.y = Math.min(this.y, m.y);
+ this.z = Math.min(this.z, m.z);
+ this.w = Math.min(this.w, m.w);
+ return this;
+ }
+
/** Returns this * val; creates new vector */
public Vec4f mul(final float val) {
return new Vec4f(this).scale(val);