public class P3 extends Object
Pn
, some methods
are purely projective, while others relate to the various metric geometries contained
within projective geometry.
The bulk of the methods here fall into three categories:
Only methods which are specific to 3-dimensional space are included here. Actually most of
the methods of the first sort listed above could be generalized and moved to Pn
.
Any volunteers?
Scaling transformations are included here even though scaling is not an isometry in any
metric.
Rn
for method conventions and representation of matrices.
Pn
for other methods applicable in n-dimensional real projective space.
Modifier and Type | Field and Description |
---|---|
static double[] |
originP3 |
static double[] |
p3involution |
static double[] |
Q_ELLIPTIC |
static double[] |
Q_EUCLIDEAN |
static double[] |
Q_HYPERBOLIC |
static double[][] |
Q_LIST |
Modifier and Type | Method and Description |
---|---|
static double |
affineCoordinate(double[] p1,
double[] p2,
double[] pw) |
static boolean |
areCollinear(double[] p0,
double[] p1,
double[] p2,
double tol) |
static double[] |
barycentricCoordinates(double[] weights,
double[] p0,
double[] p1,
double[] p) |
static double[] |
composeMatrixFromFactors(double[] m,
double[] transV,
Quaternion rotQ,
Quaternion stretchRotQ,
double[] stretchV,
boolean isFlipped,
int metric) |
static double[] |
extractOrientationMatrix(double[] dst,
double[] src,
double[] point,
int metric)
Extract a matrix from the src input matrix, such that it fixes the input position point.
|
static double[] |
factorMatrix(double[] m,
double[] transV,
Quaternion rotQ,
Quaternion stretchRotQ,
double[] stretchV,
boolean[] isFlipped,
int metric)
see Graphics Gems IV, p.
|
static double[] |
getTransformedAbsolute(double[] m,
int metric) |
static boolean |
isometryIsUnstable(double[] matrix,
int metric) |
static boolean |
isValidTranslationVector(double[] vec,
int metric) |
static double[] |
lineIntersectPlane(double[] dst,
double[] p1,
double[] p2,
double[] plane)
Calculate the intersection point of the line determined by p1 and p2 with plane.
|
static double[] |
lineJoinPoint(double[] plane,
double[] p1,
double[] p2,
double[] point) |
static double[] |
makeDirectIsometryFromFrames(double[] dst,
double[] p0,
double[] p1,
double[] p2,
double[] q0,
double[] q1,
double[] q2,
int metric)
Generate a direct isometry that carries the frame determined by p0, p1 and p2 to that determined
by q0, q1 and q2.
|
static double[] |
makeGlideReflectionMatrix(double[] m,
double[] p1,
double[] p2,
double[] plane,
int metric)
Generate a glide reflection in plane with translation vector given by the vector from
p1 to p2.
|
static double[] |
makeLookatMatrix(double[] m,
double[] from,
double[] to,
double roll,
int metric)
Creates an isometry that carries the from vector to the origin; and takes the
normalized to vector to the (homogeneous) vector (0,0,-1,0).
|
static double[] |
makeOrthographicProjectionMatrix(double[] m,
Rectangle2D viewport,
double near,
double far) |
static double[] |
makePerspectiveProjectionMatrix(double[] dst,
Rectangle2D viewport,
double near,
double far)
Generate a 4x4 perspective projection matrix based on the parameters.
|
static float[] |
makePerspectiveProjectionMatrix(float[] dst,
Rectangle2D viewport,
float near,
float far) |
static double[] |
makeReflectionMatrix(double[] m,
double[] plane,
int metric)
Construct a projective reflection that fixes the element plane considered
as a pole/polar point/plane pair.
|
static double[] |
makeRotationMatrix(double[] m,
double[] axis,
double angle)
Generate a rotation matrix fixing the origin (0,0,0,1) around the given axis with the given angle.
|
static double[] |
makeRotationMatrix(double[] m,
double[] from,
double[] to)
Generate a rotation matrix which fixes the origin (0,0,0,1) and carries the vector from to the vector to.
|
static double[] |
makeRotationMatrix(double[] m,
double[] p1,
double[] p2,
double angle,
int metric)
Calculate a rotation matrix in the given metric which rotates a given angle about the axis
determined by p1 and p2.
|
static double[] |
makeRotationMatrixX(double[] mat,
double angle) |
static double[] |
makeRotationMatrixY(double[] mat,
double angle) |
static double[] |
makeRotationMatrixZ(double[] mat,
double angle) |
static double[] |
makeScaleMatrix(double[] dst,
double s)
For those who are uncomfortable with the word stretch -- even though
only euclidean geometry supports scaling (changing size without changing shape).
|
static double[] |
makeScaleMatrix(double[] dst,
double[] s) |
static double[] |
makeScaleMatrix(double[] dst,
double sx,
double sy,
double sz) |
static double[] |
makeScrewMotionMatrix(double[] dst,
double[] p1,
double[] p2,
double angle,
int metric) |
static double[] |
makeSkewMatrix(double[] dst,
int i,
int j,
double val) |
static double[] |
makeStretchMatrix(double[] dst,
double stretch)
Create a diagonal matric with entries (stretch, stretch,stretch, 1)
|
static double[] |
makeStretchMatrix(double[] dst,
double[] v)
Construct a diagonal matrix with the given entries.
|
static double[] |
makeStretchMatrix(double[] dst,
double xscale,
double yscale,
double zscale)
Create a diagonal matric with entries (xscale, yscale, zscale, 1)
|
static double[] |
makeTranslationMatrix(double[] dst,
double[] from,
double[] to,
int metric)
Calculate a translation matrix in the given metric
which carries the point from to the point to
and maps the line joining from and to to itself (the axis of the isometry).
|
static double[] |
makeTranslationMatrix(double[] mat,
double[] to,
int metric)
Calculate a translation matrix which carries the origin (0,0,0,1 to
the point to.
|
static double |
orientation(double[] to,
double[] up,
double[] upNoRoll)
Calculate the determinant of the matrix spanned by the three input vectors
and the origin (0,0,0,1).
|
static double[] |
orthonormalizeMatrix(double[] dst,
double[] m,
double tolerance,
int metric)
Attempt to convert a matrix m into an isometry with respect to metric metric.
|
static double[] |
perpendicularBisector(double[] dst,
double[] p1,
double[] p2,
int metric)
Calculate the plane coordinates for the plane which lies midway between the input
planes p1 and p2.
|
static double[] |
planeFromPoints(double[] planeIn,
double[] p1,
double[] p2,
double[] p3)
Construct the homogeneous plane coordinates for the plane containing the three points (p1, p2, p3).
|
static double[] |
pointFromPlanes(double[] point,
double[] p1,
double[] p2,
double[] p3)
Via duality, an alias for
planeFromPoints(double[], double[], double[], double[]) . |
public static double[] p3involution
public static double[] Q_HYPERBOLIC
public static double[] Q_EUCLIDEAN
public static double[] Q_ELLIPTIC
public static double[][] Q_LIST
public static double[] originP3
public static double[] composeMatrixFromFactors(double[] m, double[] transV, Quaternion rotQ, Quaternion stretchRotQ, double[] stretchV, boolean isFlipped, int metric)
m
- transV
- rotQ
- stretchRotQ
- stretchV
- isFlipped
- metric
- public static float[] makePerspectiveProjectionMatrix(float[] dst, Rectangle2D viewport, float near, float far)
public static double[] extractOrientationMatrix(double[] dst, double[] src, double[] point, int metric)
dst
- src
- point
- metric
- public static double[] factorMatrix(double[] m, double[] transV, Quaternion rotQ, Quaternion stretchRotQ, double[] stretchV, boolean[] isFlipped, int metric)
m
- transV
- rotQ
- stretchRotQ
- stretchV
- isFlipped
- metric
- public static double[] makeGlideReflectionMatrix(double[] m, double[] p1, double[] p2, double[] plane, int metric)
m
- vec
- public static double[] makeLookatMatrix(double[] m, double[] from, double[] to, double roll, int metric)
m
- from
- to
- roll
- metric
- public static double[] makeOrthographicProjectionMatrix(double[] m, Rectangle2D viewport, double near, double far)
m
- viewport
- n
- f
- public static double[] makePerspectiveProjectionMatrix(double[] dst, Rectangle2D viewport, double near, double far)
dst
- matrix to put the resultviewport
- The viewport of the camera (normalized to lie in z = -1 plane)n
- near clipping planef
- far clipping planepublic static double[] makeReflectionMatrix(double[] m, double[] plane, int metric)
m
- vec
- metric
- public static double[] makeRotationMatrix(double[] m, double[] axis, double angle)
m
- the target matrixaxis
- double[3]angle
- public static double[] makeRotationMatrix(double[] m, double[] from, double[] to)
m
- double[16]from
- double[3]to
- double[3]public static double[] makeRotationMatrix(double[] m, double[] p1, double[] p2, double angle, int metric)
m
- p1
- p2
- angle
- metric
- public static double[] makeRotationMatrixX(double[] mat, double angle)
object
- earthPhi
- public static double[] makeRotationMatrixY(double[] mat, double angle)
public static double[] makeRotationMatrixZ(double[] mat, double angle)
public static double[] makeStretchMatrix(double[] dst, double stretch)
dst
- stretch
- public static double[] makeStretchMatrix(double[] dst, double xscale, double yscale, double zscale)
dst
- xscale
- yscale
- zscale
- public static double[] makeStretchMatrix(double[] dst, double[] v)
dst
- scales
- public static double[] makeScaleMatrix(double[] dst, double s)
dst
- s
- public static double[] makeScaleMatrix(double[] dst, double[] s)
public static double[] makeScaleMatrix(double[] dst, double sx, double sy, double sz)
public static double[] makeSkewMatrix(double[] dst, int i, int j, double val)
public static double[] makeScrewMotionMatrix(double[] dst, double[] p1, double[] p2, double angle, int metric)
public static double[] makeTranslationMatrix(double[] dst, double[] from, double[] to, int metric)
dst
- from
- to
- metric
- public static double[] makeTranslationMatrix(double[] mat, double[] to, int metric)
mat
- to
- metric
- public static boolean isValidTranslationVector(double[] vec, int metric)
public static double[] makeDirectIsometryFromFrames(double[] dst, double[] p0, double[] p1, double[] p2, double[] q0, double[] q1, double[] q2, int metric)
#makeDirectIsometryFromFrame(double[], double[], double[], int)
.dst
- p0
- p1
- q0
- q1
- metric
- public static double orientation(double[] to, double[] up, double[] upNoRoll)
to
- up
- upNoRoll
- public static double[] orthonormalizeMatrix(double[] dst, double[] m, double tolerance, int metric)
dst
- m
- tolerance
- metric
- public static double[] getTransformedAbsolute(double[] m, int metric)
public static boolean isometryIsUnstable(double[] matrix, int metric)
public static double[] perpendicularBisector(double[] dst, double[] p1, double[] p2, int metric)
dst
- p1
- p2
- metric
- public static double[] planeFromPoints(double[] planeIn, double[] p1, double[] p2, double[] p3)
plane
- double[4]p1
- double[3] or double[4]p2
- double[3] or double[4]p3
- double[3] or double[4]public static double[] lineIntersectPlane(double[] dst, double[] p1, double[] p2, double[] plane)
point
- p1
- p2
- plane
- public static double[] pointFromPlanes(double[] point, double[] p1, double[] p2, double[] p3)
planeFromPoints(double[], double[], double[], double[])
.point
- p1
- p2
- p3
- public static double[] lineJoinPoint(double[] plane, double[] p1, double[] p2, double[] point)
public static boolean areCollinear(double[] p0, double[] p1, double[] p2, double tol)
public static double[] barycentricCoordinates(double[] weights, double[] p0, double[] p1, double[] p)
public static double affineCoordinate(double[] p1, double[] p2, double[] pw)