maspack.geometry

## Class RigidTransformer

• ```public class RigidTransformer
extends GeometryTransformer```
A GeometryTransformer that implements a linear rigid body transformation. For points, this can be expressed in homogenous coordinates as
```
[ p' ]     [ p ]       [  RF   pf  ]
[    ] = T [   ],  T = [           ]
[ 1  ]     [ 1 ]       [  0     1  ]
```
where R is a 3 X 3 rotation matrix and pf is an offset vector.
Author:
John E Lloyd

• ### Nested classes/interfaces inherited from class maspack.geometry.GeometryTransformer

`GeometryTransformer.Constrainer, GeometryTransformer.UndoState, GeometryTransformer.UniformScalingConstrainer`
• ### Constructor Summary

Constructors
Constructor and Description
`RigidTransformer(RigidTransform3d T)`
Creates a new RigidTransformer from a specified rigid transform.
• ### Method Summary

All Methods
Modifier and Type Method and Description
`void` ```computeLocalTransforms(Matrix3d PL, Vector3d Ndiag, RigidTransform3d T)```
Computes the matrices `PL` and `N` that transform points `xl` local to a coordinate frame `T` after that frame is itself transformed.
`void` ```computeTransform(AffineTransform3d XR, AffineTransform3d X)```
Transforms an affine transform `X` and returns the result in `XR`.
`void` ```computeTransform(Matrix3d MR, Matrix3d M, Vector3d r)```
Transforms a general 3 X 3 matrix `M`, and returns the result in `MR`.
`void` ```computeTransform(Plane pr, Plane p, Vector3d r)```
Transforms a plane `p` and returns the result in `pr`.
`void` ```computeTransform(RigidTransform3d TR, RigidTransform3d T)```
Transforms a rigid transform `T` and returns the result in `TR`.
`void` ```computeTransform(RotationMatrix3d RR, Vector3d Ndiag, RotationMatrix3d R, Vector3d r)```
Transforms a rotation matrix `R` and returns the result in `RR`.
`void` ```computeTransformNormal(Vector3d nr, Vector3d n, Vector3d r)```
Transforms a normal vector `n`, and returns the result in `nr`.
`void` ```computeTransformPnt(Point3d pr, Point3d p)```
Transforms a point `p` and returns the result in `pr`.
`void` ```computeTransformVec(Vector3d vr, Vector3d v, Vector3d r)```
Transforms a vector `v`, and returns the result in `vr`.
`RigidTransformer` `getInverse()`
Returns a transformer that implements the inverse operation of this transformer.
`boolean` `isAffine()`
Returns `true`, since a rigid transform is a special case of an affine transform.
`boolean` `isInvertible()`
Returns `true`, since this transformer is invertible.
`boolean` `isReflecting()`
Returns `false`, since a rigid transform cannot be reflecting.
`boolean` `isRigid()`
Returns `true`, since this transformer does implement a linear rigid transform.
• ### Methods inherited from class maspack.geometry.GeometryTransformer

`computeLinearizedTransform, computeLocalAffineTransform, computeTransform, create, getUndoDataSize, isRestoring, isSaving, popRestoreData, restoreObject, saveObject, setUndoState, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transformNormal, transformNormal, transformPnt, transformPnt, transformVec, transformVec, transformWorld, transformWorld`
• ### Methods inherited from class java.lang.Object

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

• #### RigidTransformer

`public RigidTransformer(RigidTransform3d T)`
Creates a new RigidTransformer from a specified rigid transform.
Parameters:
`T` - rigid transform defining the transformation
• ### Method Detail

• #### isRigid

`public boolean isRigid()`
Returns `true`, since this transformer does implement a linear rigid transform.
Specified by:
`isRigid` in class `GeometryTransformer`
• #### isAffine

`public boolean isAffine()`
Returns `true`, since a rigid transform is a special case of an affine transform.
Specified by:
`isAffine` in class `GeometryTransformer`
• #### isInvertible

`public boolean isInvertible()`
Returns `true`, since this transformer is invertible.
Specified by:
`isInvertible` in class `GeometryTransformer`
• #### isReflecting

`public boolean isReflecting()`
Returns `false`, since a rigid transform cannot be reflecting.
Overrides:
`isReflecting` in class `GeometryTransformer`
• #### getInverse

`public RigidTransformer getInverse()`
Returns a transformer that implements the inverse operation of this transformer.
Specified by:
`getInverse` in class `GeometryTransformer`
Returns:
inverse transformer
• #### computeTransformPnt

```public void computeTransformPnt(Point3d pr,
Point3d p)```
Transforms a point `p` and returns the result in `pr`. The transform is computed according to
``` pr = RF p + pf
```
This method provides the low level implementation for point transformations and does not do any saving or restoring of data.
Specified by:
`computeTransformPnt` in class `GeometryTransformer`
Parameters:
`pr` - transformed point
`p` - point to be transformed
• #### computeTransformVec

