pythagoras.d

## Interface Transform

• All Known Implementing Classes:
AbstractTransform, AffineTransform, IdentityTransform

`public interface Transform`
Represents a geometric transform. Specialized implementations exist for identity, rigid body, uniform, non-uniform, and affine transforms.
• ### Method Summary

All Methods
Modifier and Type Method and Description
`Transform` `clone()`
Deprecated.
`Transform` `concatenate(Transform other)`
Returns a new transform comprised of the concatenation of `other` to this transform (i.e.
`Transform` `copy()`
Returns a copy of this transform.
`int` `generality()`
Returns an integer that increases monotonically with the generality of the transform implementation.
`void` `get(double[] matrix)`
Copies the affine transform matrix into the supplied array.
`Point` ```inverseTransform(IPoint p, Point into)```
Inverse transforms the supplied point, writing the result into `into`.
`Vector` ```inverseTransform(IVector v, Vector into)```
Inverse transforms the supplied vector, writing the result into `into`.
`Transform` `invert()`
Returns a new transform that represents the inverse of this transform.
`Transform` ```lerp(Transform other, double t)```
Returns a new transform comprised of the linear interpolation between this transform and the specified other.
`Transform` `preConcatenate(Transform other)`
Returns a new transform comprised of the concatenation of this transform to `other` (i.e.
`Transform` `rotate(double angle)`
Rotates this transform.
`double` `rotation()`
Returns the rotation applied by this transform.
`Vector` `scale()`
Returns the scale vector for this transform.
`Transform` ```scale(double scaleX, double scaleY)```
Scales this transform by the specified amount in the x and y dimensions.
`double` `scaleX()`
Returns the x-component of the scale applied by this transform.
`Transform` `scaleX(double scaleX)`
Scales this transform by the specified amount in the x dimension.
`double` `scaleY()`
Returns the y-component of the scale applied by this transform.
`Transform` `scaleY(double scaleY)`
Scales this transform by the specified amount in the y dimension.
`Transform` `setRotation(double angle)`
Sets the rotation component of this transform.
`Transform` ```setScale(double scaleX, double scaleY)```
Sets the x and y scale of this transform.
`Transform` `setScaleX(double scaleX)`
Sets the x scale of this transform.
`Transform` `setScaleY(double scaleY)`
Sets the y scale of this transform.
`Transform` ```setTransform(double m00, double m01, double m10, double m11, double tx, double ty)```
Sets the affine transform matrix.
`Transform` ```setTranslation(double tx, double ty)```
Sets the translation component of this transform.
`Transform` `setTx(double tx)`
Sets the x-component of this transform's translation.
`Transform` `setTy(double ty)`
Sets the y-component of this transform's translation.
`Transform` `setUniformScale(double scale)`
Sets the uniform scale of this transform.
`Transform` ```shear(double tx, double ty)```
Shears this transform.
`Transform` `shearX(double tx)`
Shears this transform in the x dimension.
`Transform` `shearY(double ty)`
Shears this transform in the y dimension.
`void` ```transform(double[] src, int srcOff, double[] dst, int dstOff, int count)```
Transforms the supplied points.
`void` ```transform(IPoint[] src, int srcOff, Point[] dst, int dstOff, int count)```
Transforms the supplied points.
`Point` ```transform(IPoint p, Point into)```
Transforms the supplied point, writing the result into `into`.
`Vector` ```transform(IVector v, Vector into)```
Transforms the supplied vector, writing the result into `into`.
`Vector` ```transformPoint(IVector v, Vector into)```
Transforms the supplied vector as a point (accounting for translation), writing the result into `into`.
`Transform` ```translate(double tx, double ty)```
Translates this transform.
`Transform` `translateX(double tx)`
Translates this transform in the x dimension.
`Transform` `translateY(double ty)`
Translates this transform in the y dimension.
`Vector` `translation()`
Returns the translation vector for this transform.
`double` `tx()`
Returns the x-coordinate of the translation component.
`double` `ty()`
Returns the y-coordinate of the translation component.
`double` `uniformScale()`
Returns the uniform scale applied by this transform.
`Transform` `uniformScale(double scale)`
Scales this transform in a uniform manner by the specified amount.
• ### Method Detail

• #### uniformScale

`double uniformScale()`
Returns the uniform scale applied by this transform. The uniform scale will be approximated for non-uniform transforms.
• #### scale

`Vector scale()`
Returns the scale vector for this transform.
• #### scaleX

`double scaleX()`
Returns the x-component of the scale applied by this transform. Note that this will be extracted and therefore approximate for affine transforms.
• #### scaleY

`double scaleY()`
Returns the y-component of the scale applied by this transform. Note that this will be extracted and therefore approximate for affine transforms.
• #### rotation

`double rotation()`
Returns the rotation applied by this transform. Note that the rotation is extracted and therefore approximate for affine transforms.
Throws:
`NoninvertibleTransformException` - if the transform is not invertible.
• #### translation

`Vector translation()`
Returns the translation vector for this transform.
• #### tx

`double tx()`
Returns the x-coordinate of the translation component.
• #### ty

`double ty()`
Returns the y-coordinate of the translation component.
• #### get

`void get(double[] matrix)`
Copies the affine transform matrix into the supplied array.
Parameters:
`matrix` - the array which receives `m00, m01, m10, m11, tx, ty`.
• #### setUniformScale

`Transform setUniformScale(double scale)`
Sets the uniform scale of this transform.
Returns:
this instance, for chaining.
Throws:
`IllegalArgumentException` - if the supplied scale is zero.
`UnsupportedOperationException` - if the transform is not uniform or greater.
• #### setScale

```Transform setScale(double scaleX,
double scaleY)```
Sets the x and y scale of this transform.
Returns:
this instance, for chaining.
Throws:
`IllegalArgumentException` - if either supplied scale is zero.
`UnsupportedOperationException` - if the transform is not non-uniform or greater.
• #### setScaleX

`Transform setScaleX(double scaleX)`
Sets the x scale of this transform.
Returns:
this instance, for chaining.
Throws:
`IllegalArgumentException` - if the supplied scale is zero.
`UnsupportedOperationException` - if the transform is not non-uniform or greater.
• #### setScaleY

`Transform setScaleY(double scaleY)`
Sets the y scale of this transform.
Returns:
this instance, for chaining.
Throws:
`IllegalArgumentException` - if the supplied scale is zero.
`UnsupportedOperationException` - if the transform is not non-uniform or greater.
• #### setRotation

`Transform setRotation(double angle)`
Sets the rotation component of this transform.
Returns:
this instance, for chaining.
Throws:
`UnsupportedOperationException` - if the transform is not rigid body or greater.
• #### setTranslation

```Transform setTranslation(double tx,
double ty)```
Sets the translation component of this transform.
Returns:
this instance, for chaining.
Throws:
`UnsupportedOperationException` - if the transform is not rigid body or greater.
• #### setTx

`Transform setTx(double tx)`
Sets the x-component of this transform's translation.
Returns:
this instance, for chaining.
Throws:
`UnsupportedOperationException` - if the transform is not rigid body or greater.
• #### setTy

`Transform setTy(double ty)`
Sets the y-component of this transform's translation.
Returns:
this instance, for chaining.
Throws:
`UnsupportedOperationException` - if the transform is not rigid body or greater.
• #### setTransform

```Transform setTransform(double m00,
double m01,
double m10,
double m11,
double tx,
double ty)```
Sets the affine transform matrix.
Returns:
this instance, for chaining.
Throws:
`UnsupportedOperationException` - if the transform is not affine or greater.
• #### uniformScale

`Transform uniformScale(double scale)`
Scales this transform in a uniform manner by the specified amount.
Returns:
this instance, for chaining.
Throws:
`IllegalArgumentException` - if the supplied scale is zero.
`UnsupportedOperationException` - if the transform is not uniform or greater.
• #### scale

```Transform scale(double scaleX,
double scaleY)```
Scales this transform by the specified amount in the x and y dimensions.
Returns:
this instance, for chaining.
Throws:
`IllegalArgumentException` - if either supplied scale is zero.
`UnsupportedOperationException` - if the transform is not non-uniform or greater.
• #### scaleX

`Transform scaleX(double scaleX)`
Scales this transform by the specified amount in the x dimension.
Returns:
this instance, for chaining.
Throws:
`IllegalArgumentException` - if the supplied scale is zero.
`UnsupportedOperationException` - if the transform is not non-uniform or greater.
• #### scaleY

`Transform scaleY(double scaleY)`
Scales this transform by the specified amount in the y dimension.
Returns:
this instance, for chaining.
Throws:
`IllegalArgumentException` - if the supplied scale is zero.
`UnsupportedOperationException` - if the transform is not non-uniform or greater.
• #### rotate

`Transform rotate(double angle)`
Rotates this transform.
Returns:
this instance, for chaining.
Throws:
`UnsupportedOperationException` - if the transform is not rigid body or greater.
• #### translate

```Transform translate(double tx,
double ty)```
Translates this transform.
Returns:
this instance, for chaining.
Throws:
`UnsupportedOperationException` - if the transform is not rigid body or greater.
• #### translateX

`Transform translateX(double tx)`
Translates this transform in the x dimension.
Returns:
this instance, for chaining.
Throws:
`UnsupportedOperationException` - if the transform is not rigid body or greater.
• #### translateY

`Transform translateY(double ty)`
Translates this transform in the y dimension.
Returns:
this instance, for chaining.
Throws:
`UnsupportedOperationException` - if the transform is not rigid body or greater.
• #### shear

```Transform shear(double tx,
double ty)```
Shears this transform.
Returns:
this instance, for chaining.
Throws:
`UnsupportedOperationException` - if the transform is not affine or greater.
• #### shearX

`Transform shearX(double tx)`
Shears this transform in the x dimension.
Returns:
this instance, for chaining.
Throws:
`UnsupportedOperationException` - if the transform is not affine or greater.
• #### shearY

`Transform shearY(double ty)`
Shears this transform in the y dimension.
Returns:
this instance, for chaining.
Throws:
`UnsupportedOperationException` - if the transform is not affine or greater.
• #### invert

`Transform invert()`
Returns a new transform that represents the inverse of this transform.
Throws:
`NoninvertibleTransformException` - if the transform is not invertible.
• #### concatenate

`Transform concatenate(Transform other)`
Returns a new transform comprised of the concatenation of `other` to this transform (i.e. `this x other`).
• #### preConcatenate

`Transform preConcatenate(Transform other)`
Returns a new transform comprised of the concatenation of this transform to `other` (i.e. `other x this`).
• #### lerp

```Transform lerp(Transform other,
double t)```
Returns a new transform comprised of the linear interpolation between this transform and the specified other.
• #### transform

```Point transform(IPoint p,
Point into)```
Transforms the supplied point, writing the result into `into`.
Parameters:
`into` - a point into which to store the result, may be the same object as `p`.
Returns:
`into` for chaining.
• #### transform

```void transform(IPoint[] src,
int srcOff,
Point[] dst,
int dstOff,
int count)```
Transforms the supplied points.
Parameters:
`src` - the points to be transformed.
`srcOff` - the offset into the `src` array at which to start.
`dst` - the points into which to store the transformed points. May be `src`.
`dstOff` - the offset into the `dst` array at which to start.
`count` - the number of points to transform.
• #### transform

```void transform(double[] src,
int srcOff,
double[] dst,
int dstOff,
int count)```
Transforms the supplied points.
Parameters:
`src` - the points to be transformed (as `[x, y, x, y, ...]`).
`srcOff` - the offset into the `src` array at which to start.
`dst` - the points into which to store the transformed points. May be `src`.
`dstOff` - the offset into the `dst` array at which to start.
`count` - the number of points to transform.
• #### inverseTransform

```Point inverseTransform(IPoint p,
Point into)```
Inverse transforms the supplied point, writing the result into `into`.
Parameters:
`into` - a point into which to store the result, may be the same object as `p`.
Returns:
`into`, for chaining.
Throws:
`NoninvertibleTransformException` - if the transform is not invertible.
• #### transformPoint

```Vector transformPoint(IVector v,
Vector into)```
Transforms the supplied vector as a point (accounting for translation), writing the result into `into`.
Parameters:
`into` - a vector into which to store the result, may be the same object as `v`.
Returns:
`into`, for chaining.
• #### transform

```Vector transform(IVector v,
Vector into)```
Transforms the supplied vector, writing the result into `into`.
Parameters:
`into` - a vector into which to store the result, may be the same object as `v`.
Returns:
`into`, for chaining.
• #### inverseTransform

```Vector inverseTransform(IVector v,
Vector into)```
Inverse transforms the supplied vector, writing the result into `into`.
Parameters:
`into` - a vector into which to store the result, may be the same object as `v`.
Returns:
`into`, for chaining.
Throws:
`NoninvertibleTransformException` - if the transform is not invertible.
• #### clone

```@Deprecated
Transform clone()```
Deprecated. Use `copy()`.
• #### copy

`Transform copy()`
Returns a copy of this transform.
• #### generality

`int generality()`
Returns an integer that increases monotonically with the generality of the transform implementation. Used internally when combining transforms.