pythagoras.f

## Class AffineTransform

• All Implemented Interfaces:
Transform

```public class AffineTransform
extends AbstractTransform```
Implements an affine (3x2 matrix) transform. The transformation matrix has the form:
``````
[ m00, m10, tx ]
[ m01, m11, ty ]
[   0,   0,  1 ]
``````
• ### Field Summary

Fields
Modifier and Type Field and Description
`static int` `GENERALITY`
Identifies the affine transform in `generality()`.
`float` `m00`
The scale, rotation and shear components of this transform.
`float` `m01`
The scale, rotation and shear components of this transform.
`float` `m10`
The scale, rotation and shear components of this transform.
`float` `m11`
The scale, rotation and shear components of this transform.
`float` `tx`
The translation components of this transform.
`float` `ty`
The translation components of this transform.
• ### Constructor Summary

Constructors
Constructor and Description
`AffineTransform()`
Creates an affine transform configured with the identity transform.
```AffineTransform(float scale, float angle, float tx, float ty)```
Creates an affine transform from the supplied scale, rotation and translation.
```AffineTransform(float scaleX, float scaleY, float angle, float tx, float ty)```
Creates an affine transform from the supplied scale, rotation and translation.
```AffineTransform(float m00, float m01, float m10, float m11, float tx, float ty)```
Creates an affine transform with the specified transform matrix.
• ### Method Summary

