Skip to content

Commit

Permalink
Add Quaternion/Matrix.isFinite() (#211)
Browse files Browse the repository at this point in the history
  • Loading branch information
httpdigest committed Feb 26, 2020
1 parent f4ceb64 commit 537c93d
Show file tree
Hide file tree
Showing 28 changed files with 198 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.joml</groupId>
<artifactId>joml</artifactId>
<version>1.9.22</version>
<version>1.9.23-SNAPSHOT</version>
<name>JOML</name>
<description>Java OpenGL Math Library</description>
<inceptionYear>2015</inceptionYear>
Expand Down
5 changes: 5 additions & 0 deletions src/org/joml/Matrix2d.java
Original file line number Diff line number Diff line change
Expand Up @@ -1669,4 +1669,9 @@ public Matrix2d lerp(Matrix2dc other, double t, Matrix2d dest) {
return dest;
}

public boolean isFinite() {
return Math.isFinite(m00) && Math.isFinite(m01) &&
Math.isFinite(m10) && Math.isFinite(m11);
}

}
10 changes: 10 additions & 0 deletions src/org/joml/Matrix2dc.java
Original file line number Diff line number Diff line change
Expand Up @@ -743,4 +743,14 @@ public interface Matrix2dc {
*/
boolean equals(Matrix2dc m, double delta);

/**
* Determine whether all matrix elements are finite floating-point values, that
* is, they are not {@link Double#isNaN() NaN} and not
* {@link Double#isInfinite() infinity}.
*
* @return {@code true} if all components are finite floating-point values;
* {@code false} otherwise
*/
boolean isFinite();

}
5 changes: 5 additions & 0 deletions src/org/joml/Matrix2f.java
Original file line number Diff line number Diff line change
Expand Up @@ -1558,4 +1558,9 @@ public Matrix2f lerp(Matrix2fc other, float t, Matrix2f dest) {
return dest;
}

public boolean isFinite() {
return Math.isFinite(m00) && Math.isFinite(m01) &&
Math.isFinite(m10) && Math.isFinite(m11);
}

}
10 changes: 10 additions & 0 deletions src/org/joml/Matrix2fc.java
Original file line number Diff line number Diff line change
Expand Up @@ -727,4 +727,14 @@ public interface Matrix2fc {
*/
boolean equals(Matrix2fc m, float delta);

/**
* Determine whether all matrix elements are finite floating-point values, that
* is, they are not {@link Float#isNaN() NaN} and not
* {@link Float#isInfinite() infinity}.
*
* @return {@code true} if all components are finite floating-point values;
* {@code false} otherwise
*/
boolean isFinite();

}
6 changes: 6 additions & 0 deletions src/org/joml/Matrix3d.java
Original file line number Diff line number Diff line change
Expand Up @@ -5090,4 +5090,10 @@ public Matrix3d reflection(Quaterniondc orientation) {
return reflection(normalX, normalY, normalZ);
}

public boolean isFinite() {
return Math.isFinite(m00) && Math.isFinite(m01) && Math.isFinite(m02) &&
Math.isFinite(m10) && Math.isFinite(m11) && Math.isFinite(m12) &&
Math.isFinite(m20) && Math.isFinite(m21) && Math.isFinite(m22);
}

}
10 changes: 10 additions & 0 deletions src/org/joml/Matrix3dc.java
Original file line number Diff line number Diff line change
Expand Up @@ -1581,4 +1581,14 @@ public interface Matrix3dc {
*/
Matrix3d reflect(Vector3dc normal, Matrix3d dest);

/**
* Determine whether all matrix elements are finite floating-point values, that
* is, they are not {@link Double#isNaN() NaN} and not
* {@link Double#isInfinite() infinity}.
*
* @return {@code true} if all components are finite floating-point values;
* {@code false} otherwise
*/
boolean isFinite();

}
6 changes: 6 additions & 0 deletions src/org/joml/Matrix3f.java
Original file line number Diff line number Diff line change
Expand Up @@ -4506,4 +4506,10 @@ public Matrix3f reflection(Quaternionfc orientation) {
return reflection(normalX, normalY, normalZ);
}