```public void computeTransformVec(Vector3d vr,
Vector3d v,
Vector3d r)```
Transforms a vector `v`, and returns the result in `vr`. The reference position `r` is ignored since rigid transforms are position invariant. The transform is computed according to
``` vr = RF v
```
This method provides the low level implementation for vector transformations and does not do any saving or restoring of data.
Specified by:
`computeTransformVec` in class `GeometryTransformer`
Parameters:
`vr` - transformed vector
`v` - vector to be transformed
`r` - reference position of the vector (ignored)
• #### computeLocalTransforms

```public void computeLocalTransforms(Matrix3d PL,
Vector3d Ndiag,
RigidTransform3d T)```
Computes the matrices `PL` and `N` that transform points `xl` local to a coordinate frame `T` after that frame is itself transformed. For rigid transforms, `N` is always the identity, and the updated local coordinates are given by
``` xl' = PL xl
```
where `PL` is symmetric positive definite. See the documentation for `GeometryTransformer.computeLocalTransforms(maspack.matrix.Matrix3d, maspack.matrix.Vector3d, maspack.matrix.RigidTransform3d)`.
Specified by:
`computeLocalTransforms` in class `GeometryTransformer`
Parameters:
`PL` - primary transformation matrix
`Ndiag` - if non-null, returns the diagonal components of N (which will be all ones)
`T` - rigid transform for which the local transforms are computed
• #### computeTransformNormal

```public void computeTransformNormal(Vector3d nr,
Vector3d n,
Vector3d r)```
Transforms a normal vector `n`, and returns the result in `nr`. The reference position `r` is ignored since rigid transforms are position invariant. The transform is computed according to
``` nr = RF n
```
This method provides the low level implementation for normal transformations and does not do any saving or restoring of data.
Specified by:
`computeTransformNormal` in class `GeometryTransformer`
Parameters:
`nr` - transformed normal
`n` - normal to be transformed
`r` - reference position of the normal (ignored)
• #### computeTransform

```public void computeTransform(RigidTransform3d TR,
RigidTransform3d T)```
Transforms a rigid transform `T` and returns the result in `TR`. This provides the low level implementation for the transformation of rigid transforms and does not do any saving or restoring of data.
Parameters:
`TR` - transformed transform
`T` - transform to be transformed
• #### computeTransform

```public void computeTransform(AffineTransform3d XR,
AffineTransform3d X)```
Transforms an affine transform `X` and returns the result in `XR`. If
```      [ A   p ]
X =  [       ]
[ 0   1 ]
```
the transform is computed according to
```      [  RF A   RF p + pf ]
XR = [                   ]
[   0         1     ]
```
This method provides the low level implementation for the transformation of affine transforms and does not do any saving or restoring of data.
Specified by:
`computeTransform` in class `GeometryTransformer`
Parameters:
`XR` - transformed transform
`X` - transform to be transformed
• #### computeTransform

```public void computeTransform(RotationMatrix3d RR,
Vector3d Ndiag,
RotationMatrix3d R,
Vector3d r)```
Transforms a rotation matrix `R` and returns the result in `RR`. The reference position `r` is ignored since rigid transforms are position invariant. The transform is computed according to
``` RR = RF R
```
This method provides the low level implementation for the transformation of rotation matrices and does not do any saving or restoring of data.
Specified by:
`computeTransform` in class `GeometryTransformer`
Parameters:
`RR` - transformed rotation
`R` - rotation to be transformed
`r` - reference position of the rotation (ignored)
`Ndiag` - if non-null, returns the diagonal elements of the matrix `N`
• #### computeTransform

```public void computeTransform(Matrix3d MR,
Matrix3d M,
Vector3d r)```
Transforms a general 3 X 3 matrix `M`, and returns the result in `MR`. The reference position `r` is ignored since rigid transforms are position invariant. The transform is computed according to
``` MR = RF M
```
This method provides the low level implementation for the transformation of 3 X 3 matrices and does not do any saving or restoring of data.
Specified by:
`computeTransform` in class `GeometryTransformer`
Parameters:
`MR` - transformed matrix
`M` - matrix to be transformed
`r` - reference position of the matrix (ignored)
• #### computeTransform

```public void computeTransform(Plane pr,
Plane p,
Vector3d r)```
Transforms a plane `p` and returns the result in `pr`. The reference position `r` is ignored since rigid transforms are position invariant. Assume that `p` is defined by a normal `n` and offset `o` such that all planar points `x` satisfy
``` n^T x = o
```
Then the transformed normal `nr` and offset `or` are computed according to
``` nr = RF n
or = o + nr^T pf
```
This method provides the low level implementation for the transformation of planes and does not do any saving or restoring of data.
Specified by:
`computeTransform` in class `GeometryTransformer`
Parameters:
`pr` - transformed plane
`p` - plane to be transformed
`r` - reference position of the plane (ignored)