All Methods
Modifier and Type Method and Description
`Transform` `concatenate(Transform other)`
Returns a new transform comprised of the concatenation of `other` to this transform (i.e.
`AffineTransform` `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`.
`AffineTransform` `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.
`AffineTransform` `rotate(float angle)`
Rotates this transform.
`float` `rotation()`
Returns the rotation applied by this transform.
`AffineTransform` ```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.
`AffineTransform` `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.
`AffineTransform` `scaleY(float scaleY)`
Scales this transform by the specified amount in the y dimension.
`AffineTransform` `set(AffineTransform other)`
Sets this affine transform matrix to `other`.
`AffineTransform` `setRotation(float angle)`
Sets the rotation component of this transform.
`AffineTransform` `setScaleX(float scaleX)`
Sets the x scale of this transform.
`AffineTransform` `setScaleY(float scaleY)`
Sets the y scale of this transform.
`AffineTransform` ```setTransform(float m00, float m01, float m10, float m11, float tx, float ty)```
Sets the affine transform matrix.
`AffineTransform` ```setTranslation(float tx, float ty)```
Sets the translation component of this transform.
`AffineTransform` `setTx(float tx)`
Sets the x-component of this transform's translation.
`AffineTransform` `setTy(float ty)`
Sets the y-component of this transform's translation.
`AffineTransform` `setUniformScale(float scale)`
Sets the uniform scale of this transform.
`AffineTransform` ```shear(float sx, float sy)```
Shears this transform.
`AffineTransform` `shearX(float sx)`
Shears this transform in the x dimension.
`AffineTransform` `shearY(float sy)`
Shears this transform in the y dimension.
`String` `toString()`
`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`.
`AffineTransform` ```translate(float tx, float ty)```
Translates this transform.
`AffineTransform` `translateX(float tx)`
Translates this transform in the x dimension.
`AffineTransform` `translateY(float ty)`
Translates this transform in the y dimension.
`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.
`AffineTransform` `uniformScale(float scale)`
Scales this transform in a uniform manner by the specified amount.
• ### Methods inherited from class pythagoras.f.AbstractTransform

`clone, scale, setScale, translation`
• ### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`
• ### Field Detail

• #### m00

`public float m00`
The scale, rotation and shear components of this transform.
• #### m01

`public float m01`
The scale, rotation and shear components of this transform.
• #### m10

`public float m10`
The scale, rotation and shear components of this transform.
• #### m11

`public float m11`
The scale, rotation and shear components of this transform.
• #### tx

`public float tx`
The translation components of this transform.
• #### ty

`public float ty`
The translation components of this transform.
• ### Constructor Detail

• #### AffineTransform

`public AffineTransform()`
Creates an affine transform configured with the identity transform.
• #### AffineTransform

```public AffineTransform(float scale,
float angle,
float tx,
float ty)```
Creates an affine transform from the supplied scale, rotation and translation.
• #### AffineTransform

```public AffineTransform(float scaleX,
float scaleY,
float angle,
float tx,
float ty)```
Creates an affine transform from the supplied scale, rotation and translation.
• #### AffineTransform

```public AffineTransform(float m00,
float m01,
float m10,
float m11,
float tx,
float ty)```
Creates an affine transform with the specified transform matrix.
• ### Method Detail

• #### set

`public AffineTransform set(AffineTransform other)`
Sets this affine transform matrix to `other`.
Returns:
this instance, for chaining.
• #### uniformScale

`public float uniformScale()`
Description copied from interface: `Transform`
Returns the uniform scale applied by this transform. The uniform scale will be approximated for non-uniform transforms.
• #### scaleX

`public float scaleX()`
Description copied from interface: `Transform`
Returns the x-component of the scale applied by this transform. Note that this will be extracted and therefore approximate for affine transforms.
• #### scaleY

`public float scaleY()`
Description copied from interface: `Transform`
Returns the y-component of the scale applied by this transform. Note that this will be extracted and therefore approximate for affine transforms.
• #### rotation

`public float rotation()`
Description copied from interface: `Transform`
Returns the rotation applied by this transform. Note that the rotation is extracted and therefore approximate for affine transforms.
• #### tx

`public float tx()`
Description copied from interface: `Transform`
Returns the x-coordinate of the translation component.
• #### ty

`public float ty()`
Description copied from interface: `Transform`
Returns the y-coordinate of the translation component.
• #### get

`public void get(float[] matrix)`
Description copied from interface: `Transform`
Copies the affine transform matrix into the supplied array.
Parameters:
`matrix` - the array which receives `m00, m01, m10, m11, tx, ty`.
• #### setUniformScale

`public AffineTransform setUniformScale(float scale)`
Description copied from interface: `Transform`
Sets the uniform scale of this transform.
Specified by:
`setUniformScale` in interface `Transform`
Overrides:
`setUniformScale` in class `AbstractTransform`
Returns:
this instance, for chaining.
• #### setScaleX

`public AffineTransform setScaleX(float scaleX)`
Description copied from interface: `Transform`
Sets the x scale of this transform.
Specified by:
`setScaleX` in interface `Transform`
Overrides:
`setScaleX` in class `AbstractTransform`
Returns:
this instance, for chaining.
• #### setScaleY

`public AffineTransform setScaleY(float scaleY)`
Description copied from interface: `Transform`
Sets the y scale of this transform.
Specified by:
`setScaleY` in interface `Transform`
Overrides:
`setScaleY` in class `AbstractTransform`
Returns:
this instance, for chaining.
• #### setRotation

`public AffineTransform setRotation(float angle)`
Description copied from interface: `Transform`
Sets the rotation component of this transform.
Specified by:
`setRotation` in interface `Transform`
Overrides:
`setRotation` in class `AbstractTransform`
Returns:
this instance, for chaining.
• #### setTranslation

```public AffineTransform setTranslation(float tx,
float ty)```
Description copied from interface: `Transform`
Sets the translation component of this transform.
Specified by:
`setTranslation` in interface `Transform`
Overrides:
`setTranslation` in class `AbstractTransform`
Returns:
this instance, for chaining.
• #### setTx

`public AffineTransform setTx(float tx)`
Description copied from interface: `Transform`
Sets the x-component of this transform's translation.
Specified by:
`setTx` in interface `Transform`
Overrides:
`setTx` in class `AbstractTransform`
Returns:
this instance, for chaining.
• #### setTy

`public AffineTransform setTy(float ty)`
Description copied from interface: `Transform`
Sets the y-component of this transform's translation.
Specified by:
`setTy` in interface `Transform`
Overrides:
`setTy` in class `AbstractTransform`
Returns:
this instance, for chaining.
• #### setTransform

```public AffineTransform setTransform(float m00,
float m01,
float m10,
float m11,
float tx,
float ty)```
Description copied from interface: `Transform`
Sets the affine transform matrix.
Specified by:
`setTransform` in interface `Transform`
Overrides:
`setTransform` in class `AbstractTransform`
Returns:
this instance, for chaining.
• #### uniformScale

`public AffineTransform uniformScale(float scale)`
Description copied from interface: `Transform`
Scales this transform in a uniform manner by the specified amount.
Specified by:
`uniformScale` in interface `Transform`
Overrides:
`uniformScale` in class `AbstractTransform`
Returns:
this instance, for chaining.
• #### scale

```public AffineTransform scale(float scaleX,
float scaleY)```
Description copied from interface: `Transform`
Scales this transform by the specified amount in the x and y dimensions.
Specified by:
`scale` in interface `Transform`
Overrides:
`scale` in class `AbstractTransform`
Returns:
this instance, for chaining.
• #### scaleX

`public AffineTransform scaleX(float scaleX)`
Description copied from interface: `Transform`
Scales this transform by the specified amount in the x dimension.
Specified by:
`scaleX` in interface `Transform`
Overrides:
`scaleX` in class `AbstractTransform`
Returns:
this instance, for chaining.
• #### scaleY

`public AffineTransform scaleY(float scaleY)`
Description copied from interface: `Transform`
Scales this transform by the specified amount in the y dimension.
Specified by:
`scaleY` in interface `Transform`
Overrides:
`scaleY` in class `AbstractTransform`
Returns:
this instance, for chaining.
• #### rotate

`public AffineTransform rotate(float angle)`
Description copied from interface: `Transform`
Rotates this transform.
Specified by:
`rotate` in interface `Transform`
Overrides:
`rotate` in class `AbstractTransform`
Returns:
this instance, for chaining.
• #### translate

```public AffineTransform translate(float tx,
float ty)```
Description copied from interface: `Transform`
Translates this transform.
Specified by:
`translate` in interface `Transform`
Overrides:
`translate` in class `AbstractTransform`
Returns:
this instance, for chaining.
• #### translateX

`public AffineTransform translateX(float tx)`
Description copied from interface: `Transform`
Translates this transform in the x dimension.
Specified by:
`translateX` in interface `Transform`
Overrides:
`translateX` in class `AbstractTransform`
Returns:
this instance, for chaining.
• #### translateY

`public AffineTransform translateY(float ty)`
Description copied from interface: `Transform`
Translates this transform in the y dimension.
Specified by:
`translateY` in interface `Transform`
Overrides:
`translateY` in class `AbstractTransform`
Returns:
this instance, for chaining.
• #### shear

```public AffineTransform shear(float sx,
float sy)```
Description copied from interface: `Transform`
Shears this transform.
Specified by:
`shear` in interface `Transform`
Overrides:
`shear` in class `AbstractTransform`
Returns:
this instance, for chaining.
• #### shearX

`public AffineTransform shearX(float sx)`
Description copied from interface: `Transform`
Shears this transform in the x dimension.
Specified by:
`shearX` in interface `Transform`
Overrides:
`shearX` in class `AbstractTransform`
Returns:
this instance, for chaining.
• #### shearY

`public AffineTransform shearY(float sy)`
Description copied from interface: `Transform`
Shears this transform in the y dimension.
Specified by:
`shearY` in interface `Transform`
Overrides:
`shearY` in class `AbstractTransform`
Returns:
this instance, for chaining.
• #### invert

`public AffineTransform invert()`
Description copied from interface: `Transform`
Returns a new transform that represents the inverse of this transform.
• #### concatenate

`public Transform concatenate(Transform other)`
Description copied from interface: `Transform`
Returns a new transform comprised of the concatenation of `other` to this transform (i.e. `this x other`).
• #### preConcatenate

`public Transform preConcatenate(Transform other)`
Description copied from interface: `Transform`
Returns a new transform comprised of the concatenation of this transform to `other` (i.e. `other x this`).
• #### lerp

```public Transform lerp(Transform other,
float t)```
Description copied from interface: `Transform`
Returns a new transform comprised of the linear interpolation between this transform and the specified other.
• #### transform

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

```public void transform(IPoint[] src,
int srcOff,
Point[] dst,
int dstOff,
int count)```
Description copied from interface: `Transform`
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

```public void transform(float[] src,
int srcOff,
float[] dst,
int dstOff,
int count)```
Description copied from interface: `Transform`
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

```public Point inverseTransform(IPoint p,
Point into)```
Description copied from interface: `Transform`
Inverse transforms the supplied point, writing the result into `into`.
`into` - a point into which to store the result, may be the same object as `p`.
Returns:
`into`, for chaining.
• #### transformPoint

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

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

```public Vector inverseTransform(IVector v,
Vector into)```
Description copied from interface: `Transform`
Inverse transforms the supplied vector, writing the result into `into`.
`into` - a vector into which to store the result, may be the same object as `v`.
Returns:
`into`, for chaining.
• #### copy

`public AffineTransform copy()`
Description copied from interface: `Transform`
Returns a copy of this transform.
Specified by:
`copy` in interface `Transform`
Specified by:
`copy` in class `AbstractTransform`
• #### generality

`public int generality()`
Description copied from interface: `Transform`
Returns an integer that increases monotonically with the generality of the transform implementation. Used internally when combining transforms.
• #### toString

`public String toString()`
Overrides:
`toString` in class `Object`