public boolean isFinite() {
return Math.isFinite(m00) && Math.isFinite(m01) && Math.isFinite(m02) &&
Math.isFinite(m10) && Math.isFinite(m11) && Math.isFinite(m12) &&
Math.isFinite(m20) && Math.isFinite(m21) && Math.isFinite(m22);
}

}
12 changes: 11 additions & 1 deletion src/org/joml/Matrix3fc.java
Original file line number Diff line number Diff line change
Expand Up @@ -1503,4 +1503,14 @@ public interface Matrix3fc {
*/
Matrix3f reflect(Vector3fc normal, Matrix3f dest);

}
/**
* Determine whether all matrix elements are finite floating-point values, that
* is, they are not {@link Float#isNaN() NaN} and not
* {@link Float#isInfinite() infinity}.
*
* @return {@code true} if all components are finite floating-point values;
* {@code false} otherwise
*/
boolean isFinite();

}
6 changes: 6 additions & 0 deletions src/org/joml/Matrix3x2d.java
Original file line number Diff line number Diff line change
Expand Up @@ -2547,4 +2547,10 @@ public boolean equals(Matrix3x2dc m, double delta) {
return true;
}

public boolean isFinite() {
return Math.isFinite(m00) && Math.isFinite(m01) &&
Math.isFinite(m10) && Math.isFinite(m11) &&
Math.isFinite(m20) && Math.isFinite(m21);
}

}
10 changes: 10 additions & 0 deletions src/org/joml/Matrix3x2dc.java
Original file line number Diff line number Diff line change
Expand Up @@ -1213,4 +1213,14 @@ public interface Matrix3x2dc {
*/
boolean equals(Matrix3x2dc m, double delta);

/**
* Determine whether all matrix elements are finite floating-point values, that
* is, they are not {@link Double#isNaN() NaN} and not
* {@link Double#isInfinite() infinity}.
*
* @return {@code true} if all components are finite floating-point values;
* {@code false} otherwise
*/
boolean isFinite();

}
6 changes: 6 additions & 0 deletions src/org/joml/Matrix3x2f.java
Original file line number Diff line number Diff line change
Expand Up @@ -2544,4 +2544,10 @@ public boolean equals(Matrix3x2fc m, float delta) {
return true;
}

public boolean isFinite() {
return Math.isFinite(m00) && Math.isFinite(m01) &&
Math.isFinite(m10) && Math.isFinite(m11) &&
Math.isFinite(m20) && Math.isFinite(m21);
}

}
10 changes: 10 additions & 0 deletions src/org/joml/Matrix3x2fc.java
Original file line number Diff line number Diff line change
Expand Up @@ -1197,4 +1197,14 @@ public interface Matrix3x2fc {
*/
boolean equals(Matrix3x2fc m, float delta);

/**
* Determine whether all matrix elements are finite floating-point values, that
* is, they are not {@link Float#isNaN() NaN} and not
* {@link Float#isInfinite() infinity}.
*
* @return {@code true} if all components are finite floating-point values;
* {@code false} otherwise
*/
boolean isFinite();

}
7 changes: 7 additions & 0 deletions src/org/joml/Matrix4d.java
Original file line number Diff line number Diff line change
Expand Up @@ -16392,4 +16392,11 @@ public Matrix4d withLookAtUp(double upX, double upY, double upZ, Matrix4d dest)
return dest;
}

public boolean isFinite() {
return Math.isFinite(m00) && Math.isFinite(m01) && Math.isFinite(m02) && Math.isFinite(m03) &&
Math.isFinite(m10) && Math.isFinite(m11) && Math.isFinite(m12) && Math.isFinite(m13) &&
Math.isFinite(m20) && Math.isFinite(m21) && Math.isFinite(m22) && Math.isFinite(m23) &&
Math.isFinite(m30) && Math.isFinite(m31) && Math.isFinite(m32) && Math.isFinite(m33);
}

}
10 changes: 10 additions & 0 deletions src/org/joml/Matrix4dc.java
Original file line number Diff line number Diff line change
Expand Up @@ -5458,4 +5458,14 @@ Matrix4d mul3x3(
*/
boolean equals(Matrix4dc m, double delta);

/**
* Determine whether all matrix elements are finite floating-point values, that
* is, they are not {@link Double#isNaN() NaN} and not
* {@link Double#isInfinite() infinity}.
*
* @return {@code true} if all components are finite floating-point values;
* {@code false} otherwise
*/
boolean isFinite();

}
7 changes: 7 additions & 0 deletions src/org/joml/Matrix4f.java
Original file line number Diff line number Diff line change
Expand Up @@ -15102,4 +15102,11 @@ public Matrix4f withLookAtUp(float upX, float upY, float upZ, Matrix4f dest) {
return dest;
}

