Whitespace & doc cleanup.
Tabs -> spaces, one space between sentences, capitalization fix, etc.
This commit is contained in:
+1
-1
@@ -9,7 +9,7 @@
|
|||||||
<ant antfile="bootstrap.xml"/>
|
<ant antfile="bootstrap.xml"/>
|
||||||
<import file="${user.home}/.m2/ooo-build/${ooo-build.vers}/ooo-build.xml"/>
|
<import file="${user.home}/.m2/ooo-build/${ooo-build.vers}/ooo-build.xml"/>
|
||||||
|
|
||||||
to the top level of your build.xml. Then you can depend on -init-ooo in your lowest level
|
to the top level of your build.xml. Then you can depend on -init-ooo in your lowest level
|
||||||
target to expose ooo-build's maven macros, javac macros, and antcontrib.
|
target to expose ooo-build's maven macros, javac macros, and antcontrib.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ public abstract class AbstractRoundRectangle extends RectangularShape implements
|
|||||||
PathIterator.SEG_CUBICTO, PathIterator.SEG_LINETO, PathIterator.SEG_CUBICTO
|
PathIterator.SEG_CUBICTO, PathIterator.SEG_LINETO, PathIterator.SEG_CUBICTO
|
||||||
};
|
};
|
||||||
|
|
||||||
/** The coefficient to calculate control points of Bezier curves. */
|
/** The coefficient to calculate control points of Bezier curves. */
|
||||||
protected static final double U = 0.5f - 2f / 3f * (Math.sqrt(2f) - 1f);
|
protected static final double U = 0.5f - 2f / 3f * (Math.sqrt(2f) - 1f);
|
||||||
|
|
||||||
/** The points coordinates calculation table. */
|
/** The points coordinates calculation table. */
|
||||||
|
|||||||
@@ -299,13 +299,13 @@ public class AffineTransform extends AbstractTransform
|
|||||||
@Override // from Transform
|
@Override // from Transform
|
||||||
public Point inverseTransform (IPoint p, Point into) {
|
public Point inverseTransform (IPoint p, Point into) {
|
||||||
double x = p.x() - tx, y = p.y() - ty;
|
double x = p.x() - tx, y = p.y() - ty;
|
||||||
double det = m00 * m11 - m01 * m10;
|
double det = m00 * m11 - m01 * m10;
|
||||||
if (Math.abs(det) == 0f) {
|
if (Math.abs(det) == 0f) {
|
||||||
// determinant is zero; matrix is not invertible
|
// determinant is zero; matrix is not invertible
|
||||||
throw new NoninvertibleTransformException(this.toString());
|
throw new NoninvertibleTransformException(this.toString());
|
||||||
}
|
}
|
||||||
double rdet = 1 / det;
|
double rdet = 1 / det;
|
||||||
return into.set((x * m11 - y * m10) * rdet,
|
return into.set((x * m11 - y * m10) * rdet,
|
||||||
(y * m00 - x * m01) * rdet);
|
(y * m00 - x * m01) * rdet);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -324,13 +324,13 @@ public class AffineTransform extends AbstractTransform
|
|||||||
@Override // from Transform
|
@Override // from Transform
|
||||||
public Vector inverseTransform (IVector v, Vector into) {
|
public Vector inverseTransform (IVector v, Vector into) {
|
||||||
double x = v.x(), y = v.y();
|
double x = v.x(), y = v.y();
|
||||||
double det = m00 * m11 - m01 * m10;
|
double det = m00 * m11 - m01 * m10;
|
||||||
if (Math.abs(det) == 0f) {
|
if (Math.abs(det) == 0f) {
|
||||||
// determinant is zero; matrix is not invertible
|
// determinant is zero; matrix is not invertible
|
||||||
throw new NoninvertibleTransformException(this.toString());
|
throw new NoninvertibleTransformException(this.toString());
|
||||||
}
|
}
|
||||||
double rdet = 1 / det;
|
double rdet = 1 / det;
|
||||||
return into.set((x * m11 - y * m10) * rdet,
|
return into.set((x * m11 - y * m10) * rdet,
|
||||||
(y * m00 - x * m01) * rdet);
|
(y * m00 - x * m01) * rdet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -250,7 +250,7 @@ public class Box implements IBox, Serializable
|
|||||||
// */
|
// */
|
||||||
// public Box transform (Transform3D transform, Box result) {
|
// public Box transform (Transform3D transform, Box result) {
|
||||||
// // the corners of the box cover the eight permutations of ([minX|maxX], [minY|maxY],
|
// // the corners of the box cover the eight permutations of ([minX|maxX], [minY|maxY],
|
||||||
// // [minZ|maxZ]). to find the new minimum and maximum for each element, we transform
|
// // [minZ|maxZ]). To find the new minimum and maximum for each element, we transform
|
||||||
// // selecting either the minimum or maximum for each component based on whether it will
|
// // selecting either the minimum or maximum for each component based on whether it will
|
||||||
// // increase or decrease the total (which depends on the sign of the matrix element).
|
// // increase or decrease the total (which depends on the sign of the matrix element).
|
||||||
// transform.update(Transform3D.AFFINE);
|
// transform.update(Transform3D.AFFINE);
|
||||||
@@ -426,7 +426,7 @@ public class Box implements IBox, Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method for {@link #intersects(Ray3)}. Determines whether the ray intersects the box
|
* Helper method for {@link #intersects(Ray3)}. Determines whether the ray intersects the box
|
||||||
* at the plane where x equals the value specified.
|
* at the plane where x equals the value specified.
|
||||||
*/
|
*/
|
||||||
protected boolean intersectsX (IRay3 ray, double x) {
|
protected boolean intersectsX (IRay3 ray, double x) {
|
||||||
@@ -441,7 +441,7 @@ public class Box implements IBox, Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method for {@link #intersects(Ray3)}. Determines whether the ray intersects the box
|
* Helper method for {@link #intersects(Ray3)}. Determines whether the ray intersects the box
|
||||||
* at the plane where y equals the value specified.
|
* at the plane where y equals the value specified.
|
||||||
*/
|
*/
|
||||||
protected boolean intersectsY (IRay3 ray, double y) {
|
protected boolean intersectsY (IRay3 ray, double y) {
|
||||||
@@ -456,7 +456,7 @@ public class Box implements IBox, Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method for {@link #intersects(Ray3)}. Determines whether the ray intersects the box
|
* Helper method for {@link #intersects(Ray3)}. Determines whether the ray intersects the box
|
||||||
* at the plane where z equals the value specified.
|
* at the plane where z equals the value specified.
|
||||||
*/
|
*/
|
||||||
protected boolean intersectsZ (IRay3 ray, double z) {
|
protected boolean intersectsZ (IRay3 ray, double z) {
|
||||||
@@ -471,7 +471,7 @@ public class Box implements IBox, Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method for {@link #intersection}. Finds the <code>t</code> value where the ray
|
* Helper method for {@link #intersection}. Finds the <code>t</code> value where the ray
|
||||||
* intersects the box at the plane where x equals the value specified, or returns
|
* intersects the box at the plane where x equals the value specified, or returns
|
||||||
* {@link Float#MAX_VALUE} if there is no such intersection.
|
* {@link Float#MAX_VALUE} if there is no such intersection.
|
||||||
*/
|
*/
|
||||||
@@ -487,7 +487,7 @@ public class Box implements IBox, Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method for {@link #intersection}. Finds the <code>t</code> value where the ray
|
* Helper method for {@link #intersection}. Finds the <code>t</code> value where the ray
|
||||||
* intersects the box at the plane where y equals the value specified, or returns
|
* intersects the box at the plane where y equals the value specified, or returns
|
||||||
* {@link Float#MAX_VALUE} if there is no such intersection.
|
* {@link Float#MAX_VALUE} if there is no such intersection.
|
||||||
*/
|
*/
|
||||||
@@ -503,7 +503,7 @@ public class Box implements IBox, Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method for {@link #intersection}. Finds the <code>t</code> value where the ray
|
* Helper method for {@link #intersection}. Finds the <code>t</code> value where the ray
|
||||||
* intersects the box at the plane where z equals the value specified, or returns
|
* intersects the box at the plane where z equals the value specified, or returns
|
||||||
* {@link Float#MAX_VALUE} if there is no such intersection.
|
* {@link Float#MAX_VALUE} if there is no such intersection.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ public class Frustum
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines the maximum signed distance of the point from the planes of the frustum. If
|
* Determines the maximum signed distance of the point from the planes of the frustum. If
|
||||||
* the distance is less than or equal to zero, the point lies inside the frustum.
|
* the distance is less than or equal to zero, the point lies inside the frustum.
|
||||||
*/
|
*/
|
||||||
public double distance (Vector3 point) {
|
public double distance (Vector3 point) {
|
||||||
@@ -240,7 +240,7 @@ public class Frustum
|
|||||||
/** The vertices of the frustum. */
|
/** The vertices of the frustum. */
|
||||||
protected Vector3[] _vertices = new Vector3[8];
|
protected Vector3[] _vertices = new Vector3[8];
|
||||||
|
|
||||||
/** The planes of the frustum (as derived from the vertices). The plane normals point out of
|
/** The planes of the frustum (as derived from the vertices). The plane normals point out of
|
||||||
* the frustum. */
|
* the frustum. */
|
||||||
protected Plane[] _planes = new Plane[6];
|
protected Plane[] _planes = new Plane[6];
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public interface ILine extends IShape, Cloneable
|
|||||||
Point p2 ();
|
Point p2 ();
|
||||||
|
|
||||||
/** Initializes the supplied point with this line's ending point.
|
/** Initializes the supplied point with this line's ending point.
|
||||||
* @return the supplied point. */
|
* @return the supplied point. */
|
||||||
Point p2 (Point target);
|
Point p2 (Point target);
|
||||||
|
|
||||||
/** Returns the square of the distance from the specified point to the line defined by this
|
/** Returns the square of the distance from the specified point to the line defined by this
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ public interface IMatrix4
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Linearly interpolates between this and the specified other matrix (treating the matrices as
|
* Linearly interpolates between this and the specified other matrix (treating the matrices as
|
||||||
* affine);, placing the result in the object provided.
|
* affine), placing the result in the object provided.
|
||||||
*
|
*
|
||||||
* @return a reference to the result object, for chaining.
|
* @return a reference to the result object, for chaining.
|
||||||
*/
|
*/
|
||||||
@@ -282,7 +282,7 @@ public interface IMatrix4
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an approximation of the uniform scale for this matrix (the cube root of the
|
* Returns an approximation of the uniform scale for this matrix (the cube root of the
|
||||||
* signed volume of the parallelepiped spanned by the axis vectors);.
|
* signed volume of the parallelepiped spanned by the axis vectors).
|
||||||
*/
|
*/
|
||||||
double approximateUniformScale ();
|
double approximateUniformScale ();
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public interface IQuaternion
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Computes the angles to pass to {@link #fromAngles} to reproduce this rotation, placing them
|
* Computes the angles to pass to {@link #fromAngles} to reproduce this rotation, placing them
|
||||||
* in the provided vector. This uses the factorization method described in David Eberly's
|
* in the provided vector. This uses the factorization method described in David Eberly's
|
||||||
* <a href="http://www.geometrictools.com/Documentation/EulerAngles.pdf">Euler Angle
|
* <a href="http://www.geometrictools.com/Documentation/EulerAngles.pdf">Euler Angle
|
||||||
* Formulas</a>.
|
* Formulas</a>.
|
||||||
*
|
*
|
||||||
@@ -99,7 +99,7 @@ public interface IQuaternion
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Interpolates between this and the specified other quaternion, placing the result in the
|
* Interpolates between this and the specified other quaternion, placing the result in the
|
||||||
* object provided. Based on the code in Nick Bobick's article,
|
* object provided. Based on the code in Nick Bobick's article,
|
||||||
* <a href="http://www.gamasutra.com/features/19980703/quaternions_01.htm">Rotating Objects
|
* <a href="http://www.gamasutra.com/features/19980703/quaternions_01.htm">Rotating Objects
|
||||||
* Using Quaternions</a>.
|
* Using Quaternions</a>.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ public class Matrix3 implements IMatrix3, Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets this to a rotation matrix. The formula comes from the OpenGL documentation for the
|
* Sets this to a rotation matrix. The formula comes from the OpenGL documentation for the
|
||||||
* glRotatef function.
|
* glRotatef function.
|
||||||
*
|
*
|
||||||
* @return a reference to this matrix, for chaining.
|
* @return a reference to this matrix, for chaining.
|
||||||
@@ -101,7 +101,7 @@ public class Matrix3 implements IMatrix3, Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets this to a rotation matrix. The formula comes from the
|
* Sets this to a rotation matrix. The formula comes from the
|
||||||
* <a href="http://www.j3d.org/matrix_faq/matrfaq_latest.html">Matrix and Quaternion FAQ</a>.
|
* <a href="http://www.j3d.org/matrix_faq/matrfaq_latest.html">Matrix and Quaternion FAQ</a>.
|
||||||
*
|
*
|
||||||
* @return a reference to this matrix, for chaining.
|
* @return a reference to this matrix, for chaining.
|
||||||
@@ -471,7 +471,7 @@ public class Matrix3 implements IMatrix3, Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inverts this matrix and places the result in the given object. This code is based on the
|
* 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
|
* examples in the <a href="http://www.j3d.org/matrix_faq/matrfaq_latest.html">Matrix and
|
||||||
* Quaternion FAQ</a>.
|
* Quaternion FAQ</a>.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ public final class Matrix4 implements IMatrix4, Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets this to a rotation matrix. The formula comes from the OpenGL documentation for the
|
* Sets this to a rotation matrix. The formula comes from the OpenGL documentation for the
|
||||||
* glRotatef function.
|
* glRotatef function.
|
||||||
*
|
*
|
||||||
* @return a reference to this matrix, for chaining.
|
* @return a reference to this matrix, for chaining.
|
||||||
@@ -205,7 +205,7 @@ public final class Matrix4 implements IMatrix4, Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets this to a rotation matrix. The formula comes from the
|
* Sets this to a rotation matrix. The formula comes from the
|
||||||
* <a href="http://www.j3d.org/matrix_faq/matrfaq_latest.html">Matrix and Quaternion FAQ</a>.
|
* <a href="http://www.j3d.org/matrix_faq/matrfaq_latest.html">Matrix and Quaternion FAQ</a>.
|
||||||
*
|
*
|
||||||
* @return a reference to this matrix, for chaining.
|
* @return a reference to this matrix, for chaining.
|
||||||
@@ -339,7 +339,7 @@ public final class Matrix4 implements IMatrix4, Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets this to a perspective projection matrix. The formula comes from the OpenGL
|
* Sets this to a perspective projection matrix. The formula comes from the OpenGL
|
||||||
* documentation for the gluPerspective function.
|
* documentation for the gluPerspective function.
|
||||||
*
|
*
|
||||||
* @return a reference to this matrix, for chaining.
|
* @return a reference to this matrix, for chaining.
|
||||||
@@ -353,7 +353,7 @@ public final class Matrix4 implements IMatrix4, Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets this to a perspective projection matrix. The formula comes from the OpenGL
|
* Sets this to a perspective projection matrix. The formula comes from the OpenGL
|
||||||
* documentation for the glFrustum function.
|
* documentation for the glFrustum function.
|
||||||
*
|
*
|
||||||
* @return a reference to this matrix, for chaining.
|
* @return a reference to this matrix, for chaining.
|
||||||
@@ -383,7 +383,7 @@ public final class Matrix4 implements IMatrix4, Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets this to an orthographic projection matrix. The formula comes from the OpenGL
|
* Sets this to an orthographic projection matrix. The formula comes from the OpenGL
|
||||||
* documentation for the glOrtho function.
|
* documentation for the glOrtho function.
|
||||||
*
|
*
|
||||||
* @return a reference to this matrix, for chaining.
|
* @return a reference to this matrix, for chaining.
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ public class NonUniformTransform extends AbstractTransform
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override // from Transform
|
@Override // from Transform
|
||||||
public void transform (IPoint[] src, int srcOff, Point[] dst, int dstOff, int count) {
|
public void transform (IPoint[] src, int srcOff, Point[] dst, int dstOff, int count) {
|
||||||
double sina = Math.sin(rotation), cosa = Math.cos(rotation);
|
double sina = Math.sin(rotation), cosa = Math.cos(rotation);
|
||||||
for (int ii = 0; ii < count; ii++) {
|
for (int ii = 0; ii < count; ii++) {
|
||||||
IPoint s = src[srcOff++];
|
IPoint s = src[srcOff++];
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import java.util.Random;
|
|||||||
import pythagoras.util.Platform;
|
import pythagoras.util.Platform;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A unit quaternion. Many of the formulas come from the
|
* A unit quaternion. Many of the formulas come from the
|
||||||
* <a href="http://www.j3d.org/matrix_faq/matrfaq_latest.html">Matrix and Quaternion FAQ</a>.
|
* <a href="http://www.j3d.org/matrix_faq/matrfaq_latest.html">Matrix and Quaternion FAQ</a>.
|
||||||
*/
|
*/
|
||||||
public class Quaternion implements IQuaternion, Serializable
|
public class Quaternion implements IQuaternion, Serializable
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class Rectangle extends AbstractRectangle implements Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a rectangle with upper-left corner at (0,) and the supplied dimensions.
|
* Constructs a rectangle with upper-left corner at (0,0) and the supplied dimensions.
|
||||||
*/
|
*/
|
||||||
public Rectangle (IDimension d) {
|
public Rectangle (IDimension d) {
|
||||||
setBounds(0, 0, d.width(), d.height());
|
setBounds(0, 0, d.width(), d.height());
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ public class UniformTransform extends AbstractTransform
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override // from Transform
|
@Override // from Transform
|
||||||
public void transform (IPoint[] src, int srcOff, Point[] dst, int dstOff, int count) {
|
public void transform (IPoint[] src, int srcOff, Point[] dst, int dstOff, int count) {
|
||||||
double sina = Math.sin(rotation), cosa = Math.cos(rotation);
|
double sina = Math.sin(rotation), cosa = Math.cos(rotation);
|
||||||
for (int ii = 0; ii < count; ii++) {
|
for (int ii = 0; ii < count; ii++) {
|
||||||
IPoint p = src[srcOff++];
|
IPoint p = src[srcOff++];
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ public abstract class AbstractRoundRectangle extends RectangularShape implements
|
|||||||
PathIterator.SEG_CUBICTO, PathIterator.SEG_LINETO, PathIterator.SEG_CUBICTO
|
PathIterator.SEG_CUBICTO, PathIterator.SEG_LINETO, PathIterator.SEG_CUBICTO
|
||||||
};
|
};
|
||||||
|
|
||||||
/** The coefficient to calculate control points of Bezier curves. */
|
/** The coefficient to calculate control points of Bezier curves. */
|
||||||
protected static final float U = 0.5f - 2f / 3f * (FloatMath.sqrt(2f) - 1f);
|
protected static final float U = 0.5f - 2f / 3f * (FloatMath.sqrt(2f) - 1f);
|
||||||
|
|
||||||
/** The points coordinates calculation table. */
|
/** The points coordinates calculation table. */
|
||||||
|
|||||||
@@ -299,13 +299,13 @@ public class AffineTransform extends AbstractTransform
|
|||||||
@Override // from Transform
|
@Override // from Transform
|
||||||
public Point inverseTransform (IPoint p, Point into) {
|
public Point inverseTransform (IPoint p, Point into) {
|
||||||
float x = p.x() - tx, y = p.y() - ty;
|
float x = p.x() - tx, y = p.y() - ty;
|
||||||
float det = m00 * m11 - m01 * m10;
|
float det = m00 * m11 - m01 * m10;
|
||||||
if (Math.abs(det) == 0f) {
|
if (Math.abs(det) == 0f) {
|
||||||
// determinant is zero; matrix is not invertible
|
// determinant is zero; matrix is not invertible
|
||||||
throw new NoninvertibleTransformException(this.toString());
|
throw new NoninvertibleTransformException(this.toString());
|
||||||
}
|
}
|
||||||
float rdet = 1 / det;
|
float rdet = 1 / det;
|
||||||
return into.set((x * m11 - y * m10) * rdet,
|
return into.set((x * m11 - y * m10) * rdet,
|
||||||
(y * m00 - x * m01) * rdet);
|
(y * m00 - x * m01) * rdet);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -324,13 +324,13 @@ public class AffineTransform extends AbstractTransform
|
|||||||
@Override // from Transform
|
@Override // from Transform
|
||||||
public Vector inverseTransform (IVector v, Vector into) {
|
public Vector inverseTransform (IVector v, Vector into) {
|
||||||
float x = v.x(), y = v.y();
|
float x = v.x(), y = v.y();
|
||||||
float det = m00 * m11 - m01 * m10;
|
float det = m00 * m11 - m01 * m10;
|
||||||
if (Math.abs(det) == 0f) {
|
if (Math.abs(det) == 0f) {
|
||||||
// determinant is zero; matrix is not invertible
|
// determinant is zero; matrix is not invertible
|
||||||
throw new NoninvertibleTransformException(this.toString());
|
throw new NoninvertibleTransformException(this.toString());
|
||||||
}
|
}
|
||||||
float rdet = 1 / det;
|
float rdet = 1 / det;
|
||||||
return into.set((x * m11 - y * m10) * rdet,
|
return into.set((x * m11 - y * m10) * rdet,
|
||||||
(y * m00 - x * m01) * rdet);
|
(y * m00 - x * m01) * rdet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -250,7 +250,7 @@ public class Box implements IBox, Serializable
|
|||||||
// */
|
// */
|
||||||
// public Box transform (Transform3D transform, Box result) {
|
// public Box transform (Transform3D transform, Box result) {
|
||||||
// // the corners of the box cover the eight permutations of ([minX|maxX], [minY|maxY],
|
// // the corners of the box cover the eight permutations of ([minX|maxX], [minY|maxY],
|
||||||
// // [minZ|maxZ]). to find the new minimum and maximum for each element, we transform
|
// // [minZ|maxZ]). To find the new minimum and maximum for each element, we transform
|
||||||
// // selecting either the minimum or maximum for each component based on whether it will
|
// // selecting either the minimum or maximum for each component based on whether it will
|
||||||
// // increase or decrease the total (which depends on the sign of the matrix element).
|
// // increase or decrease the total (which depends on the sign of the matrix element).
|
||||||
// transform.update(Transform3D.AFFINE);
|
// transform.update(Transform3D.AFFINE);
|
||||||
@@ -426,7 +426,7 @@ public class Box implements IBox, Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method for {@link #intersects(Ray3)}. Determines whether the ray intersects the box
|
* Helper method for {@link #intersects(Ray3)}. Determines whether the ray intersects the box
|
||||||
* at the plane where x equals the value specified.
|
* at the plane where x equals the value specified.
|
||||||
*/
|
*/
|
||||||
protected boolean intersectsX (IRay3 ray, float x) {
|
protected boolean intersectsX (IRay3 ray, float x) {
|
||||||
@@ -441,7 +441,7 @@ public class Box implements IBox, Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method for {@link #intersects(Ray3)}. Determines whether the ray intersects the box
|
* Helper method for {@link #intersects(Ray3)}. Determines whether the ray intersects the box
|
||||||
* at the plane where y equals the value specified.
|
* at the plane where y equals the value specified.
|
||||||
*/
|
*/
|
||||||
protected boolean intersectsY (IRay3 ray, float y) {
|
protected boolean intersectsY (IRay3 ray, float y) {
|
||||||
@@ -456,7 +456,7 @@ public class Box implements IBox, Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method for {@link #intersects(Ray3)}. Determines whether the ray intersects the box
|
* Helper method for {@link #intersects(Ray3)}. Determines whether the ray intersects the box
|
||||||
* at the plane where z equals the value specified.
|
* at the plane where z equals the value specified.
|
||||||
*/
|
*/
|
||||||
protected boolean intersectsZ (IRay3 ray, float z) {
|
protected boolean intersectsZ (IRay3 ray, float z) {
|
||||||
@@ -471,7 +471,7 @@ public class Box implements IBox, Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method for {@link #intersection}. Finds the <code>t</code> value where the ray
|
* Helper method for {@link #intersection}. Finds the <code>t</code> value where the ray
|
||||||
* intersects the box at the plane where x equals the value specified, or returns
|
* intersects the box at the plane where x equals the value specified, or returns
|
||||||
* {@link Float#MAX_VALUE} if there is no such intersection.
|
* {@link Float#MAX_VALUE} if there is no such intersection.
|
||||||
*/
|
*/
|
||||||
@@ -487,7 +487,7 @@ public class Box implements IBox, Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method for {@link #intersection}. Finds the <code>t</code> value where the ray
|
* Helper method for {@link #intersection}. Finds the <code>t</code> value where the ray
|
||||||
* intersects the box at the plane where y equals the value specified, or returns
|
* intersects the box at the plane where y equals the value specified, or returns
|
||||||
* {@link Float#MAX_VALUE} if there is no such intersection.
|
* {@link Float#MAX_VALUE} if there is no such intersection.
|
||||||
*/
|
*/
|
||||||
@@ -503,7 +503,7 @@ public class Box implements IBox, Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method for {@link #intersection}. Finds the <code>t</code> value where the ray
|
* Helper method for {@link #intersection}. Finds the <code>t</code> value where the ray
|
||||||
* intersects the box at the plane where z equals the value specified, or returns
|
* intersects the box at the plane where z equals the value specified, or returns
|
||||||
* {@link Float#MAX_VALUE} if there is no such intersection.
|
* {@link Float#MAX_VALUE} if there is no such intersection.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ public class Frustum
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines the maximum signed distance of the point from the planes of the frustum. If
|
* Determines the maximum signed distance of the point from the planes of the frustum. If
|
||||||
* the distance is less than or equal to zero, the point lies inside the frustum.
|
* the distance is less than or equal to zero, the point lies inside the frustum.
|
||||||
*/
|
*/
|
||||||
public float distance (Vector3 point) {
|
public float distance (Vector3 point) {
|
||||||
@@ -240,7 +240,7 @@ public class Frustum
|
|||||||
/** The vertices of the frustum. */
|
/** The vertices of the frustum. */
|
||||||
protected Vector3[] _vertices = new Vector3[8];
|
protected Vector3[] _vertices = new Vector3[8];
|
||||||
|
|
||||||
/** The planes of the frustum (as derived from the vertices). The plane normals point out of
|
/** The planes of the frustum (as derived from the vertices). The plane normals point out of
|
||||||
* the frustum. */
|
* the frustum. */
|
||||||
protected Plane[] _planes = new Plane[6];
|
protected Plane[] _planes = new Plane[6];
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public interface ILine extends IShape, Cloneable
|
|||||||
Point p2 ();
|
Point p2 ();
|
||||||
|
|
||||||
/** Initializes the supplied point with this line's ending point.
|
/** Initializes the supplied point with this line's ending point.
|
||||||
* @return the supplied point. */
|
* @return the supplied point. */
|
||||||
Point p2 (Point target);
|
Point p2 (Point target);
|
||||||
|
|
||||||
/** Returns the square of the distance from the specified point to the line defined by this
|
/** Returns the square of the distance from the specified point to the line defined by this
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ public interface IMatrix4
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Linearly interpolates between this and the specified other matrix (treating the matrices as
|
* Linearly interpolates between this and the specified other matrix (treating the matrices as
|
||||||
* affine);, placing the result in the object provided.
|
* affine), placing the result in the object provided.
|
||||||
*
|
*
|
||||||
* @return a reference to the result object, for chaining.
|
* @return a reference to the result object, for chaining.
|
||||||
*/
|
*/
|
||||||
@@ -282,7 +282,7 @@ public interface IMatrix4
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an approximation of the uniform scale for this matrix (the cube root of the
|
* Returns an approximation of the uniform scale for this matrix (the cube root of the
|
||||||
* signed volume of the parallelepiped spanned by the axis vectors);.
|
* signed volume of the parallelepiped spanned by the axis vectors).
|
||||||
*/
|
*/
|
||||||
float approximateUniformScale ();
|
float approximateUniformScale ();
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public interface IQuaternion
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Computes the angles to pass to {@link #fromAngles} to reproduce this rotation, placing them
|
* Computes the angles to pass to {@link #fromAngles} to reproduce this rotation, placing them
|
||||||
* in the provided vector. This uses the factorization method described in David Eberly's
|
* in the provided vector. This uses the factorization method described in David Eberly's
|
||||||
* <a href="http://www.geometrictools.com/Documentation/EulerAngles.pdf">Euler Angle
|
* <a href="http://www.geometrictools.com/Documentation/EulerAngles.pdf">Euler Angle
|
||||||
* Formulas</a>.
|
* Formulas</a>.
|
||||||
*
|
*
|
||||||
@@ -99,7 +99,7 @@ public interface IQuaternion
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Interpolates between this and the specified other quaternion, placing the result in the
|
* Interpolates between this and the specified other quaternion, placing the result in the
|
||||||
* object provided. Based on the code in Nick Bobick's article,
|
* object provided. Based on the code in Nick Bobick's article,
|
||||||
* <a href="http://www.gamasutra.com/features/19980703/quaternions_01.htm">Rotating Objects
|
* <a href="http://www.gamasutra.com/features/19980703/quaternions_01.htm">Rotating Objects
|
||||||
* Using Quaternions</a>.
|
* Using Quaternions</a>.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ public class Matrix3 implements IMatrix3, Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets this to a rotation matrix. The formula comes from the OpenGL documentation for the
|
* Sets this to a rotation matrix. The formula comes from the OpenGL documentation for the
|
||||||
* glRotatef function.
|
* glRotatef function.
|
||||||
*
|
*
|
||||||
* @return a reference to this matrix, for chaining.
|
* @return a reference to this matrix, for chaining.
|
||||||
@@ -101,7 +101,7 @@ public class Matrix3 implements IMatrix3, Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets this to a rotation matrix. The formula comes from the
|
* Sets this to a rotation matrix. The formula comes from the
|
||||||
* <a href="http://www.j3d.org/matrix_faq/matrfaq_latest.html">Matrix and Quaternion FAQ</a>.
|
* <a href="http://www.j3d.org/matrix_faq/matrfaq_latest.html">Matrix and Quaternion FAQ</a>.
|
||||||
*
|
*
|
||||||
* @return a reference to this matrix, for chaining.
|
* @return a reference to this matrix, for chaining.
|
||||||
@@ -471,7 +471,7 @@ public class Matrix3 implements IMatrix3, Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inverts this matrix and places the result in the given object. This code is based on the
|
* 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
|
* examples in the <a href="http://www.j3d.org/matrix_faq/matrfaq_latest.html">Matrix and
|
||||||
* Quaternion FAQ</a>.
|
* Quaternion FAQ</a>.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ public final class Matrix4 implements IMatrix4, Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets this to a rotation matrix. The formula comes from the OpenGL documentation for the
|
* Sets this to a rotation matrix. The formula comes from the OpenGL documentation for the
|
||||||
* glRotatef function.
|
* glRotatef function.
|
||||||
*
|
*
|
||||||
* @return a reference to this matrix, for chaining.
|
* @return a reference to this matrix, for chaining.
|
||||||
@@ -205,7 +205,7 @@ public final class Matrix4 implements IMatrix4, Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets this to a rotation matrix. The formula comes from the
|
* Sets this to a rotation matrix. The formula comes from the
|
||||||
* <a href="http://www.j3d.org/matrix_faq/matrfaq_latest.html">Matrix and Quaternion FAQ</a>.
|
* <a href="http://www.j3d.org/matrix_faq/matrfaq_latest.html">Matrix and Quaternion FAQ</a>.
|
||||||
*
|
*
|
||||||
* @return a reference to this matrix, for chaining.
|
* @return a reference to this matrix, for chaining.
|
||||||
@@ -339,7 +339,7 @@ public final class Matrix4 implements IMatrix4, Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets this to a perspective projection matrix. The formula comes from the OpenGL
|
* Sets this to a perspective projection matrix. The formula comes from the OpenGL
|
||||||
* documentation for the gluPerspective function.
|
* documentation for the gluPerspective function.
|
||||||
*
|
*
|
||||||
* @return a reference to this matrix, for chaining.
|
* @return a reference to this matrix, for chaining.
|
||||||
@@ -353,7 +353,7 @@ public final class Matrix4 implements IMatrix4, Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets this to a perspective projection matrix. The formula comes from the OpenGL
|
* Sets this to a perspective projection matrix. The formula comes from the OpenGL
|
||||||
* documentation for the glFrustum function.
|
* documentation for the glFrustum function.
|
||||||
*
|
*
|
||||||
* @return a reference to this matrix, for chaining.
|
* @return a reference to this matrix, for chaining.
|
||||||
@@ -383,7 +383,7 @@ public final class Matrix4 implements IMatrix4, Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets this to an orthographic projection matrix. The formula comes from the OpenGL
|
* Sets this to an orthographic projection matrix. The formula comes from the OpenGL
|
||||||
* documentation for the glOrtho function.
|
* documentation for the glOrtho function.
|
||||||
*
|
*
|
||||||
* @return a reference to this matrix, for chaining.
|
* @return a reference to this matrix, for chaining.
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ public class NonUniformTransform extends AbstractTransform
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override // from Transform
|
@Override // from Transform
|
||||||
public void transform (IPoint[] src, int srcOff, Point[] dst, int dstOff, int count) {
|
public void transform (IPoint[] src, int srcOff, Point[] dst, int dstOff, int count) {
|
||||||
float sina = FloatMath.sin(rotation), cosa = FloatMath.cos(rotation);
|
float sina = FloatMath.sin(rotation), cosa = FloatMath.cos(rotation);
|
||||||
for (int ii = 0; ii < count; ii++) {
|
for (int ii = 0; ii < count; ii++) {
|
||||||
IPoint s = src[srcOff++];
|
IPoint s = src[srcOff++];
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import java.util.Random;
|
|||||||
import pythagoras.util.Platform;
|
import pythagoras.util.Platform;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A unit quaternion. Many of the formulas come from the
|
* A unit quaternion. Many of the formulas come from the
|
||||||
* <a href="http://www.j3d.org/matrix_faq/matrfaq_latest.html">Matrix and Quaternion FAQ</a>.
|
* <a href="http://www.j3d.org/matrix_faq/matrfaq_latest.html">Matrix and Quaternion FAQ</a>.
|
||||||
*/
|
*/
|
||||||
public class Quaternion implements IQuaternion, Serializable
|
public class Quaternion implements IQuaternion, Serializable
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class Rectangle extends AbstractRectangle implements Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a rectangle with upper-left corner at (0,) and the supplied dimensions.
|
* Constructs a rectangle with upper-left corner at (0,0) and the supplied dimensions.
|
||||||
*/
|
*/
|
||||||
public Rectangle (IDimension d) {
|
public Rectangle (IDimension d) {
|
||||||
setBounds(0, 0, d.width(), d.height());
|
setBounds(0, 0, d.width(), d.height());
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ public class UniformTransform extends AbstractTransform
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override // from Transform
|
@Override // from Transform
|
||||||
public void transform (IPoint[] src, int srcOff, Point[] dst, int dstOff, int count) {
|
public void transform (IPoint[] src, int srcOff, Point[] dst, int dstOff, int count) {
|
||||||
float sina = FloatMath.sin(rotation), cosa = FloatMath.cos(rotation);
|
float sina = FloatMath.sin(rotation), cosa = FloatMath.cos(rotation);
|
||||||
for (int ii = 0; ii < count; ii++) {
|
for (int ii = 0; ii < count; ii++) {
|
||||||
IPoint p = src[srcOff++];
|
IPoint p = src[srcOff++];
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class Rectangle extends AbstractRectangle implements Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a rectangle with upper-left corner at (0,) and the supplied dimensions.
|
* Constructs a rectangle with upper-left corner at (0,0) and the supplied dimensions.
|
||||||
*/
|
*/
|
||||||
public Rectangle (IDimension d) {
|
public Rectangle (IDimension d) {
|
||||||
setBounds(0, 0, d.width(), d.height());
|
setBounds(0, 0, d.width(), d.height());
|
||||||
|
|||||||
Reference in New Issue
Block a user