aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/jogl/classes/com/jogamp/opengl/math/Quaternion.java12
-rw-r--r--src/jogl/classes/com/jogamp/opengl/math/VectorUtil.java132
-rw-r--r--src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java2
-rw-r--r--src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2DExpAddOn.java4
-rw-r--r--src/jogl/classes/jogamp/graph/curve/tess/Loop.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/math/TestQuaternion01NOUI.java100
6 files changed, 128 insertions, 128 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/math/Quaternion.java b/src/jogl/classes/com/jogamp/opengl/math/Quaternion.java
index 93f13a34c..319cbad50 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/Quaternion.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/Quaternion.java
@@ -649,16 +649,16 @@ public class Quaternion {
* @return this quaternion for chaining.
*/
public final Quaternion setFromVectors(final float[] v1, final float[] v2, final float[] tmpPivotVec, final float[] tmpNormalVec) {
- final float factor = VectorUtil.vec3Norm(v1) * VectorUtil.vec3Norm(v2);
+ final float factor = VectorUtil.normVec3(v1) * VectorUtil.normVec3(v2);
if ( FloatUtil.isZero(factor, FloatUtil.EPSILON ) ) {
return setIdentity();
} else {
- final float dot = VectorUtil.vec3Dot(v1, v2) / factor; // normalize
+ final float dot = VectorUtil.dotVec3(v1, v2) / factor; // normalize
final float theta = FloatUtil.acos(Math.max(-1.0f, Math.min(dot, 1.0f))); // clipping [-1..1]
VectorUtil.crossVec3(tmpPivotVec, v1, v2);
- if ( dot < 0.0f && FloatUtil.isZero( VectorUtil.vec3Norm(tmpPivotVec), FloatUtil.EPSILON ) ) {
+ if ( dot < 0.0f && FloatUtil.isZero( VectorUtil.normVec3(tmpPivotVec), FloatUtil.EPSILON ) ) {
// Vectors parallel and opposite direction, therefore a rotation of 180 degrees about any vector
// perpendicular to this vector will rotate vector a onto vector b.
//
@@ -704,16 +704,16 @@ public class Quaternion {
* @return this quaternion for chaining.
*/
public final Quaternion setFromNormalVectors(final float[] v1, final float[] v2, final float[] tmpPivotVec) {
- final float factor = VectorUtil.vec3Norm(v1) * VectorUtil.vec3Norm(v2);
+ final float factor = VectorUtil.normVec3(v1) * VectorUtil.normVec3(v2);
if ( FloatUtil.isZero(factor, FloatUtil.EPSILON ) ) {
return setIdentity();
} else {
- final float dot = VectorUtil.vec3Dot(v1, v2) / factor; // normalize
+ final float dot = VectorUtil.dotVec3(v1, v2) / factor; // normalize
final float theta = FloatUtil.acos(Math.max(-1.0f, Math.min(dot, 1.0f))); // clipping [-1..1]
VectorUtil.crossVec3(tmpPivotVec, v1, v2);
- if ( dot < 0.0f && FloatUtil.isZero( VectorUtil.vec3Norm(tmpPivotVec), FloatUtil.EPSILON ) ) {
+ if ( dot < 0.0f && FloatUtil.isZero( VectorUtil.normVec3(tmpPivotVec), FloatUtil.EPSILON ) ) {
// Vectors parallel and opposite direction, therefore a rotation of 180 degrees about any vector
// perpendicular to this vector will rotate vector a onto vector b.
//
diff --git a/src/jogl/classes/com/jogamp/opengl/math/VectorUtil.java b/src/jogl/classes/com/jogamp/opengl/math/VectorUtil.java
index 1d78ff30d..7e4f45795 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/VectorUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/VectorUtil.java
@@ -196,7 +196,7 @@ public class VectorUtil {
* distances, thus avoiding an expensive square root operation.
* </p>
*/
- public static float vec3DistanceSquare(final float[] v1, final float[] v2) {
+ public static float distSquareVec3(final float[] v1, final float[] v2) {
final float dx = v1[0] - v2[0];
final float dy = v1[1] - v2[1];
final float dz = v1[2] - v2[2];
@@ -206,64 +206,64 @@ public class VectorUtil {
/**
* Return the distance between the given two points described vector v1 and v2.
*/
- public static float vec3Distance(final float[] v1, final float[] v2) {
- return FloatUtil.sqrt(vec3DistanceSquare(v1, v2));
+ public static float distVec3(final float[] v1, final float[] v2) {
+ return FloatUtil.sqrt(distSquareVec3(v1, v2));
}
/**
- * Compute the dot product of two points
+ * Return the dot product of two points
* @param vec1 vector 1
* @param vec2 vector 2
* @return the dot product as float
*/
- public static float vec3Dot(final float[] vec1, final float[] vec2) {
+ public static float dotVec3(final float[] vec1, final float[] vec2) {
return vec1[0]*vec2[0] + vec1[1]*vec2[1] + vec1[2]*vec2[2];
}
/**
- * Compute the cos of the angle between to vectors
+ * Return the cosines of the angle between to vectors
* @param vec1 vector 1
* @param vec2 vector 2
*/
- public static float vec3CosAngle(final float[] vec1, final float[] vec2) {
- return vec3Dot(vec1, vec2) / ( vec3Norm(vec1) * vec3Norm(vec2) ) ;
+ public static float cosAngleVec3(final float[] vec1, final float[] vec2) {
+ return dotVec3(vec1, vec2) / ( normVec3(vec1) * normVec3(vec2) ) ;
}
/**
- * Compute the angle between to vectors in radians
+ * Return the angle between to vectors in radians
* @param vec1 vector 1
* @param vec2 vector 2
*/
- public static float vec3Angle(final float[] vec1, final float[] vec2) {
- return FloatUtil.acos(vec3CosAngle(vec1, vec2));
+ public static float angleVec3(final float[] vec1, final float[] vec2) {
+ return FloatUtil.acos(cosAngleVec3(vec1, vec2));
}
/**
- * Compute the squared length of a vector, a.k.a the squared <i>norm</i> or squared <i>magnitude</i>
+ * Return the squared length of a vector, a.k.a the squared <i>norm</i> or squared <i>magnitude</i>
*/
- public static float vec2NormSquare(final float[] vec) {
+ public static float normSquareVec2(final float[] vec) {
return vec[0]*vec[0] + vec[1]*vec[1];
}
/**
- * Compute the squared length of a vector, a.k.a the squared <i>norm</i> or squared <i>magnitude</i>
+ * Return the squared length of a vector, a.k.a the squared <i>norm</i> or squared <i>magnitude</i>
*/
- public static float vec3NormSquare(final float[] vec) {
+ public static float normSquareVec3(final float[] vec) {
return vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2];
}
/**
- * Compute the length of a vector, a.k.a the <i>norm</i> or <i>magnitude</i>
+ * Return the length of a vector, a.k.a the <i>norm</i> or <i>magnitude</i>
*/
- public static float vec2Norm(final float[] vec) {
- return FloatUtil.sqrt(vec2NormSquare(vec));
+ public static float normVec2(final float[] vec) {
+ return FloatUtil.sqrt(normSquareVec2(vec));
}
/**
- * Compute the length of a vector, a.k.a the <i>norm</i> or <i>magnitude</i>
+ * Return the length of a vector, a.k.a the <i>norm</i> or <i>magnitude</i>
*/
- public static float vec3Norm(final float[] vec) {
- return FloatUtil.sqrt(vec3NormSquare(vec));
+ public static float normVec3(final float[] vec) {
+ return FloatUtil.sqrt(normSquareVec3(vec));
}
/**
@@ -274,7 +274,7 @@ public class VectorUtil {
* @return result vector for chaining
*/
public static float[] normalizeVec2(final float[] result, final float[] vector) {
- final float lengthSq = vec2NormSquare(vector);
+ final float lengthSq = normSquareVec2(vector);
if ( FloatUtil.isZero(lengthSq, FloatUtil.EPSILON) ) {
result[0] = 0f;
result[1] = 0f;
@@ -292,7 +292,7 @@ public class VectorUtil {
* @return normalized output vector
*/
public static float[] normalizeVec2(final float[] vector) {
- final float lengthSq = vec2NormSquare(vector);
+ final float lengthSq = normSquareVec2(vector);
if ( FloatUtil.isZero(lengthSq, FloatUtil.EPSILON) ) {
vector[0] = 0f;
vector[1] = 0f;
@@ -312,7 +312,7 @@ public class VectorUtil {
* @return result vector for chaining
*/
public static float[] normalizeVec3(final float[] result, final float[] vector) {
- final float lengthSq = vec3NormSquare(vector);
+ final float lengthSq = normSquareVec3(vector);
if ( FloatUtil.isZero(lengthSq, FloatUtil.EPSILON) ) {
result[0] = 0f;
result[1] = 0f;
@@ -332,7 +332,7 @@ public class VectorUtil {
* @return normalized output vector
*/
public static float[] normalizeVec3(final float[] vector) {
- final float lengthSq = vec3NormSquare(vector);
+ final float lengthSq = normSquareVec3(vector);
if ( FloatUtil.isZero(lengthSq, FloatUtil.EPSILON) ) {
vector[0] = 0f;
vector[1] = 0f;
@@ -524,13 +524,13 @@ public class VectorUtil {
}
/**
- * Compute the determinant of 3 vectors
+ * Return the determinant of 3 vectors
* @param a vector 1
* @param b vector 2
* @param c vector 3
* @return the determinant value
*/
- public static float vec3Determinant(final float[] a, final float[] b, final float[] c) {
+ public static float determinantVec3(final float[] a, final float[] b, final float[] c) {
return a[0]*b[1]*c[2] + a[1]*b[2]*c[0] + a[2]*b[0]*c[1] - a[0]*b[2]*c[1] - a[1]*b[0]*c[2] - a[2]*b[1]*c[0];
}
@@ -541,8 +541,8 @@ public class VectorUtil {
* @param v3 vertex 3
* @return true if collinear, false otherwise
*/
- public static boolean isVec3Collinear(final float[] v1, final float[] v2, final float[] v3) {
- return FloatUtil.isZero( vec3Determinant(v1, v2, v3), FloatUtil.EPSILON );
+ public static boolean isCollinearVec3(final float[] v1, final float[] v2, final float[] v3) {
+ return FloatUtil.isZero( determinantVec3(v1, v2, v3), FloatUtil.EPSILON );
}
/**
@@ -554,15 +554,15 @@ public class VectorUtil {
* @return true if the vertex d is inside the circle defined by the
* vertices a, b, c. from paper by Guibas and Stolfi (1985).
*/
- public static boolean isInCircle(final Vert2fImmutable a, final Vert2fImmutable b, final Vert2fImmutable c, final Vert2fImmutable d) {
+ public static boolean isInCircleVec2(final Vert2fImmutable a, final Vert2fImmutable b, final Vert2fImmutable c, final Vert2fImmutable d) {
final float[] A = a.getCoord();
final float[] B = b.getCoord();
final float[] C = c.getCoord();
final float[] D = d.getCoord();
- return (A[0] * A[0] + A[1] * A[1]) * triArea(B, C, D) -
- (B[0] * B[0] + B[1] * B[1]) * triArea(A, C, D) +
- (C[0] * C[0] + C[1] * C[1]) * triArea(A, B, D) -
- (D[0] * D[0] + D[1] * D[1]) * triArea(A, B, C) > 0;
+ return (A[0] * A[0] + A[1] * A[1]) * triAreaVec2(B, C, D) -
+ (B[0] * B[0] + B[1] * B[1]) * triAreaVec2(A, C, D) +
+ (C[0] * C[0] + C[1] * C[1]) * triAreaVec2(A, B, D) -
+ (D[0] * D[0] + D[1] * D[1]) * triAreaVec2(A, B, C) > 0;
}
/**
@@ -573,7 +573,7 @@ public class VectorUtil {
* @return compute twice the area of the oriented triangle (a,b,c), the area
* is positive if the triangle is oriented counterclockwise.
*/
- public static float triArea(final Vert2fImmutable a, final Vert2fImmutable b, final Vert2fImmutable c){
+ public static float triAreaVec2(final Vert2fImmutable a, final Vert2fImmutable b, final Vert2fImmutable c){
final float[] A = a.getCoord();
final float[] B = b.getCoord();
final float[] C = c.getCoord();
@@ -588,7 +588,7 @@ public class VectorUtil {
* @return compute twice the area of the oriented triangle (a,b,c), the area
* is positive if the triangle is oriented counterclockwise.
*/
- public static float triArea(final float[] A, final float[] B, final float[] C){
+ public static float triAreaVec2(final float[] A, final float[] B, final float[] C){
return (B[0] - A[0]) * (C[1] - A[1]) - (B[1] - A[1])*(C[0] - A[0]);
}
@@ -601,7 +601,7 @@ public class VectorUtil {
* @param p the vertex in question
* @return true if p is in triangle (a, b, c), false otherwise.
*/
- public static boolean isVec3InTriangle(final float[] a, final float[] b, final float[] c,
+ public static boolean isInTriangleVec3(final float[] a, final float[] b, final float[] c,
final float[] p,
final float[] ac, final float[] ab, final float[] ap){
// Compute vectors
@@ -610,11 +610,11 @@ public class VectorUtil {
subVec3(ap, p, a); //v2
// Compute dot products
- final float dotAC_AC = vec3Dot(ac, ac);
- final float dotAC_AB = vec3Dot(ac, ab);
- final float dotAB_AB = vec3Dot(ab, ab);
- final float dotAC_AP = vec3Dot(ac, ap);
- final float dotAB_AP = vec3Dot(ab, ap);
+ final float dotAC_AC = dotVec3(ac, ac);
+ final float dotAC_AB = dotVec3(ac, ab);
+ final float dotAB_AB = dotVec3(ab, ab);
+ final float dotAC_AP = dotVec3(ac, ap);
+ final float dotAB_AP = dotVec3(ab, ap);
// Compute barycentric coordinates
final float invDenom = 1 / (dotAC_AC * dotAB_AB - dotAC_AB * dotAC_AB);
@@ -647,16 +647,16 @@ public class VectorUtil {
subVec3(tmpAB, b, a); //v1
// Compute dot products
- final float dotAC_AC = vec3Dot(tmpAC, tmpAC);
- final float dotAC_AB = vec3Dot(tmpAC, tmpAB);
- final float dotAB_AB = vec3Dot(tmpAB, tmpAB);
+ final float dotAC_AC = dotVec3(tmpAC, tmpAC);
+ final float dotAC_AB = dotVec3(tmpAC, tmpAB);
+ final float dotAB_AB = dotVec3(tmpAB, tmpAB);
// Compute barycentric coordinates
final float invDenom = 1 / (dotAC_AC * dotAB_AB - dotAC_AB * dotAC_AB);
{
subVec3(tmpAP, p1, a); //v2
- final float dotAC_AP1 = vec3Dot(tmpAC, tmpAP);
- final float dotAB_AP1 = vec3Dot(tmpAB, tmpAP);
+ final float dotAC_AP1 = dotVec3(tmpAC, tmpAP);
+ final float dotAB_AP1 = dotVec3(tmpAB, tmpAP);
final float u = (dotAB_AB * dotAC_AP1 - dotAC_AB * dotAB_AP1) * invDenom;
final float v = (dotAC_AC * dotAB_AP1 - dotAC_AB * dotAC_AP1) * invDenom;
@@ -668,8 +668,8 @@ public class VectorUtil {
{
subVec3(tmpAP, p1, a); //v2
- final float dotAC_AP2 = vec3Dot(tmpAC, tmpAP);
- final float dotAB_AP2 = vec3Dot(tmpAB, tmpAP);
+ final float dotAC_AP2 = dotVec3(tmpAC, tmpAP);
+ final float dotAB_AP2 = dotVec3(tmpAB, tmpAP);
final float u = (dotAB_AB * dotAC_AP2 - dotAC_AB * dotAB_AP2) * invDenom;
final float v = (dotAC_AC * dotAB_AP2 - dotAC_AB * dotAC_AP2) * invDenom;
@@ -681,8 +681,8 @@ public class VectorUtil {
{
subVec3(tmpAP, p2, a); //v2
- final float dotAC_AP3 = vec3Dot(tmpAC, tmpAP);
- final float dotAB_AP3 = vec3Dot(tmpAB, tmpAP);
+ final float dotAC_AP3 = dotVec3(tmpAC, tmpAP);
+ final float dotAB_AP3 = dotVec3(tmpAB, tmpAP);
final float u = (dotAB_AB * dotAC_AP3 - dotAC_AB * dotAB_AP3) * invDenom;
final float v = (dotAC_AC * dotAB_AP3 - dotAC_AB * dotAC_AP3) * invDenom;
@@ -716,16 +716,16 @@ public class VectorUtil {
subVec3(tmpAB, b, a); //v1
// Compute dot products
- final float dotAC_AC = vec3Dot(tmpAC, tmpAC);
- final float dotAC_AB = vec3Dot(tmpAC, tmpAB);
- final float dotAB_AB = vec3Dot(tmpAB, tmpAB);
+ final float dotAC_AC = dotVec3(tmpAC, tmpAC);
+ final float dotAC_AB = dotVec3(tmpAC, tmpAB);
+ final float dotAB_AB = dotVec3(tmpAB, tmpAB);
// Compute barycentric coordinates
final float invDenom = 1 / (dotAC_AC * dotAB_AB - dotAC_AB * dotAC_AB);
{
subVec3(tmpAP, p1, a); //v2
- final float dotAC_AP1 = vec3Dot(tmpAC, tmpAP);
- final float dotAB_AP1 = vec3Dot(tmpAB, tmpAP);
+ final float dotAC_AP1 = dotVec3(tmpAC, tmpAP);
+ final float dotAB_AP1 = dotVec3(tmpAB, tmpAP);
final float u = (dotAB_AB * dotAC_AP1 - dotAC_AB * dotAB_AP1) * invDenom;
final float v = (dotAC_AC * dotAB_AP1 - dotAC_AB * dotAC_AP1) * invDenom;
@@ -739,8 +739,8 @@ public class VectorUtil {
{
subVec3(tmpAP, p1, a); //v2
- final float dotAC_AP2 = vec3Dot(tmpAC, tmpAP);
- final float dotAB_AP2 = vec3Dot(tmpAB, tmpAP);
+ final float dotAC_AP2 = dotVec3(tmpAC, tmpAP);
+ final float dotAB_AP2 = dotVec3(tmpAB, tmpAP);
final float u = (dotAB_AB * dotAC_AP2 - dotAC_AB * dotAB_AP2) * invDenom;
final float v = (dotAC_AC * dotAB_AP2 - dotAC_AB * dotAC_AP2) * invDenom;
@@ -754,8 +754,8 @@ public class VectorUtil {
{
subVec3(tmpAP, p2, a); //v2
- final float dotAC_AP3 = vec3Dot(tmpAC, tmpAP);
- final float dotAB_AP3 = vec3Dot(tmpAB, tmpAP);
+ final float dotAC_AP3 = dotVec3(tmpAC, tmpAP);
+ final float dotAB_AP3 = dotVec3(tmpAB, tmpAP);
final float u = (dotAB_AB * dotAC_AP3 - dotAC_AB * dotAB_AP3) * invDenom;
final float v = (dotAC_AC * dotAB_AP3 - dotAC_AB * dotAC_AP3) * invDenom;
@@ -777,7 +777,7 @@ public class VectorUtil {
* @return true if the points a,b,c are in a ccw order
*/
public static boolean ccw(final Vert2fImmutable a, final Vert2fImmutable b, final Vert2fImmutable c){
- return triArea(a,b,c) > 0;
+ return triAreaVec2(a,b,c) > 0;
}
/** Compute the winding of given points
@@ -787,7 +787,7 @@ public class VectorUtil {
* @return Winding
*/
public static Winding getWinding(final Vert2fImmutable a, final Vert2fImmutable b, final Vert2fImmutable c) {
- return triArea(a,b,c) > 0 ? Winding.CCW : Winding.CW ;
+ return triAreaVec2(a,b,c) > 0 ? Winding.CCW : Winding.CW ;
}
/** Computes the area of a list of vertices to check if ccw
@@ -860,7 +860,7 @@ public class VectorUtil {
= - vec3Dot ( normal, a ) ;
*/
System.arraycopy(normalVec3, 0, resultV4, 0, 3);
- resultV4 [ 3 ] = -vec3Dot(normalVec3, pVec3) ;
+ resultV4 [ 3 ] = -dotVec3(normalVec3, pVec3) ;
return resultV4;
}
@@ -884,7 +884,7 @@ public class VectorUtil {
= - vec3Dot ( normal, a ) ;
*/
getNormalVec3( resultVec4, v1, v2, v3, temp1V3, temp2V3 ) ;
- resultVec4 [ 3 ] = -vec3Dot (resultVec4, v1) ;
+ resultVec4 [ 3 ] = -dotVec3 (resultVec4, v1) ;
return resultVec4;
}
@@ -901,12 +901,12 @@ public class VectorUtil {
* @return resulting intersecting if exists, otherwise null
*/
public static float[] line2PlaneIntersection(final float[] result, final Ray ray, float[/*4*/] plane, final float epsilon) {
- final float tmp = vec3Dot(ray.dir, plane) ;
+ final float tmp = dotVec3(ray.dir, plane) ;
if ( Math.abs(tmp) < epsilon ) {
return null; // ray is parallel to plane
}
- scaleVec3 ( result, ray.dir, -( vec3Dot(ray.orig, plane) + plane[3] ) / tmp ) ;
+ scaleVec3 ( result, ray.dir, -( dotVec3(ray.orig, plane) + plane[3] ) / tmp ) ;
return addVec3(result, result, ray.orig);
}
diff --git a/src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java b/src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java
index 6f1384c28..e4c1445ff 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java
@@ -568,7 +568,7 @@ public class AABBox {
* @return a float representing the size of the AABBox
*/
public final float getSize() {
- return VectorUtil.vec3Distance(low, high);
+ return VectorUtil.distVec3(low, high);
}
/**
diff --git a/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2DExpAddOn.java b/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2DExpAddOn.java
index 2ada436f8..a836e2023 100644
--- a/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2DExpAddOn.java
+++ b/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2DExpAddOn.java
@@ -266,8 +266,8 @@ public class CDTriangulator2DExpAddOn {
final float texZTag = 2f;
final float[] vOACoords = vOA.getCoord();
- final float dOC0A = VectorUtil.vec3Distance(vOACoords, vC0A.getCoord());
- final float dOC1A = VectorUtil.vec3Distance(vOACoords, vC1A.getCoord());
+ final float dOC0A = VectorUtil.distVec3(vOACoords, vC0A.getCoord());
+ final float dOC1A = VectorUtil.distVec3(vOACoords, vC1A.getCoord());
if( false ) {
final float[] vec3Z = { 0f, 0f, -1f };
final float[] vecLongSide, vecLineHeight;
diff --git a/src/jogl/classes/jogamp/graph/curve/tess/Loop.java b/src/jogl/classes/jogamp/graph/curve/tess/Loop.java
index f91c2e77f..1f038a930 100644
--- a/src/jogl/classes/jogamp/graph/curve/tess/Loop.java
+++ b/src/jogl/classes/jogamp/graph/curve/tess/Loop.java
@@ -198,12 +198,12 @@ public class Loop {
final GraphVertex nextV = initVertices.get(i+1);
for(int pos=0; pos<vertices.size(); pos++) {
final GraphVertex cand = vertices.get(pos);
- final float distance = VectorUtil.vec3Distance(v.getCoord(), cand.getCoord());
+ final float distance = VectorUtil.distVec3(v.getCoord(), cand.getCoord());
if(distance < minDistance){
for (GraphVertex vert:vertices){
if(vert == v || vert == nextV || vert == cand)
continue;
- inValid = VectorUtil.isInCircle(v.getPoint(), nextV.getPoint(),
+ inValid = VectorUtil.isInCircleVec2(v.getPoint(), nextV.getPoint(),
cand.getPoint(), vert.getPoint());
if(inValid){
break;
@@ -247,7 +247,7 @@ public class Loop {
e = e.getNext();
continue;
}
- inValid = VectorUtil.isInCircle(root.getGraphPoint().getPoint(), next.getGraphPoint().getPoint(),
+ inValid = VectorUtil.isInCircleVec2(root.getGraphPoint().getPoint(), next.getGraphPoint().getPoint(),
cand, e.getGraphPoint().getPoint());
if(inValid){
break;
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestQuaternion01NOUI.java b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestQuaternion01NOUI.java
index fb0604a44..97f316cfc 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestQuaternion01NOUI.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestQuaternion01NOUI.java
@@ -123,10 +123,10 @@ public class TestQuaternion01NOUI {
quat1.rotateVector(vecOut1, 0, ONE, 0);
quat2.rotateVector(vecOut2, 0, ONE, 0);
Assert.assertArrayEquals(vecOut1, vecOut2, FloatUtil.EPSILON);
- Assert.assertEquals(0f, Math.abs( VectorUtil.vec3Distance(vecOut1, vecOut2) ), FloatUtil.EPSILON );
+ Assert.assertEquals(0f, Math.abs( VectorUtil.distVec3(vecOut1, vecOut2) ), FloatUtil.EPSILON );
quat1.rotateVector(vecOut1, 0, UNIT_Z, 0);
- Assert.assertEquals(0f, Math.abs( VectorUtil.vec3Distance(NEG_UNIT_Y, vecOut1) ), FloatUtil.EPSILON );
+ Assert.assertEquals(0f, Math.abs( VectorUtil.distVec3(NEG_UNIT_Y, vecOut1) ), FloatUtil.EPSILON );
quat2.setFromAngleAxis(FloatUtil.HALF_PI, ZERO, tmpV3f);
Assert.assertEquals(QUAT_IDENT, quat2);
@@ -159,19 +159,19 @@ public class TestQuaternion01NOUI {
quat.setFromVectors(UNIT_Z, NEG_UNIT_Z, tmp0V3f, tmp1V3f);
quat.rotateVector(vecOut, 0, UNIT_Z, 0);
// System.err.println("vecOut: "+Arrays.toString(vecOut));
- Assert.assertEquals( 0f, Math.abs( VectorUtil.vec3Distance(NEG_UNIT_Z, vecOut) ), Quaternion.ALLOWED_DEVIANCE );
+ Assert.assertEquals( 0f, Math.abs( VectorUtil.distVec3(NEG_UNIT_Z, vecOut) ), Quaternion.ALLOWED_DEVIANCE );
quat.setFromVectors(UNIT_X, NEG_UNIT_X, tmp0V3f, tmp1V3f);
quat.rotateVector(vecOut, 0, UNIT_X, 0);
- Assert.assertEquals( 0f, Math.abs( VectorUtil.vec3Distance(NEG_UNIT_X, vecOut) ), Quaternion.ALLOWED_DEVIANCE );
+ Assert.assertEquals( 0f, Math.abs( VectorUtil.distVec3(NEG_UNIT_X, vecOut) ), Quaternion.ALLOWED_DEVIANCE );
quat.setFromVectors(UNIT_Y, NEG_UNIT_Y, tmp0V3f, tmp1V3f);
quat.rotateVector(vecOut, 0, UNIT_Y, 0);
- Assert.assertEquals( 0f, Math.abs( VectorUtil.vec3Distance(NEG_UNIT_Y, vecOut) ), Quaternion.ALLOWED_DEVIANCE );
+ Assert.assertEquals( 0f, Math.abs( VectorUtil.distVec3(NEG_UNIT_Y, vecOut) ), Quaternion.ALLOWED_DEVIANCE );
quat.setFromVectors(ONE, NEG_ONE, tmp0V3f, tmp1V3f);
quat.rotateVector(vecOut, 0, ONE, 0);
- Assert.assertEquals( 0f, Math.abs( VectorUtil.vec3Distance(NEG_ONE, vecOut) ), Quaternion.ALLOWED_DEVIANCE );
+ Assert.assertEquals( 0f, Math.abs( VectorUtil.distVec3(NEG_ONE, vecOut) ), Quaternion.ALLOWED_DEVIANCE );
quat.setFromVectors(ZERO, ZERO, tmp0V3f, tmp1V3f);
Assert.assertEquals(QUAT_IDENT, quat);
@@ -230,17 +230,17 @@ public class TestQuaternion01NOUI {
Assert.assertEquals(1.0f, quat.magnitude(), FloatUtil.EPSILON);
final float[] v2 = quat.rotateVector(new float[3], 0, UNIT_X, 0);
- Assert.assertEquals(0f, Math.abs(VectorUtil.vec3Distance(NEG_UNIT_Z, v2)), FloatUtil.EPSILON);
+ Assert.assertEquals(0f, Math.abs(VectorUtil.distVec3(NEG_UNIT_Z, v2)), FloatUtil.EPSILON);
quat.setFromEuler(0, 0, -FloatUtil.HALF_PI);
Assert.assertEquals(1.0f, quat.magnitude(), FloatUtil.EPSILON);
quat.rotateVector(v2, 0, UNIT_X, 0);
- Assert.assertEquals(0f, Math.abs(VectorUtil.vec3Distance(NEG_UNIT_Y, v2)), FloatUtil.EPSILON);
+ Assert.assertEquals(0f, Math.abs(VectorUtil.distVec3(NEG_UNIT_Y, v2)), FloatUtil.EPSILON);
quat.setFromEuler(FloatUtil.HALF_PI, 0, 0);
Assert.assertEquals(1.0f, quat.magnitude(), FloatUtil.EPSILON);
quat.rotateVector(v2, 0, UNIT_Y, 0);
- Assert.assertEquals(0f, Math.abs(VectorUtil.vec3Distance(UNIT_Z, v2)), FloatUtil.EPSILON);
+ Assert.assertEquals(0f, Math.abs(VectorUtil.distVec3(UNIT_Z, v2)), FloatUtil.EPSILON);
}
@Test
@@ -278,13 +278,13 @@ public class TestQuaternion01NOUI {
quat.rotateVector(vecHas, 0, UNIT_Y, 0);
// System.err.println("exp0 "+Arrays.toString(NEG_UNIT_X));
// System.err.println("has0 "+Arrays.toString(vecHas));
- Assert.assertEquals( 0f, Math.abs( VectorUtil.vec3Distance(UNIT_Z, vecHas) ), Quaternion.ALLOWED_DEVIANCE );
+ Assert.assertEquals( 0f, Math.abs( VectorUtil.distVec3(UNIT_Z, vecHas) ), Quaternion.ALLOWED_DEVIANCE );
}
quat.setFromMatrix(mat1, 0);
quat.rotateVector(vecHas, 0, UNIT_Y, 0);
// System.err.println("exp0 "+Arrays.toString(UNIT_Z));
// System.err.println("has0 "+Arrays.toString(vecHas));
- Assert.assertEquals( 0f, Math.abs( VectorUtil.vec3Distance(UNIT_Z, vecHas) ), Quaternion.ALLOWED_DEVIANCE );
+ Assert.assertEquals( 0f, Math.abs( VectorUtil.distVec3(UNIT_Z, vecHas) ), Quaternion.ALLOWED_DEVIANCE );
quat.toMatrix(mat2, 0);
// System.err.println(FloatUtil.matrixToString(null, null, "%10.5f", mat1, 0, mat2, 0, 4, 4, false).toString());
@@ -292,7 +292,7 @@ public class TestQuaternion01NOUI {
quat.rotateVector(vecHas, 0, NEG_ONE, 0);
FloatUtil.multMatrixVecf(mat2, NEG_ONE_v4, vecOut2);
- Assert.assertEquals( 0f, Math.abs( VectorUtil.vec3Distance(vecHas, vecOut2) ), Quaternion.ALLOWED_DEVIANCE );
+ Assert.assertEquals( 0f, Math.abs( VectorUtil.distVec3(vecHas, vecOut2) ), Quaternion.ALLOWED_DEVIANCE );
//
// 180 degrees rotation on X
@@ -312,13 +312,13 @@ public class TestQuaternion01NOUI {
quat.rotateVector(vecHas, 0, UNIT_Y, 0);
// System.err.println("exp0 "+Arrays.toString(NEG_UNIT_X));
// System.err.println("has0 "+Arrays.toString(vecHas));
- Assert.assertEquals( 0f, Math.abs( VectorUtil.vec3Distance(NEG_UNIT_Y, vecHas) ), Quaternion.ALLOWED_DEVIANCE );
+ Assert.assertEquals( 0f, Math.abs( VectorUtil.distVec3(NEG_UNIT_Y, vecHas) ), Quaternion.ALLOWED_DEVIANCE );
}
quat.setFromMatrix(mat1, 0);
quat.rotateVector(vecHas, 0, UNIT_Y, 0);
// System.err.println("exp0 "+Arrays.toString(NEG_UNIT_Y));
// System.err.println("has0 "+Arrays.toString(vecHas));
- Assert.assertEquals( 0f, Math.abs( VectorUtil.vec3Distance(NEG_UNIT_Y, vecHas) ), Quaternion.ALLOWED_DEVIANCE );
+ Assert.assertEquals( 0f, Math.abs( VectorUtil.distVec3(NEG_UNIT_Y, vecHas) ), Quaternion.ALLOWED_DEVIANCE );
quat.toMatrix(mat2, 0);
// System.err.println(FloatUtil.matrixToString(null, null, "%10.5f", mat1, 0, mat2, 0, 4, 4, false).toString());
@@ -326,7 +326,7 @@ public class TestQuaternion01NOUI {
quat.rotateVector(vecHas, 0, ONE, 0);
FloatUtil.multMatrixVecf(mat2, ONE_v4, vecOut2);
- Assert.assertEquals( 0f, Math.abs( VectorUtil.vec3Distance(vecHas, vecOut2) ), Quaternion.ALLOWED_DEVIANCE );
+ Assert.assertEquals( 0f, Math.abs( VectorUtil.distVec3(vecHas, vecOut2) ), Quaternion.ALLOWED_DEVIANCE );
//
// 180 degrees rotation on Y
@@ -346,13 +346,13 @@ public class TestQuaternion01NOUI {
quat.rotateVector(vecHas, 0, UNIT_X, 0);
// System.err.println("exp0 "+Arrays.toString(NEG_UNIT_X));
// System.err.println("has0 "+Arrays.toString(vecHas));
- Assert.assertEquals( 0f, Math.abs( VectorUtil.vec3Distance(NEG_UNIT_X, vecHas) ), Quaternion.ALLOWED_DEVIANCE );
+ Assert.assertEquals( 0f, Math.abs( VectorUtil.distVec3(NEG_UNIT_X, vecHas) ), Quaternion.ALLOWED_DEVIANCE );
}
quat.setFromMatrix(mat1, 0);
quat.rotateVector(vecHas, 0, UNIT_X, 0);
// System.err.println("exp0 "+Arrays.toString(NEG_UNIT_X));
// System.err.println("has0 "+Arrays.toString(vecHas));
- Assert.assertEquals( 0f, Math.abs( VectorUtil.vec3Distance(NEG_UNIT_X, vecHas) ), Quaternion.ALLOWED_DEVIANCE );
+ Assert.assertEquals( 0f, Math.abs( VectorUtil.distVec3(NEG_UNIT_X, vecHas) ), Quaternion.ALLOWED_DEVIANCE );
quat.toMatrix(mat2, 0);
// System.err.println(FloatUtil.matrixToString(null, "matr-rot", "%10.5f", mat1, 0, mat2, 0, 4, 4, false).toString());
@@ -360,7 +360,7 @@ public class TestQuaternion01NOUI {
quat.rotateVector(vecHas, 0, NEG_ONE, 0);
FloatUtil.multMatrixVecf(mat2, NEG_ONE_v4, vecOut2);
- Assert.assertEquals( 0f, Math.abs( VectorUtil.vec3Distance(vecHas, vecOut2) ), Quaternion.ALLOWED_DEVIANCE );
+ Assert.assertEquals( 0f, Math.abs( VectorUtil.distVec3(vecHas, vecOut2) ), Quaternion.ALLOWED_DEVIANCE );
//
// 180 degrees rotation on Z
@@ -380,13 +380,13 @@ public class TestQuaternion01NOUI {
quat.rotateVector(vecHas, 0, UNIT_X, 0);
// System.err.println("exp0 "+Arrays.toString(NEG_UNIT_X));
// System.err.println("has0 "+Arrays.toString(vecHas));
- Assert.assertEquals( 0f, Math.abs( VectorUtil.vec3Distance(NEG_UNIT_X, vecHas) ), Quaternion.ALLOWED_DEVIANCE );
+ Assert.assertEquals( 0f, Math.abs( VectorUtil.distVec3(NEG_UNIT_X, vecHas) ), Quaternion.ALLOWED_DEVIANCE );
}
quat.setFromMatrix(mat1, 0);
quat.rotateVector(vecHas, 0, UNIT_X, 0);
// System.err.println("exp0 "+Arrays.toString(NEG_UNIT_X));
// System.err.println("has0 "+Arrays.toString(vecHas));
- Assert.assertEquals( 0f, Math.abs( VectorUtil.vec3Distance(NEG_UNIT_X, vecHas) ), Quaternion.ALLOWED_DEVIANCE );
+ Assert.assertEquals( 0f, Math.abs( VectorUtil.distVec3(NEG_UNIT_X, vecHas) ), Quaternion.ALLOWED_DEVIANCE );
quat.toMatrix(mat2, 0);
// System.err.println(FloatUtil.matrixToString(null, "matr-rot", "%10.5f", mat1, 0, mat2, 0, 4, 4, false).toString());
@@ -394,7 +394,7 @@ public class TestQuaternion01NOUI {
quat.rotateVector(vecHas, 0, ONE, 0);
FloatUtil.multMatrixVecf(mat2, ONE_v4, vecOut2);
- Assert.assertEquals( 0f, Math.abs( VectorUtil.vec3Distance(vecHas, vecOut2) ), Quaternion.ALLOWED_DEVIANCE );
+ Assert.assertEquals( 0f, Math.abs( VectorUtil.distVec3(vecHas, vecOut2) ), Quaternion.ALLOWED_DEVIANCE );
//
// Test Matrix-Columns
@@ -413,19 +413,19 @@ public class TestQuaternion01NOUI {
quat.copyMatrixColumn(0, vecCol, 0);
// System.err.println("exp0 "+Arrays.toString(vecExp));
// System.err.println("has0 "+Arrays.toString(vecCol));
- Assert.assertEquals(0f, Math.abs( VectorUtil.vec3Distance(vecExp, vecCol)), FloatUtil.EPSILON);
+ Assert.assertEquals(0f, Math.abs( VectorUtil.distVec3(vecExp, vecCol)), FloatUtil.EPSILON);
FloatUtil.copyMatrixColumn(mat1, 0, 1, vecExp, 0);
quat.copyMatrixColumn(1, vecCol, 0);
// System.err.println("exp1 "+Arrays.toString(vecExp));
// System.err.println("has1 "+Arrays.toString(vecCol));
- Assert.assertEquals(0f, Math.abs( VectorUtil.vec3Distance(vecExp, vecCol)), FloatUtil.EPSILON);
+ Assert.assertEquals(0f, Math.abs( VectorUtil.distVec3(vecExp, vecCol)), FloatUtil.EPSILON);
FloatUtil.copyMatrixColumn(mat1, 0, 2, vecExp, 0);
quat.copyMatrixColumn(2, vecCol, 0);
// System.err.println("exp2 "+Arrays.toString(vecExp));
// System.err.println("has2 "+Arrays.toString(vecCol));
- Assert.assertEquals(0f, Math.abs( VectorUtil.vec3Distance(vecExp, vecCol)), FloatUtil.EPSILON);
+ Assert.assertEquals(0f, Math.abs( VectorUtil.distVec3(vecExp, vecCol)), FloatUtil.EPSILON);
quat.set(0f, 0f, 0f, 0f);
Assert.assertArrayEquals(UNIT_X, quat.copyMatrixColumn(0, vecCol, 0), FloatUtil.EPSILON);
@@ -563,18 +563,18 @@ public class TestQuaternion01NOUI {
final float[] vecOut = new float[3];
quat2.rotateVector(vecOut, 0, UNIT_Z, 0);
- Assert.assertTrue( Math.abs( VectorUtil.vec3Distance(UNIT_X, vecOut)) <= Quaternion.ALLOWED_DEVIANCE);
+ Assert.assertTrue( Math.abs( VectorUtil.distVec3(UNIT_X, vecOut)) <= Quaternion.ALLOWED_DEVIANCE);
quat2.setFromAngleNormalAxis(FloatUtil.HALF_PI, UNIT_Y); // 90 degr on Y
quat1.mult(quat1); // q1 = q1 * q1 -> 2 * 45 degr -> 90 degr on Y
quat1.mult(quat2); // q1 = q1 * q2 -> 2 * 90 degr -> 180 degr on Y
quat1.rotateVector(vecOut, 0, UNIT_Z, 0);
- Assert.assertTrue( Math.abs( VectorUtil.vec3Distance(NEG_UNIT_Z, vecOut)) <= Quaternion.ALLOWED_DEVIANCE);
+ Assert.assertTrue( Math.abs( VectorUtil.distVec3(NEG_UNIT_Z, vecOut)) <= Quaternion.ALLOWED_DEVIANCE);
quat2.setFromEuler(0f, FloatUtil.HALF_PI, 0f);
quat1.mult(quat2); // q1 = q1 * q2 = q1 * rotMat(0, 90degr, 0)
quat1.rotateVector(vecOut, 0, UNIT_Z, 0);
- Assert.assertTrue( Math.abs( VectorUtil.vec3Distance(NEG_UNIT_X, vecOut)) <= Quaternion.ALLOWED_DEVIANCE);
+ Assert.assertTrue( Math.abs( VectorUtil.distVec3(NEG_UNIT_X, vecOut)) <= Quaternion.ALLOWED_DEVIANCE);
}
@Test
@@ -645,7 +645,7 @@ public class TestQuaternion01NOUI {
// put together matrix, then apply to vector, so YZX
worker.rotateByAngleY(FloatUtil.QUARTER_PI).rotateByAngleZ(FloatUtil.PI).rotateByAngleX(FloatUtil.HALF_PI);
quat.rotateVector(vecExp, 0, vecExp, 0);
- Assert.assertEquals(0f, VectorUtil.vec3Distance(vecExp, vecRot), FloatUtil.EPSILON);
+ Assert.assertEquals(0f, VectorUtil.distVec3(vecExp, vecRot), FloatUtil.EPSILON);
// test axis rotation methods against general purpose
// X AXIS
@@ -655,7 +655,7 @@ public class TestQuaternion01NOUI {
worker.setIdentity().rotateByAngleNormalAxis(FloatUtil.QUARTER_PI, 1f, 0f, 0f).rotateVector(vecRot, 0, vecRot, 0);
// System.err.println("exp0 "+Arrays.toString(vecExp)+", len "+VectorUtil.length(vecExp));
// System.err.println("has0 "+Arrays.toString(vecRot)+", len "+VectorUtil.length(vecRot));
- Assert.assertEquals(0f, VectorUtil.vec3Distance(vecExp, vecRot), FloatUtil.EPSILON);
+ Assert.assertEquals(0f, VectorUtil.distVec3(vecExp, vecRot), FloatUtil.EPSILON);
// Y AXIS
vecExp = new float[] { 1f, 1f, 1f };
@@ -664,7 +664,7 @@ public class TestQuaternion01NOUI {
worker.setIdentity().rotateByAngleNormalAxis(FloatUtil.QUARTER_PI, 0f, 1f, 0f).rotateVector(vecRot, 0, vecRot, 0);
// System.err.println("exp0 "+Arrays.toString(vecExp));
// System.err.println("has0 "+Arrays.toString(vecRot));
- Assert.assertEquals(0f, VectorUtil.vec3Distance(vecExp, vecRot), FloatUtil.EPSILON);
+ Assert.assertEquals(0f, VectorUtil.distVec3(vecExp, vecRot), FloatUtil.EPSILON);
// Z AXIS
vecExp = new float[] { 1f, 1f, 1f };
@@ -673,7 +673,7 @@ public class TestQuaternion01NOUI {
worker.setIdentity().rotateByAngleNormalAxis(FloatUtil.QUARTER_PI, 0f, 0f, 1f).rotateVector(vecRot, 0, vecRot, 0);
// System.err.println("exp0 "+Arrays.toString(vecExp));
// System.err.println("has0 "+Arrays.toString(vecRot));
- Assert.assertEquals(0f, VectorUtil.vec3Distance(vecExp, vecRot), FloatUtil.EPSILON);
+ Assert.assertEquals(0f, VectorUtil.distVec3(vecExp, vecRot), FloatUtil.EPSILON);
quat.set(worker);
worker.rotateByAngleNormalAxis(0f, 0f, 0f, 0f);
@@ -716,7 +716,7 @@ public class TestQuaternion01NOUI {
quatS.rotateVector(vecHas, 0, UNIT_Z, 0);
// System.err.println("exp0 "+Arrays.toString(vecExp));
// System.err.println("has0 "+Arrays.toString(vecHas));
- Assert.assertEquals( 0f, Math.abs( VectorUtil.vec3Distance(vecExp, vecHas)), Quaternion.ALLOWED_DEVIANCE);
+ Assert.assertEquals( 0f, Math.abs( VectorUtil.distVec3(vecExp, vecHas)), Quaternion.ALLOWED_DEVIANCE);
// delta == 100%
quat2.setIdentity().rotateByAngleZ(FloatUtil.PI); // angle: 180 degrees, axis Z
@@ -725,7 +725,7 @@ public class TestQuaternion01NOUI {
quatS.rotateVector(vecHas, 0, UNIT_X, 0);
// System.err.println("exp0 "+Arrays.toString(NEG_UNIT_X));
// System.err.println("has0 "+Arrays.toString(vecHas));
- Assert.assertEquals( 0f, Math.abs( VectorUtil.vec3Distance(NEG_UNIT_X, vecHas)), Quaternion.ALLOWED_DEVIANCE);
+ Assert.assertEquals( 0f, Math.abs( VectorUtil.distVec3(NEG_UNIT_X, vecHas)), Quaternion.ALLOWED_DEVIANCE);
quat2.setIdentity().rotateByAngleZ(FloatUtil.PI); // angle: 180 degrees, axis Z
// System.err.println("Slerp #03: 1/2 * 180 degrees Z");
@@ -733,7 +733,7 @@ public class TestQuaternion01NOUI {
quatS.rotateVector(vecHas, 0, UNIT_X, 0);
// System.err.println("exp0 "+Arrays.toString(UNIT_Y));
// System.err.println("has0 "+Arrays.toString(vecHas));
- Assert.assertEquals( 0f, Math.abs( VectorUtil.vec3Distance(UNIT_Y, vecHas)), Quaternion.ALLOWED_DEVIANCE);
+ Assert.assertEquals( 0f, Math.abs( VectorUtil.distVec3(UNIT_Y, vecHas)), Quaternion.ALLOWED_DEVIANCE);
// delta == 0%
quat2.setIdentity().rotateByAngleZ(FloatUtil.PI); // angle: 180 degrees, axis Z
@@ -742,7 +742,7 @@ public class TestQuaternion01NOUI {
quatS.rotateVector(vecHas, 0, UNIT_X, 0);
// System.err.println("exp0 "+Arrays.toString(UNIT_X));
// System.err.println("has0 "+Arrays.toString(vecHas));
- Assert.assertEquals( 0f, Math.abs( VectorUtil.vec3Distance(UNIT_X, vecHas)), Quaternion.ALLOWED_DEVIANCE);
+ Assert.assertEquals( 0f, Math.abs( VectorUtil.distVec3(UNIT_X, vecHas)), Quaternion.ALLOWED_DEVIANCE);
// a==b
quat2.setIdentity();
@@ -751,7 +751,7 @@ public class TestQuaternion01NOUI {
quatS.rotateVector(vecHas, 0, UNIT_X, 0);
// System.err.println("exp0 "+Arrays.toString(UNIT_X));
// System.err.println("has0 "+Arrays.toString(vecHas));
- Assert.assertEquals( 0f, Math.abs( VectorUtil.vec3Distance(UNIT_X, vecHas)), Quaternion.ALLOWED_DEVIANCE);
+ Assert.assertEquals( 0f, Math.abs( VectorUtil.distVec3(UNIT_X, vecHas)), Quaternion.ALLOWED_DEVIANCE);
// negative dot product
vecExp = new float[] { 0f, -FloatUtil.sin(FloatUtil.QUARTER_PI), FloatUtil.sin(FloatUtil.QUARTER_PI) };
@@ -762,7 +762,7 @@ public class TestQuaternion01NOUI {
quatS.rotateVector(vecHas, 0, UNIT_Y, 0);
// System.err.println("exp0 "+Arrays.toString(vecExp));
// System.err.println("has0 "+Arrays.toString(vecHas));
- Assert.assertEquals( 0f, Math.abs( VectorUtil.vec3Distance(vecExp, vecHas)), Quaternion.ALLOWED_DEVIANCE);
+ Assert.assertEquals( 0f, Math.abs( VectorUtil.distVec3(vecExp, vecHas)), Quaternion.ALLOWED_DEVIANCE);
}
@@ -778,7 +778,7 @@ public class TestQuaternion01NOUI {
if( DEBUG ) System.err.println("LookAt #01");
VectorUtil.copyVec3(direction, 0, NEG_UNIT_X, 0);
final Quaternion quat = new Quaternion().setLookAt(direction, UNIT_Y, xAxis, yAxis, zAxis);
- Assert.assertEquals(0f, VectorUtil.vec3Distance(direction, quat.rotateVector(vecHas, 0, UNIT_Z, 0)), Quaternion.ALLOWED_DEVIANCE);
+ Assert.assertEquals(0f, VectorUtil.distVec3(direction, quat.rotateVector(vecHas, 0, UNIT_Z, 0)), Quaternion.ALLOWED_DEVIANCE);
if( DEBUG ) System.err.println("LookAt #02");
VectorUtil.normalizeVec3(VectorUtil.copyVec3(direction, 0, ONE, 0));
@@ -786,14 +786,14 @@ public class TestQuaternion01NOUI {
if( DEBUG )System.err.println("quat0 "+quat);
quat.rotateVector(vecHas, 0, UNIT_Z, 0);
if( DEBUG ) {
- System.err.println("xAxis "+Arrays.toString(xAxis)+", len "+VectorUtil.vec3Norm(xAxis));
- System.err.println("yAxis "+Arrays.toString(yAxis)+", len "+VectorUtil.vec3Norm(yAxis));
- System.err.println("zAxis "+Arrays.toString(zAxis)+", len "+VectorUtil.vec3Norm(zAxis));
- System.err.println("exp0 "+Arrays.toString(direction)+", len "+VectorUtil.vec3Norm(direction));
- System.err.println("has0 "+Arrays.toString(vecHas)+", len "+VectorUtil.vec3Norm(vecHas));
+ System.err.println("xAxis "+Arrays.toString(xAxis)+", len "+VectorUtil.normVec3(xAxis));
+ System.err.println("yAxis "+Arrays.toString(yAxis)+", len "+VectorUtil.normVec3(yAxis));
+ System.err.println("zAxis "+Arrays.toString(zAxis)+", len "+VectorUtil.normVec3(zAxis));
+ System.err.println("exp0 "+Arrays.toString(direction)+", len "+VectorUtil.normVec3(direction));
+ System.err.println("has0 "+Arrays.toString(vecHas)+", len "+VectorUtil.normVec3(vecHas));
}
// Assert.assertEquals(0f, VectorUtil.distance(direction, quat.rotateVector(vecHas, 0, UNIT_Z, 0)), Quaternion.ALLOWED_DEVIANCE);
- Assert.assertEquals(0f, VectorUtil.vec3Distance(direction, vecHas), Quaternion.ALLOWED_DEVIANCE);
+ Assert.assertEquals(0f, VectorUtil.distVec3(direction, vecHas), Quaternion.ALLOWED_DEVIANCE);
if( DEBUG )System.err.println("LookAt #03");
VectorUtil.normalizeVec3(VectorUtil.copyVec3(direction, 0, new float[] { -1f, 2f, -1f }, 0));
@@ -801,14 +801,14 @@ public class TestQuaternion01NOUI {
if( DEBUG )System.err.println("quat0 "+quat);
quat.rotateVector(vecHas, 0, UNIT_Z, 0);
if( DEBUG ) {
- System.err.println("xAxis "+Arrays.toString(xAxis)+", len "+VectorUtil.vec3Norm(xAxis));
- System.err.println("yAxis "+Arrays.toString(yAxis)+", len "+VectorUtil.vec3Norm(yAxis));
- System.err.println("zAxis "+Arrays.toString(zAxis)+", len "+VectorUtil.vec3Norm(zAxis));
- System.err.println("exp0 "+Arrays.toString(direction)+", len "+VectorUtil.vec3Norm(direction));
- System.err.println("has0 "+Arrays.toString(vecHas)+", len "+VectorUtil.vec3Norm(vecHas));
+ System.err.println("xAxis "+Arrays.toString(xAxis)+", len "+VectorUtil.normVec3(xAxis));
+ System.err.println("yAxis "+Arrays.toString(yAxis)+", len "+VectorUtil.normVec3(yAxis));
+ System.err.println("zAxis "+Arrays.toString(zAxis)+", len "+VectorUtil.normVec3(zAxis));
+ System.err.println("exp0 "+Arrays.toString(direction)+", len "+VectorUtil.normVec3(direction));
+ System.err.println("has0 "+Arrays.toString(vecHas)+", len "+VectorUtil.normVec3(vecHas));
}
// Assert.assertEquals(0f, VectorUtil.distance(direction, quat.rotateVector(vecHas, 0, UNIT_Z, 0)), Quaternion.ALLOWED_DEVIANCE);
- Assert.assertEquals(0f, VectorUtil.vec3Distance(direction, vecHas), Quaternion.ALLOWED_DEVIANCE);
+ Assert.assertEquals(0f, VectorUtil.distVec3(direction, vecHas), Quaternion.ALLOWED_DEVIANCE);
}
public static void main(String args[]) {