public class Pn extends Object
dehomogenize(double[], double[])).
In addition to purely projective methods, this includes a number of methods related to the classical homogeneous metric spaces (euclidean, hyperbolic, and elliptic) which are based on a projective model for these spaces.
The methods related to metric geometries generally have a final argument
which identifies the geometry. This can be one of the 3 pre-defined values
HYPERBOLIC, EUCLIDEAN or ELLIPTIC. These correspond to
spaces of constant negative, null, and positive curvature, resp.
(For the mathematical basis of the derivation of metric geometries from projective geometry -- which forms the foundation the functionality of this class -- see H.M.S. Coxeter, Non-Euclidean Geometry, 1965.)
Note: there may appear to be some duplication of functionality with methods in Rn. However,
the methods here expect points to be specified with homogeneous coordinates, while those in Rn expect dehomogenized
coordinates (in general -- but see Rn for exceptions), so there is
usually only one correct choice for which method to use. But see normalize(double[], double[], int)
for an example of some finer points.
See also Rn for more on method conventions.
See also P2 and P3 for
methods specific to two- and three-dimensional real projective geometry.
| Modifier and Type | Field and Description |
|---|---|
static int |
ELLIPTIC |
static int |
EUCLIDEAN |
static int |
HYPERBOLIC |
static int |
PROJECTIVE |
static double[] |
zDirectionP3 |
| Modifier and Type | Method and Description |
|---|---|
static double |
acosh(double x) |
static double |
angleBetween(double[] u,
double[] v,
int metric)
Calculate the angle between the points u and v with respect to
the metric metric.
|
static double |
asinh(double x) |
static double |
atanh(double x) |
static double[] |
barycentricCoordinates(double[] dst,
double[][] tri,
double[] unit) |
static double[][] |
calculateBounds(double[][] bounds,
double[][] vlist)
Like the method
calculateBounds in class Rn,
but dehomogenizes the points before computing the bound. |
static double[] |
centroid(double[] average,
double[][] points,
int metric)
Calculate the centroid of points with respect to metric.
|
static double |
coordForDistance(double d,
int metric)
Return the value z so that the point (0,0,z,1) lies a distance d
from the origin (0,0,0,1) in the given metric.
|
static double |
cosh(double x)
These hyperbolic trig functions fill in a gap in the Java math library!
|
static double[][] |
dehomogenize(double[][] dst,
double[][] src)
A vectorized version of
dehomogenize(double[], double[]). |
static double[] |
dehomogenize(double[] dst,
double[] src)
Dehomogenize the src array into the dst array.
|
static double |
distanceBetween(double[] u,
double[] v,
int metric)
Calculate the distance between the two points u and v.
|
static double[] |
dragTangentVector(double[] dst,
double[] ddir,
double[] src,
double[] sdir,
double length,
int metric)
Drag a tangent vector sdir based at point src with initial direction given by sdir, a distance
of length in the given metric.
|
static double[] |
dragTangentVector(double[] dstTangent,
double[] sourcePoint,
double[] sourceTangent,
double[] dstPoint,
int metric)
Drag the tangent vector sourceTangent based at sourcePoint to a tangent vector based at dstPoint.
|
static double[] |
dragTowards(double[] result,
double[] p0,
double[] p1,
double length,
int metric)
Calculate the point lying a distance length from p0 in the direction p1.
|
static double[][] |
homogenize(double[][] dst,
double[][] src)
A vector version of
homogenize(double[], double[]). |
static double[] |
homogenize(double[] dst,
double[] src)
Extend the coordinates of src by appending 1.0
|
static double |
innerProduct(double[] dst,
double[] src,
int metric)
Returns the inner product of the two vectors for the given metric.
|
static double |
innerProductPlanes(double[] dst,
double[] src,
int metric)
The euclidean metric is not completely self-dual so we need a special method to calculate
inner product of planes
|
static double |
innerProductPoints(double[] dst,
double[] src,
int metric)
An alias for
innerProduct(double[], double[], int). |
static boolean |
isEquivalentPoints(double[] p1,
double[] p2) |
static boolean |
isValidCoordinate(double[] transVec,
int dim,
int metric) |
static double[] |
linearInterpolation(double[] dst,
double[] u,
double[] v,
double t,
int metric)
Linear interpolate respecting the given metric metric.
|
static double[] |
makeFlattenProjection(double[] dst,
double[] center,
double[] axis)
Similar to
P3#makeHarmonicHarmology(double[], double[], double[]) but maps all points
onto the axis plane. |
static double[] |
makeGeneralizedProjection(double[] dst,
double[] center,
double[] axis,
double val)
Create a projectivity that leaves center C invariant (planewise), axis A invariant (point-wise) and
otherwise moves a general point P along the line l through P and the center depending on
val.
|
static double[] |
makeHarmonicHarmology(double[] dst,
double[] center,
double[] axis)
Construct a central projectivity with fixed point center and fixed plane axis.
|
static double[] |
midPlane(double[] midp,
double[] pl1,
double[] pl2,
int metric)
Find the plane which lies, metrically, half-way between the two given planes.
|
static double |
norm(double[] src,
int metric)
Calculates the norm of the vector in the given metric metric.
|
static double[][] |
normalize(double[][] dst,
double[][] src,
int metric)
A vectorized version of
normalize(double[], double[], int). |
static double[] |
normalize(double[] dst,
double[] dvec,
double[] src,
double[] svec,
int metric)
Normalize a point-tangent pair (src, svec) so that both members have unit length
and, the tangent vector lies in the polar plane of the point.
|
static double[] |
normalize(double[] dst,
double[] src,
int metric)
Normalizes the vector src to have unit length (either 1 or i), or,
if metric
is EUCLIDEAN, then the input vector is dehomogenized.
|
static double[] |
normalizePlane(double[] dst,
double[] src,
int metric)
For the euclidean special case:
Normalize a hyper-plane (represented as a vector of length n) so that the direction vector
(the first n-1 coordinates) has
euclidean length 1 but represents the same projective hyper-plane.
|
static double[] |
normalizePoint(double[] dst,
double[] src,
int metric)
An alias for
normalize(double[], double[], int). |
static double |
normSquared(double[] src,
int metric) |
static double[][] |
polarize(double[][] polar,
double[][] p,
int metric)
A vectorized version of
polarize(double[], double[], int). |
static double[] |
polarize(double[] polar,
double[] p,
int metric)
Polarize the input element p with respect to the quadradic form associated to
metric.
|
static double[] |
polarizePlane(double[] dst,
double[] plane,
int metric)
This just calls
polarize(double[], double[], int) since the polar plane of
a point is just Q.point, where Q is the absolute quadric |
static double[] |
polarizePoint(double[] dst,
double[] point,
int metric)
This has to handle the exception euclidean case, that the polar of any point is
the ideal plane.
|
static double[] |
projectivity(double[] dst,
double[][] dm,
double[][] im) |
static double[] |
projectivityFromCanonical(double[] dst,
double[][] dm)
Calculate the projectivity that takes the standard basis to the basis given by dm and the unit point to the last entry of dm
|
static double[] |
projectOnto(double[] result,
double[] master,
double[] victim,
int metric)
Determine the projection of the point victim onto the point master.
|
static double[] |
projectOntoComplement(double[] result,
double[] master,
double[] victim,
int metric)
Project victim onto the othogonal complement of master (all with respect to the
given metric).
|
static double[] |
projectToTangentSpace(double[] result,
double[] point,
double[] tangentToBe,
int metric) |
static double[][] |
setToLength(double[][] dst,
double[][] src,
double d,
int metric)
A vectorized version of
setToLength(double[], double[], double, int). |
static double[] |
setToLength(double[] dst,
double[] src,
double length,
int metric)
Create a multiple of src with has length length.
|
static double |
sinh(double x) |
static double |
tanh(double x) |
public static final int ELLIPTIC
public static final int EUCLIDEAN
public static final int HYPERBOLIC
public static final int PROJECTIVE
public static double[] zDirectionP3
public static double cosh(double x)
arg - public static double sinh(double x)
public static double tanh(double x)
public static double acosh(double x)
public static double asinh(double x)
public static double atanh(double x)
public static double angleBetween(double[] u,
double[] v,
int metric)
u - v - metric - public static double[][] calculateBounds(double[][] bounds,
double[][] vlist)
calculateBounds in class Rn,
but dehomogenizes the points before computing the bound.bounds - double[2][3]vlist - double[][3] or double[][4]public static double[] centroid(double[] average,
double[][] points,
int metric)
average - points - metric - public static double[] dehomogenize(double[] dst,
double[] src)
dst - src - public static double coordForDistance(double d,
int metric)
d - metric - public static double[][] dehomogenize(double[][] dst,
double[][] src)
dehomogenize(double[], double[]).dst - src - public static double distanceBetween(double[] u,
double[] v,
int metric)
u - v - metric - public static double[] dragTangentVector(double[] dst,
double[] ddir,
double[] src,
double[] sdir,
double length,
int metric)
normalize(double[], double[], double[], double[], int)
to perform this normalization before calling this method.dst - ddir - src - sdir - length - metric - public static double[] dragTangentVector(double[] dstTangent,
double[] sourcePoint,
double[] sourceTangent,
double[] dstPoint,
int metric)
ds - ds2 - ds3 - ds4 - metric - #dragTangentVector(double[], double[], double[], double, int)public static double[] dragTowards(double[] result,
double[] p0,
double[] p1,
double length,
int metric)
result - p0 - p1 - length - metric - public static double[] homogenize(double[] dst,
double[] src)
dst - src - public static double[][] homogenize(double[][] dst,
double[][] src)
homogenize(double[], double[]).dst - src - public static double innerProduct(double[] dst,
double[] src,
int metric)
dst - src - metric - public static double innerProductPlanes(double[] dst,
double[] src,
int metric)
dst - src - metric - public static double innerProductPoints(double[] dst,
double[] src,
int metric)
innerProduct(double[], double[], int).dst - src - metric - public static boolean isEquivalentPoints(double[] p1,
double[] p2)
public static boolean isValidCoordinate(double[] transVec,
int dim,
int metric)
public static double[] linearInterpolation(double[] dst,
double[] u,
double[] v,
double t,
int metric)
dst - u - v - t - metric - Rn.linearCombination(double[], double, double[], double, double[]).public static double[] makeHarmonicHarmology(double[] dst,
double[] center,
double[] axis)
dst - center - axis - metric - public static double[] makeFlattenProjection(double[] dst,
double[] center,
double[] axis)
P3#makeHarmonicHarmology(double[], double[], double[]) but maps all points
onto the axis plane.dst - center - axis - public static double[] makeGeneralizedProjection(double[] dst,
double[] center,
double[] axis,
double val)
dst - center - axis - val - public static double[] midPlane(double[] midp,
double[] pl1,
double[] pl2,
int metric)
midp - pl1 - pl2 - metric - public static double norm(double[] src,
int metric)
src - metric - public static double[] normalize(double[] dst,
double[] dvec,
double[] src,
double[] svec,
int metric)
dst - dvec - src - svec - metric - public static double[] normalize(double[] dst,
double[] src,
int metric)
setToLength(double[], double[], double, int).
This method is only
valid for homogeneous coordinates. Use {@link de.jreality.math.Rn#normalize(double[], double[])
if you are using dehomogenous coordinates (e.g., representing points in R3 using 3-vectors). \dst - src - metric - public static double[][] normalize(double[][] dst,
double[][] src,
int metric)
normalize(double[], double[], int).dst - src - metric - public static double[] normalizePlane(double[] dst,
double[] src,
int metric)
dst - src - public static double[] normalizePoint(double[] dst,
double[] src,
int metric)
normalize(double[], double[], int).dst - src - metric - public static double normSquared(double[] src,
int metric)
src - metric - public static double[] polarize(double[] polar,
double[] p,
int metric)
polarizePlane(double[], double[], int) or
polarizePlane(double[], double[], int).polar - p - metric - public static double[][] polarize(double[][] polar,
double[][] p,
int metric)
polarize(double[], double[], int).polar - p - metric - public static double[] polarizePlane(double[] dst,
double[] plane,
int metric)
polarize(double[], double[], int) since the polar plane of
a point is just Q.point, where Q is the absolute quadricdst - ds - metric - public static double[] polarizePoint(double[] dst,
double[] point,
int metric)
polarize(double[], double[], int).object - ds - metric - public static double[] projectivityFromCanonical(double[] dst,
double[][] dm)
dst - domainPts - imagePts - public static double[] projectivity(double[] dst,
double[][] dm,
double[][] im)
public static double[] projectOnto(double[] result,
double[] master,
double[] victim,
int metric)
result - master - victim - metric - public static double[] projectOntoComplement(double[] result,
double[] master,
double[] victim,
int metric)
projectOnto(double[], double[], double[], int).result - master - victim - metric - public static double[] projectToTangentSpace(double[] result,
double[] point,
double[] tangentToBe,
int metric)
result - point - tangentToBe - metric - public static double[] setToLength(double[] dst,
double[] src,
double length,
int metric)
dst - src - length - metric - public static double[][] setToLength(double[][] dst,
double[][] src,
double d,
int metric)
setToLength(double[], double[], double, int).verts - verts2 - d - euclidean2 - public static double[] barycentricCoordinates(double[] dst,
double[][] tri,
double[] unit)