Class GeometryMath_F32
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidadd(float a0, GeoTuple3D_F32 pt0, float a1, GeoTuple3D_F32 pt1, GeoTuple3D_F32 pt2) Adds two points together while scaling them.
pt2 = a0 pt0 + a1 pt1static voidadd(GeoTuple3D_F32 a, GeoTuple3D_F32 b, GeoTuple3D_F32 c) Adds two points together.
c = a + bstatic <T extends GeoTuple3D_F32>
TaddMult(T p0, FMatrixRMaj M, T p1, T result) ret = p0 + M*p1static <T extends GeoTuple3D_F32>
TaddMultTrans(T p0, FMatrixRMaj M, T p1, T result) ret = p0 + MT*p1static FMatrixRMajaddOuterProd(FMatrixRMaj A, float scalar, GeoTuple3D_F32 b, GeoTuple3D_F32 c, @Nullable FMatrixRMaj ret) Adds the outer product of two vectors onto a matrix:
ret = A + scalar*a*bTstatic voidChanges the sign of the vector:
T = -Tstatic voidcross(float a_x, float a_y, float a_z, float b_x, float b_y, float b_z, GeoTuple3D_F32 c) Computes the cross product:
c = a x bstatic voidcross(GeoTuple2D_F32 a, GeoTuple2D_F32 b, GeoTuple3D_F32 c) Computes the cross product:
c = a x bstatic voidcross(GeoTuple2D_F32 a, GeoTuple3D_F32 b, GeoTuple3D_F32 c) Computes the cross product:
c = a x b
where 'a' is in homogeneous coordinates.static voidcross(GeoTuple3D_F32 a, GeoTuple3D_F32 b, GeoTuple3D_F32 c) Computes the cross product:
c = a x bstatic FMatrixRMajcrossMatrix(float x0, float x1, float x2, @Nullable FMatrixRMaj ret) Creates a skew symmetric cross product matrix from the provided tuple.static FMatrixRMajcrossMatrix(GeoTuple3D_F32 v, @Nullable FMatrixRMaj ret) Creates a skew symmetric cross product matrix from the provided tuple.static voiddivide(GeoTuple3D_F32 p, float v) Divides each element by 'v'static floatdot(GeoTuple3D_F32 a, GeoTuple3D_F32 b) Dot product: ret = aTbstatic floatinnerProd(GeoTuple2D_F32 a, FMatrixRMaj M, GeoTuple2D_F32 b) Computes the inner matrix product: ret = a'*M*b
where ret is a scalar number.static floatinnerProd(GeoTuple3D_F32 a, FMatrixRMaj M, GeoTuple3D_F32 b) ret = aT*M*bstatic floatComputes the inner matrix product:
ret = xTATystatic voidmult(FMatrixRMaj M, GeoTuple2D_F32 pt, GeoTuple3D_F32 mod) mod = M*pt
where pt has z=1 implicitly.static <T extends GeoTuple2D_F32>
Tmult(FMatrixRMaj M, GeoTuple3D_F32 pt, T mod) mod = M*pt
where mod is a 2D point that has an implicit z=1.static voidmult(FMatrixRMaj P, GeoTuple4D_F32 X, GeoTuple2D_F32 mod) x = (P*X)/zstatic voidmult(FMatrixRMaj P, GeoTuple4D_F32 X, GeoTuple3D_F32 mod) x = P*Xstatic voidmult(FMatrixRMaj P, GeoTuple4D_F32 X, GeoTuple4D_F32 mod) x = P*Xstatic <T extends GeoTuple3D_F32>
Tmult(FMatrixRMaj M, T pt, T result) mod = M*ptstatic <T extends GeoTuple3D_F32>
Tmult4(FMatrixRMaj M, T pt, T result) mod = M*ptstatic FMatrixRMajmultCrossA(GeoTuple2D_F32 A, FMatrixRMaj M, @Nullable FMatrixRMaj result) Computes the following:
result = cross(A)*M
where M and result are 3x3 matrices, cross(A) is the cross product matrix of A.static FMatrixRMajmultCrossA(GeoTuple3D_F32 A, FMatrixRMaj M, @Nullable FMatrixRMaj result) Computes the following:
result = cross(A)*M
where M and result are 3x3 matrices, cross(A) is the cross product matrix of A.static FMatrixRMajmultCrossATransA(GeoTuple2D_F32 A, FMatrixRMaj M, @Nullable FMatrixRMaj result) Computes the following:
result = cross(A)T*M
where M and result are 3x3 matrices, cross(A) is the cross product matrix of A.static FMatrixRMajmultCrossATransA(GeoTuple3D_F32 A, FMatrixRMaj M, @Nullable FMatrixRMaj result) Computes the following:
result = cross(A)T*M
where M and result are 3x3 matrices, cross(A) is the cross product matrix of A.static <T extends GeoTuple3D_F32>
TmultTran(FMatrixRMaj M, GeoTuple2D_F32 pt, T mod) mod = MT*pt
where pt.z = 1 implicitly.static voidmultTran(FMatrixRMaj P, GeoTuple4D_F32 X, GeoTuple4D_F32 mod) x = PT*Xstatic <T extends GeoTuple3D_F32>
TmultTran(FMatrixRMaj M, T pt, T mod) mod = MT*pt.static FMatrixRMajouterProd(GeoTuple3D_F32 a, GeoTuple3D_F32 b, @Nullable FMatrixRMaj ret) Computes the outer product of two vectors:
O = a*bTstatic voidrotate(float c, float s, GeoTuple2D_F32 pt, GeoTuple2D_F32 solution) Rotates a 2D point by the specified angle.static voidrotate(float theta, GeoTuple2D_F32 pt, GeoTuple2D_F32 solution) Rotates a 2D point by the specified angle.static voidscale(GeoTuple3D_F32 p, float v) Multiplies each element in the tuple by 'v'.
pi=pi*vstatic voidsub(GeoTuple3D_F32 a, GeoTuple3D_F32 b, GeoTuple3D_F32 c) Substracts two points from each other.
c = a - bstatic FMatrixRMajtoMatrix(GeoTuple3D_F32 in, @Nullable FMatrixRMaj out) Converts a GeoTuple3D_F32 into FMatrixRMajstatic voidtoTuple3D(FMatrixRMaj in, GeoTuple3D_F32 out) Converts a FMatrixRMaj into GeoTuple3D_F32
-
Constructor Details
-
GeometryMath_F32
public GeometryMath_F32()
-
-
Method Details
-
crossMatrix
public static FMatrixRMaj crossMatrix(float x0, float x1, float x2, @Nullable @Nullable FMatrixRMaj ret) Creates a skew symmetric cross product matrix from the provided tuple.- Parameters:
x0- Element 0.x1- Element 1.x2- Element 2.ret- If not null the results are stored here, otherwise a new matrix is created.- Returns:
- Skew symmetric cross product matrix.
-
crossMatrix
Creates a skew symmetric cross product matrix from the provided tuple.- Parameters:
v- Tuple. Not modified.ret- If not null the results are stored here, otherwise a new matrix is created.- Returns:
- Skew symmetric cross product matrix.
-
cross
Computes the cross product:
c = a x b- Parameters:
a- Not modified.b- Not modified.c- Modified.
-
cross
public static void cross(float a_x, float a_y, float a_z, float b_x, float b_y, float b_z, GeoTuple3D_F32 c) Computes the cross product:
c = a x b- Parameters:
a_x- x-coordinate of aa_y- y-coordinate of aa_z- z-coordinate of ab_x- x-coordinate of bb_y- y-coordinate of bb_z- z-coordinate of bc- Modified.
-
cross
Computes the cross product:
c = a x b
where 'a' is in homogeneous coordinates.- Parameters:
a- Homogeneous coordinates, z = 1 assumed. Not modified.b- Not modified.c- Modified.
-
cross
Computes the cross product:
c = a x b- Parameters:
a- Homogeneous coordinates, z = 1 assumed. Not modified.b- Homogeneous coordinates, z = 1 assumed. Not modified.c- Modified.
-
add
Adds two points together.
c = a + bPoint 'c' can be the same instance as 'a' or 'b'.
- Parameters:
a- A point. Not modified.b- A point. Not modified.c- Where the results are stored. Modified.
-
add
public static void add(float a0, GeoTuple3D_F32 pt0, float a1, GeoTuple3D_F32 pt1, GeoTuple3D_F32 pt2) Adds two points together while scaling them.
pt2 = a0 pt0 + a1 pt1Point 'c' can be the same instance as 'a' or 'b'.
- Parameters:
a0- Scaling factor for pt0.pt0- A point. Not modified.a1- Scaling factor for pt1.pt1- A point. Not modified.pt2- Where the results are stored. Modified.
-
addMult
ret = p0 + M*p1
Safe to pass in the same instance of a point more than once. -
addMultTrans
public static <T extends GeoTuple3D_F32> T addMultTrans(T p0, FMatrixRMaj M, T p1, @Nullable T result) ret = p0 + MT*p1
Safe to pass in the same instance of a point more than once. -
sub
Substracts two points from each other.
c = a - bPoint 'c' can be the same instance as 'a' or 'b'.
- Parameters:
a- A point. Not modified.b- A point. Not modified.c- Where the results are stored. Modified.
-
rotate
Rotates a 2D point by the specified angle.- Parameters:
solution- where the solution is written to. Can be the same point as 'pt'.
-
rotate
Rotates a 2D point by the specified angle.- Parameters:
c- Cosine of thetas- Sine of thetasolution- where the solution is written to. Can be the same point as 'pt'.
-
mult
mod = M*ptpt and mod can be the same reference.
- Parameters:
result- Storage for output. Can be the same instance as param 'pt'. Modified.
-
mult4
mod = M*ptpt and mod can be the same reference. M is a 4x4 matrix. Homogenous coordinates with implicit w = 1
- Parameters:
result- Storage for output. Can be the same instance as param 'pt'. Modified.
-
mult
mod = M*pt
where mod is a 2D point that has an implicit z=1.Multiplies the 3x3 matrix against the 3D point, and normalizes the 2D point output by dividing the x and y values by the found z.
-
mult
mod = M*pt
where pt has z=1 implicitly.Multiplies the 3x3 matrix against the 2D point, which has an implicit z=1 value, and the output is a 3d point.
-
mult
Computes mod = M*pt, where both pt and mod are in homogeneous coordinates with z assumed to be equal to 1, and M is a 3x3 matrix.
'pt' and 'mod' can be the same point.
- Parameters:
M- 3x3 matrixpt- Homogeneous point with z=1mod- Storage for the computation. If null a new point is declared. Can be same instance as pt.- Returns:
- Result of computation.
-
mult
x = P*X- Parameters:
P- Projective 3x4 matrix or 3x3 matrix with implicit [0,0,0,1]' last columnX- 3D point in homogenous coordinatesmod- 2D point in homogenous coordinates. Can be same instance as X.
-
mult
x = P*X- Parameters:
P- 4x4 matrix or 3x3 with implicit [0,0,0,1] right column and bottom rowX- 3D point in homogenous coordinatesmod- 3D point in homogenous coordinates. Can be same instance as X.
-
multTran
x = PT*X- Parameters:
P- 4x4 matrix or 3x3 with implicit [0,0,0,1] right column and bottom rowX- 3D point in homogenous coordinatesmod- 3D point in homogenous coordinates. Can be same instance as X.
-
mult
x = (P*X)/z- Parameters:
P- Projective 3x4 matrixX- 3D point in homogenous coordinatesmod- 2D point in coordinates
-
multCrossA
public static FMatrixRMaj multCrossA(GeoTuple2D_F32 A, FMatrixRMaj M, @Nullable @Nullable FMatrixRMaj result) Computes the following:
result = cross(A)*M
where M and result are 3x3 matrices, cross(A) is the cross product matrix of A.- Parameters:
A- 2D homogenous coordinate (implicit z = 1) that is internally converted into cross product matrix.M- 3x3 matrix.result- Storage for results. Can be null.- Returns:
- Results.
-
multCrossATransA
public static FMatrixRMaj multCrossATransA(GeoTuple2D_F32 A, FMatrixRMaj M, @Nullable @Nullable FMatrixRMaj result) Computes the following:
result = cross(A)T*M
where M and result are 3x3 matrices, cross(A) is the cross product matrix of A.- Parameters:
A- 2D homogenous coordinate (implicit z = 1) that is internally converted into cross product matrix.M- 3x3 matrix.result- Storage for results. Can be null.- Returns:
- Results.
-
multCrossA
public static FMatrixRMaj multCrossA(GeoTuple3D_F32 A, FMatrixRMaj M, @Nullable @Nullable FMatrixRMaj result) Computes the following:
result = cross(A)*M
where M and result are 3x3 matrices, cross(A) is the cross product matrix of A.- Parameters:
A- 3D coordinate that is internally converted into cross product matrix.M- 3x3 matrix.result- Storage for results. Can be null.- Returns:
- Results.
-
multCrossATransA
public static FMatrixRMaj multCrossATransA(GeoTuple3D_F32 A, FMatrixRMaj M, @Nullable @Nullable FMatrixRMaj result) Computes the following:
result = cross(A)T*M
where M and result are 3x3 matrices, cross(A) is the cross product matrix of A.- Parameters:
A- 3D coordinate that is internally converted into cross product matrix.M- 3x3 matrix.result- Storage for results. Can be null.- Returns:
- Results.
-
multTran
mod = MT*pt. Both pt and mod can be the same instance. -
multTran
mod = MT*pt
where pt.z = 1 implicitly.- Parameters:
M- 3 by 3 matrix.pt- 2D point in homogeneous coordinates. Implicit z = 1mod- 2D point in homogeneous coordinates. Implicit z = 1- Returns:
- 2D point in homogeneous coordinates. Implicit z = 1
-
multTran
mod = MT*pt
where pt.z = 1 implicitly.- Parameters:
M- 3 by 3 matrix.pt- 2D point in homogeneous coordinates. Implicit z = 1mod- 2D point in homogeneous coordinates. Implicit z = 1- Returns:
- 2D point in homogeneous coordinates. Implicit z = 1
-
innerProd
ret = aT*M*b
- Parameters:
a- 3D point.M- 3 by 3 matrix.b- 3D point.- Returns:
- scalar number
-
innerProdTranM
Computes the inner matrix product:
ret = xTATy- Parameters:
a- 3D point.M- 3 by 3 matrix.b- 3D point.- Returns:
- scalar number
-
outerProd
public static FMatrixRMaj outerProd(GeoTuple3D_F32 a, GeoTuple3D_F32 b, @Nullable @Nullable FMatrixRMaj ret) Computes the outer product of two vectors:
O = a*bT- Parameters:
a- 3D vectorb- 3D vectorret- 3 x 3 matrix or null.- Returns:
- outer product of two 3d vectors
-
addOuterProd
public static FMatrixRMaj addOuterProd(FMatrixRMaj A, float scalar, GeoTuple3D_F32 b, GeoTuple3D_F32 c, @Nullable @Nullable FMatrixRMaj ret) Adds the outer product of two vectors onto a matrix:
ret = A + scalar*a*bT- Parameters:
A- 3x3 matrixb- 3D vectorc- 3D vectorret- 3 x 3 matrix or null.- Returns:
- outer product of two 3d vectors
-
innerProd
Computes the inner matrix product: ret = a'*M*b
where ret is a scalar number. 'a' and 'b' are automatically converted into homogeneous coordinates.- Parameters:
a- 2D point.M- 3 by 3 matrix.b- 2D point.- Returns:
- scalar number,
-
dot
Dot product: ret = aTb
- Parameters:
a- A tuple.b- A tuple.- Returns:
- scalar
-
scale
Multiplies each element in the tuple by 'v'.
pi=pi*v- Parameters:
p- tuple.v- scaling factor.
-
divide
Divides each element by 'v'- Parameters:
p- tuplev- divisor
-
changeSign
Changes the sign of the vector:
T = -T- Parameters:
t- Vector whose sign is being changed. Modified.
-
toMatrix
Converts a GeoTuple3D_F32 into FMatrixRMaj- Parameters:
in- Input vectorout- Output matrix. If null a new matrix will be declared- Returns:
- Converted matrix
-
toTuple3D
Converts a FMatrixRMaj into GeoTuple3D_F32- Parameters:
in- Input matrixout- Output vector.
-