public boolean isFinite() {
return Math.isFinite(m00) && Math.isFinite(m01) && Math.isFinite(m02) && Math.isFinite(m03) &&
Math.isFinite(m10) && Math.isFinite(m11) && Math.isFinite(m12) && Math.isFinite(m13) &&
Math.isFinite(m20) && Math.isFinite(m21) && Math.isFinite(m22) && Math.isFinite(m23) &&
Math.isFinite(m30) && Math.isFinite(m31) && Math.isFinite(m32) && Math.isFinite(m33);
}

}
10 changes: 10 additions & 0 deletions src/org/joml/Matrix4fc.java
Original file line number Diff line number Diff line change
Expand Up @@ -5293,4 +5293,14 @@ Matrix4f mul3x3(
*/
boolean equals(Matrix4fc m, float delta);

/**
* Determine whether all matrix elements are finite floating-point values, that
* is, they are not {@link Float#isNaN() NaN} and not
* {@link Float#isInfinite() infinity}.
*
* @return {@code true} if all components are finite floating-point values;
* {@code false} otherwise
*/
boolean isFinite();

}
7 changes: 7 additions & 0 deletions src/org/joml/Matrix4x3d.java
Original file line number Diff line number Diff line change
Expand Up @@ -10019,4 +10019,11 @@ public Matrix4x3d obliqueZ(double a, double b, Matrix4x3d dest) {
return dest;
}

public boolean isFinite() {
return Math.isFinite(m00) && Math.isFinite(m01) && Math.isFinite(m02) &&
Math.isFinite(m10) && Math.isFinite(m11) && Math.isFinite(m12) &&
Math.isFinite(m20) && Math.isFinite(m21) && Math.isFinite(m22) &&
Math.isFinite(m30) && Math.isFinite(m31) && Math.isFinite(m32);
}

}
10 changes: 10 additions & 0 deletions src/org/joml/Matrix4x3dc.java
Original file line number Diff line number Diff line change
Expand Up @@ -3034,4 +3034,14 @@ public interface Matrix4x3dc {
*/
boolean equals(Matrix4x3dc m, double delta);

/**
* Determine whether all matrix elements are finite floating-point values, that
* is, they are not {@link Double#isNaN() NaN} and not
* {@link Double#isInfinite() infinity}.
*
* @return {@code true} if all components are finite floating-point values;
* {@code false} otherwise
*/
boolean isFinite();

}
7 changes: 7 additions & 0 deletions src/org/joml/Matrix4x3f.java
Original file line number Diff line number Diff line change
Expand Up @@ -9217,4 +9217,11 @@ public Matrix4x3f withLookAtUp(float upX, float upY, float upZ, Matrix4x3f dest)
return dest;
}

public boolean isFinite() {
return Math.isFinite(m00) && Math.isFinite(m01) && Math.isFinite(m02) &&
Math.isFinite(m10) && Math.isFinite(m11) && Math.isFinite(m12) &&
Math.isFinite(m20) && Math.isFinite(m21) && Math.isFinite(m22) &&
Math.isFinite(m30) && Math.isFinite(m31) && Math.isFinite(m32);
}

}
10 changes: 10 additions & 0 deletions src/org/joml/Matrix4x3fc.java
Original file line number Diff line number Diff line change
Expand Up @@ -2782,4 +2782,14 @@ public interface Matrix4x3fc {
*/
boolean equals(Matrix4x3fc m, float delta);

/**
* Determine whether all matrix elements are finite floating-point values, that
* is, they are not {@link Float#isNaN() NaN} and not
* {@link Float#isInfinite() infinity}.
*
* @return {@code true} if all components are finite floating-point values;
* {@code false} otherwise
*/
boolean isFinite();

}
3 changes: 3 additions & 0 deletions src/org/joml/Quaterniond.java
Original file line number Diff line number Diff line change
Expand Up @@ -3082,4 +3082,7 @@ public Quaterniond conjugateBy(Quaterniondc q, Quaterniond dest) {
Math.fma(qpw, qiw, Math.fma(-qpx, qix, Math.fma(-qpy, qiy, -qpz * qiz))));
}

