jv.vecmath

Class PuReflect

• java.lang.Object
• jv.vecmath.PuReflect

• ```public class PuReflect
extends java.lang.Object```
Utility class with static methods to compute reflection and other symmetry matrices.

Most matrices are intended to work with homogenous coordinate representations, that means, the matrix of dimension (dim+1)*(dim+1) is later applied to points in ambient dim-space. See also the classes PdVector and PdMatrix which provide homogenous linear algebra multiplications.

• Constructor Summary

Constructors
Constructor and Description
`PuReflect()`
• Method Summary

Methods
Modifier and Type Method and Description
`static java.lang.Double` ```getRotation(PdMatrix mat, PdVector axis)```
Get axis and angle of a 3x3 rotation matrix.
`static boolean` ```makeRotation(PdMatrix mat, PdVector axis, double angle)```
Assign a (3*3)-rotation matrix to rotate around axis through origin with given angle.
`static PdMatrix` ```planeReflect(PdVector base, PdVector normal)```
Generate a (dim+1)*(dim+1)-matrix to reflect in plane determined by a base point and a plane normal.
`static PdMatrix` ```planeReflect(PdVector a, PdVector b, PdVector c)```
Generate a (4*4)-matrix to reflect in plane given by three vertices on the plane in R3.
`static PdMatrix` `pointReflect(PdVector p)`
Generate a (dim+1)*(dim+1)-matrix to invert space at a given center point.
`static PdMatrix` ```rotate(PdMatrix mat, double angle, int indI, int indJ)```
Generate a homogeneous matrix to rotate in the (indI,indJ)-plane around a given angle in radians (i.e.
`static PdMatrix` ```rotateLine(PdMatrix mat, PdVector base, PdVector axis)```
Fill a given (4*4)-matrix to rotate around axis `base+t*dir` by 180 degrees.
`static PdMatrix` ```rotateLine(PdMatrix mat, PdVector base, PdVector axis, double angle)```
Fill a (4*4)-matrix to rotate around axis `base+t*dir` by given angle.
`static PdMatrix` ```rotateLine(PdVector base, PdVector axis)```
Generate a (4*4)-matrix to rotate around axis `base+t*dir` by 180 degrees.
`static PdMatrix` ```rotateLine(PdVector base, PdVector axis, double fi)```
Generate a (4*4)-matrix to rotate around axis `base+t*dir` by given angle.
`static PdMatrix` ```rotateXY(double angle, int dim)```
Generate a homogeneous matrix to rotate in the XY-plane around a given angle in radians (i.e.
`static PdMatrix` ```rotateXZ(double angle, int dim)```
Generate a homogeneous matrix to rotate in the XZ-plane around a given angle in radians (i.e.
`static PdMatrix` ```rotateYZ(double angle, int dim)```
Generate a homogeneous matrix to rotate in the YZ-plane around a given angle in radians (i.e.
`static PdMatrix` ```scale(double s, int dim)```
Generate a homogeneous matrix to non-uniform scale by a given vector ` p[i] = p[i]*s`.
`static PdMatrix` `scale(PdVector v)`
Generate a homogeneous matrix to non-uniform scale by a given vector ` p[i] = p[i]*v[i]`.
`static PdMatrix` `translate(PdVector v)`
Generate a (dim+1)*(dim+1) matrix m to translate a point p by a given vector v: ` m*p=p+v`.
• Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• Constructor Detail

• PuReflect

`public PuReflect()`
• Method Detail

• makeRotation

```public static boolean makeRotation(PdMatrix mat,
PdVector axis,
double angle)```
Assign a (3*3)-rotation matrix to rotate around axis through origin with given angle. Parameter mat and axis must have dimension greater or equal to three. Only first three components are used.
Parameters:
`mat` - Matrix to hold the transformation matrix.
`axis` - direction of rotation axis, need not be normalized
`angle` - angle in radians about to rotate
Returns:
false missing axis or problems in its normalization
• getRotation

```public static java.lang.Double getRotation(PdMatrix mat,
PdVector axis)```
Get axis and angle of a 3x3 rotation matrix. I- and J-dimension of matrix must both be equal or greater than 3.
Parameters:
`mat` - Matrix to hold the transformation matrix.
`axis` - direction of rotation axis, need not be normalized
Returns:
• rotateLine

```public static PdMatrix rotateLine(PdMatrix mat,
PdVector base,
PdVector axis)```
Fill a given (4*4)-matrix to rotate around axis `base+t*dir` by 180 degrees. Parameter base and axis must have dimension greater or equal to three. Only first three components are used.

There are no object allocations in this method.

Parameters:
`mat` - 4*4 matrix which will be filled.
`base` - Arbitrary point on rotation axis.
`axis` - Direction of rotation axis, need not be normalized
Returns:
given matrix
Since:
JavaView 2.83.000
• rotateLine

```public static PdMatrix rotateLine(PdVector base,
PdVector axis)```
Generate a (4*4)-matrix to rotate around axis `base+t*dir` by 180 degrees. Parameter base and axis must have dimension greater or equal to three. Only first three components are used.

Method allocates a new matrix and invokes `rotateLine`

Parameters:
`base` - Arbitrary point on rotation axis.
`axis` - Direction of rotation axis, need not be normalized
Returns:
new rotation matrix
• rotateLine

```public static PdMatrix rotateLine(PdMatrix mat,
PdVector base,
PdVector axis,
double angle)```
Fill a (4*4)-matrix to rotate around axis `base+t*dir` by given angle. Parameter base and axis must have dimension greater or equal to three. Only first three components are used.

There are no object allocations in this method.

Parameters:
`mat` - 4*4 matrix which will be filled.
`base` - Arbitrary point on rotation axis.
`axis` - Direction of rotation axis, need not be normalized
`angle` - Angle in radians about to rotate.
Returns:
given matrix
Since:
JavaView 2.83.000
• rotateLine

```public static PdMatrix rotateLine(PdVector base,
PdVector axis,
double fi)```
Generate a (4*4)-matrix to rotate around axis `base+t*dir` by given angle. Parameter base and axis must have dimension greater or equal to three. Only first three components are used.
Parameters:
`base` - Arbitrary point on rotation axis.
`axis` - Direction of rotation axis, need not be normalized
`fi` - Angle in radians about to rotate.
Returns:
Rotation matrix
• planeReflect

```public static PdMatrix planeReflect(PdVector a,
PdVector b,
PdVector c)```
Generate a (4*4)-matrix to reflect in plane given by three vertices on the plane in R3.
Parameters:
`a` - Point on the plane.
`b` - Point on the plane.
`c` - Point on the plane.
Returns:
Reflection matrix of dimension (4*4).
• planeReflect

```public static PdMatrix planeReflect(PdVector base,
PdVector normal)```
Generate a (dim+1)*(dim+1)-matrix to reflect in plane determined by a base point and a plane normal.
Parameters:
`base` - Arbitrary point on plane of dimension dim.
`normal` - Normal vector orthonormal to plane.
Returns:
Reflection matrix of dimension (dim+1)
• pointReflect

`public static PdMatrix pointReflect(PdVector p)`
Generate a (dim+1)*(dim+1)-matrix to invert space at a given center point. The mapping is: reflect(x) = -x+2p. If p=0 then x goes to -x. The matrix has dimension (dim+1) if dim is the dimension of the vector.
Parameters:
`p` - Arbitrary point of dimension dim as inversion center.
Returns:
Inversion matrix of dimension (dim+1)
• translate

`public static PdMatrix translate(PdVector v)`
Generate a (dim+1)*(dim+1) matrix m to translate a point p by a given vector v: ` m*p=p+v`. The matrix has dimension (dim+1) if dim is the dimension of the vector.
Parameters:
`v` - Translation vector.
Returns:
Translation matrix of dimension (dim+1)
• scale

`public static PdMatrix scale(PdVector v)`
Generate a homogeneous matrix to non-uniform scale by a given vector ` p[i] = p[i]*v[i]`. The matrix has dimension (dim+1) if dim is the dimension of the vector.
Parameters:
`v` - Scaling vector of dimension dim.
Returns:
New scaling matrix of dimension (dim+1)
• scale

```public static PdMatrix scale(double s,
int dim)```
Generate a homogeneous matrix to non-uniform scale by a given vector ` p[i] = p[i]*s`. The generated matrix is a (dim+1) square matrix.
Parameters:
`s` - Scaling factor.
`dim` - Dimension of ambient space.
Returns:
New scaling matrix of dimension (dim+1)
• rotateXY

```public static PdMatrix rotateXY(double angle,
int dim)```
Generate a homogeneous matrix to rotate in the XY-plane around a given angle in radians (i.e. PI). The generated matrix is a (dim+1) square matrix.
Parameters:
`angle` - Angle in radians.
`dim` - Dimension of ambient space.
Returns:
New rotation matrix of dimension (dim+1)
Since:
JavaView 3.97.016
• rotateYZ

```public static PdMatrix rotateYZ(double angle,
int dim)```
Generate a homogeneous matrix to rotate in the YZ-plane around a given angle in radians (i.e. PI). The generated matrix is a (dim+1) square matrix.
Parameters:
`angle` - Angle in radians.
`dim` - Dimension of ambient space.
Returns:
New rotation matrix of dimension (dim+1)
Since:
JavaView 3.97.016
• rotateXZ

```public static PdMatrix rotateXZ(double angle,
int dim)```
Generate a homogeneous matrix to rotate in the XZ-plane around a given angle in radians (i.e. PI). The generated matrix is a (dim+1) square matrix.
Parameters:
`angle` - Angle in radians.
`dim` - Dimension of ambient space.
Returns:
New rotation matrix of dimension (dim+1)
Since:
JavaView 3.97.016
• rotate

```public static PdMatrix rotate(PdMatrix mat,
double angle,
int indI,
int indJ)```
Generate a homogeneous matrix to rotate in the (indI,indJ)-plane around a given angle in radians (i.e. PI). The generated matrix is a homogeneous (dim+1) square matrix.
Parameters:
`angle` - Angle in radians.
`indI` - Dimension of first coordinates axis which determines the plane of rotation.
`indJ` - Dimension of second coordinates axis which determines the plane of rotation.
Returns:
Given rotation matrix
Since:
JavaView 3.97.016