Some lingering f to d conversions.
This commit is contained in:
@@ -34,7 +34,7 @@ public class MathUtil
|
||||
*/
|
||||
public static int ifloor (double v) {
|
||||
int iv = (int)v;
|
||||
return (v < 0f) ? ((iv == v || iv == Integer.MIN_VALUE) ? iv : (iv - 1)) : iv;
|
||||
return (v >= 0f || iv == v || iv == Integer.MIN_VALUE) ? iv : (iv - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -43,7 +43,7 @@ public class MathUtil
|
||||
*/
|
||||
public static int iceil (double v) {
|
||||
int iv = (int)v;
|
||||
return (v > 0f) ? ((iv == v || iv == Integer.MAX_VALUE) ? iv : (iv + 1)) : iv;
|
||||
return (v <= 0f || iv == v || iv == Integer.MAX_VALUE) ? iv : (iv + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -471,11 +471,8 @@ public class Matrix3 implements IMatrix3, Serializable
|
||||
}
|
||||
|
||||
/**
|
||||
* Inverts this matrix and places the result in the given object. This code is based on the
|
||||
* examples in the <a href="http://www.j3d.org/matrix_faq/matrfaq_latest.html">Matrix and
|
||||
* Quaternion FAQ</a>.
|
||||
*
|
||||
* @return a reference to the result matrix, for chaining.
|
||||
* @{@inheritDoc} This code is based on the examples in the
|
||||
* <a href="http://www.j3d.org/matrix_faq/matrfaq_latest.html">Matrix and Quaternion FAQ</a>.
|
||||
*/
|
||||
@Override // from IMatrix3
|
||||
public Matrix3 invert (Matrix3 result) throws SingularMatrixException {
|
||||
@@ -641,6 +638,11 @@ public class Matrix3 implements IMatrix3, Serializable
|
||||
return result.set(m00*vx + m10*vy, m01*vx + m11*vy);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc} This uses the iterative polar decomposition algorithm described by
|
||||
* <a href="http://www.cs.wisc.edu/graphics/Courses/838-s2002/Papers/polar-decomp.pdf">Ken
|
||||
* Shoemake</a>.
|
||||
*/
|
||||
@Override // from IMatrix3
|
||||
public double extractRotation () {
|
||||
// start with the contents of the upper 2x2 portion of the matrix
|
||||
|
||||
@@ -705,6 +705,10 @@ public final class Matrix4 implements IMatrix4, Serializable
|
||||
return invert(new Matrix4());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc} This code is based on the examples in the
|
||||
* <a href="http://www.j3d.org/matrix_faq/matrfaq_latest.html">Matrix and Quaternion FAQ</a>.
|
||||
*/
|
||||
@Override // from IMatrix4
|
||||
public Matrix4 invert (Matrix4 result) throws SingularMatrixException {
|
||||
double m00 = this.m00, m10 = this.m10, m20 = this.m20, m30 = this.m30;
|
||||
@@ -917,6 +921,11 @@ public final class Matrix4 implements IMatrix4, Serializable
|
||||
return extractRotation(new Quaternion());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc} This uses the iterative polar decomposition algorithm described by
|
||||
* <a href="http://www.cs.wisc.edu/graphics/Courses/838-s2002/Papers/polar-decomp.pdf">Ken
|
||||
* Shoemake</a>.
|
||||
*/
|
||||
@Override // from IMatrix4
|
||||
public Quaternion extractRotation (Quaternion result) throws SingularMatrixException {
|
||||
// start with the contents of the upper 3x3 portion of the matrix
|
||||
|
||||
@@ -31,8 +31,7 @@ public class Transforms
|
||||
* into} may refer to the same instance as {@code a} or {@code b}.
|
||||
* @return {@code into} for chaining.
|
||||
*/
|
||||
public static AffineTransform multiply (
|
||||
AffineTransform a, AffineTransform b, AffineTransform into) {
|
||||
public static <T extends Transform> T multiply (AffineTransform a, AffineTransform b, T into) {
|
||||
return multiply(a.m00, a.m01, a.m10, a.m11, a.tx, a.ty,
|
||||
b.m00, b.m01, b.m10, b.m11, b.tx, b.ty, into);
|
||||
}
|
||||
@@ -42,11 +41,9 @@ public class Transforms
|
||||
* into} may refer to the same instance as {@code a}.
|
||||
* @return {@code into} for chaining.
|
||||
*/
|
||||
public static AffineTransform multiply (
|
||||
AffineTransform a, double m00, double m01, double m10, double m11, double tx, double ty,
|
||||
AffineTransform into) {
|
||||
return multiply(a.m00, a.m01, a.m10, a.m11, a.tx, a.ty,
|
||||
m00, m01, m10, m11, tx, ty, into);
|
||||
public static <T extends Transform> T multiply (
|
||||
AffineTransform a, double m00, double m01, double m10, double m11, double tx, double ty, T into) {
|
||||
return multiply(a.m00, a.m01, a.m10, a.m11, a.tx, a.ty, m00, m01, m10, m11, tx, ty, into);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,27 +51,24 @@ public class Transforms
|
||||
* into} may refer to the same instance as {@code b}.
|
||||
* @return {@code into} for chaining.
|
||||
*/
|
||||
public static AffineTransform multiply (
|
||||
double m00, double m01, double m10, double m11, double tx, double ty,
|
||||
AffineTransform b, AffineTransform into) {
|
||||
return multiply(m00, m01, m10, m11, tx, ty,
|
||||
b.m00, b.m01, b.m10, b.m11, b.tx, b.ty, into);
|
||||
public static <T extends Transform> T multiply (
|
||||
double m00, double m01, double m10, double m11, double tx, double ty, AffineTransform b, T into) {
|
||||
return multiply(m00, m01, m10, m11, tx, ty, b.m00, b.m01, b.m10, b.m11, b.tx, b.ty, into);
|
||||
}
|
||||
|
||||
/**
|
||||
* Multiplies the supplied two affine transforms, storing the result in {@code into}.
|
||||
* @return {@code into} for chaining.
|
||||
*/
|
||||
public static AffineTransform multiply (
|
||||
public static <T extends Transform> T multiply (
|
||||
double am00, double am01, double am10, double am11, double atx, double aty,
|
||||
double bm00, double bm01, double bm10, double bm11, double btx, double bty,
|
||||
AffineTransform into) {
|
||||
into.m00 = am00 * bm00 + am10 * bm01;
|
||||
into.m01 = am01 * bm00 + am11 * bm01;
|
||||
into.m10 = am00 * bm10 + am10 * bm11;
|
||||
into.m11 = am01 * bm10 + am11 * bm11;
|
||||
into.tx = am00 * btx + am10 * bty + atx;
|
||||
into.ty = am01 * btx + am11 * bty + aty;
|
||||
double bm00, double bm01, double bm10, double bm11, double btx, double bty, T into) {
|
||||
into.setTransform(am00 * bm00 + am10 * bm01,
|
||||
am01 * bm00 + am11 * bm01,
|
||||
am00 * bm10 + am10 * bm11,
|
||||
am01 * bm10 + am11 * bm11,
|
||||
am00 * btx + am10 * bty + atx,
|
||||
am01 * btx + am11 * bty + aty);
|
||||
return into;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,6 +79,12 @@ public class Vector extends AbstractVector
|
||||
return add(x, y, this);
|
||||
}
|
||||
|
||||
/** Subtracts a vector in-place from this one.
|
||||
* @return a reference to this vector, for chaining. */
|
||||
public Vector subtractLocal (double x, double y) {
|
||||
return subtract(x, y, this);
|
||||
}
|
||||
|
||||
/** Adds a scaled vector in-place to this one.
|
||||
* @return a reference to this vector, for chaining. */
|
||||
public Vector addScaledLocal (IVector other, double v) {
|
||||
|
||||
Reference in New Issue
Block a user