public boolean isFinite() {
return Math.isFinite(x) && Math.isFinite(y) && Math.isFinite(z) && Math.isFinite(w);
}
}
10 changes: 10 additions & 0 deletions src/org/joml/Quaterniondc.java
Original file line number Diff line number Diff line change
Expand Up @@ -1906,4 +1906,14 @@ public interface Quaterniondc {
*/
Quaterniond conjugateBy(Quaterniondc q, Quaterniond dest);

/**
* Determine whether all components are finite floating-point values, that
* is, they are not {@link Double#isNaN() NaN} and not
* {@link Double#isInfinite() infinity}.
*
* @return {@code true} if all components are finite floating-point values;
* {@code false} otherwise
*/
boolean isFinite();

}
4 changes: 4 additions & 0 deletions src/org/joml/Quaternionf.java
Original file line number Diff line number Diff line change
Expand Up @@ -3197,4 +3197,8 @@ public Quaternionf conjugateBy(Quaternionfc q, Quaternionf dest) {
Math.fma(qpw, qiz, Math.fma(qpx, qiy, Math.fma(-qpy, qix, qpz * qiw))),
Math.fma(qpw, qiw, Math.fma(-qpx, qix, Math.fma(-qpy, qiy, -qpz * qiz))));
}

public boolean isFinite() {
return Math.isFinite(x) && Math.isFinite(y) && Math.isFinite(z) && Math.isFinite(w);
}
}
12 changes: 11 additions & 1 deletion src/org/joml/Quaternionfc.java
Original file line number Diff line number Diff line change
Expand Up @@ -1920,4 +1920,14 @@ public interface Quaternionfc {
*/
Quaternionf conjugateBy(Quaternionfc q, Quaternionf dest);

}
/**
* Determine whether all components are finite floating-point values, that
* is, they are not {@link Float#isNaN() NaN} and not
* {@link Float#isInfinite() infinity}.
*
* @return {@code true} if all components are finite floating-point values;
* {@code false} otherwise
*/
boolean isFinite();

}
4 changes: 2 additions & 2 deletions src/org/joml/Vector2fc.java
Original file line number Diff line number Diff line change
Expand Up @@ -529,8 +529,8 @@ public interface Vector2fc {

/**
* Determine whether all components are finite floating-point values, that
* is, they are not {@link Double#isNaN() NaN} and not
* {@link Double#isInfinite() infinity}.
* is, they are not {@link Float#isNaN() NaN} and not
* {@link Float#isInfinite() infinity}.
*
* @return {@code true} if all components are finite floating-point values;
* {@code false} otherwise
Expand Down
4 changes: 2 additions & 2 deletions src/org/joml/Vector3fc.java
Original file line number Diff line number Diff line change
Expand Up @@ -1054,8 +1054,8 @@ public interface Vector3fc {

/**
* Determine whether all components are finite floating-point values, that
* is, they are not {@link Double#isNaN() NaN} and not
* {@link Double#isInfinite() infinity}.
* is, they are not {@link Float#isNaN() NaN} and not
* {@link Float#isInfinite() infinity}.
*
* @return {@code true} if all components are finite floating-point values;
* {@code false} otherwise
Expand Down
4 changes: 2 additions & 2 deletions src/org/joml/Vector4fc.java
Original file line number Diff line number Diff line change
Expand Up @@ -767,8 +767,8 @@ public interface Vector4fc {

/**
* Determine whether all components are finite floating-point values, that
* is, they are not {@link Double#isNaN() NaN} and not
* {@link Double#isInfinite() infinity}.
* is, they are not {@link Float#isNaN() NaN} and not
* {@link Float#isInfinite() infinity}.
*
* @return {@code true} if all components are finite floating-point values;
* {@code false} otherwise
Expand Down

0 comments on commit 537c93d

Please sign in to comment.