pythagoras.f

## 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(float[] 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, float 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(float angle)`
Rotates this transform.
`float` `rotation()`
Returns the rotation applied by this transform.
`Vector` `scale()`
Returns the scale vector for this transform.
`Transform` ```scale(float scaleX, float scaleY)```
Scales this transform by the specified amount in the x and y dimensions.
`float` `scaleX()`
Returns the x-component of the scale applied by this transform.
`Transform` `scaleX(float scaleX)`
Scales this transform by the specified amount in the x dimension.
`float` `scaleY()`
Returns the y-component of the scale applied by this transform.
`Transform` `scaleY(float scaleY)`
Scales this transform by the specified amount in the y dimension.
`Transform` `setRotation(float angle)`
Sets the rotation component of this transform.
`Transform` ```setScale(float scaleX, float scaleY)```
Sets the x and y scale of this transform.
`Transform` `setScaleX(float scaleX)`
Sets the x scale of this transform.
`Transform` `setScaleY(float scaleY)`
Sets the y scale of this transform.
`Transform` ```setTransform(float m00, float m01, float m10, float m11, float tx, float ty)```
Sets the affine transform matrix.
`Transform` ```setTranslation(float tx, float ty)```
Sets the translation component of this transform.
`Transform` `setTx(float tx)`
Sets the x-component of this transform's translation.
`Transform` `setTy(float ty)`
Sets the y-component of this transform's translation.
`Transform` `setUniformScale(float scale)`
Sets the uniform scale of this transform.
`Transform` ```shear(float tx, float ty)```
Shears this transform.
`Transform` `shearX(float tx)`
Shears this transform in the x dimension.
`Transform` `shearY(float ty)`
Shears this transform in the y dimension.
`void` ```transform(float[] src, int srcOff, float[] 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(float tx, float ty)```
Translates this transform.
`Transform` `translateX(float tx)`
Translates this transform in the x dimension.
`Transform` `translateY(float ty)`
Translates this transform in the y dimension.
`Vector` `translation()`
Returns the translation vector for this transform.
`float` `tx()`
Returns the x-coordinate of the translation component.
`float` `ty()`
Returns the y-coordinate of the translation component.
`float` `uniformScale()`
Returns the uniform scale applied by this transform.
`Transform` `uniformScale(float scale)`
Scales this transform in a uniform manner by the specified amount.
• ### Method Detail

• #### uniformScale

`float 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

`float 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

`float 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

`float 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

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

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

`void get(float[] 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(float 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(float scaleX,
float 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(float 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(float 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(float 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(float tx,
float 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(float 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(float 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(float m00,
float m01,
float m10,
float m11,
float tx,
float ty)```
Sets the affine transform matrix.
Returns:
this instance, for chaining.
Throws:
`UnsupportedOperationException` - if the transform is not affine or greater.
• #### uniformScale

`Transform uniformScale(float 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(float scaleX,
float 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(float 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(float 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(float angle)`
Rotates this transform.
Returns:
this instance, for chaining.
Throws:
`UnsupportedOperationException` - if the transform is not rigid body or greater.
• #### translate

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

`Transform translateX(float 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(float 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(float tx,
float ty)```
Shears this transform.
Returns:
this instance, for chaining.
Throws:
`UnsupportedOperationException` - if the transform is not affine or greater.
• #### shearX

`Transform shearX(float 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(float 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,
float 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(float[] src,
int srcOff,
float[] 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.