atst.base.util

## Class LinearTransform

• java.lang.Object
• atst.base.util.LinearTransform

• ```public class LinearTransform
extends java.lang.Object```
This class implements a linear transform from one 2-d frame to another The transform is defined as X = coeff + x * coeff + y * coeff Y = coeff + x * coeff + y * coeff
• ### Constructor Summary

Constructors
Constructor and Description
`LinearTransform()`
Create a new transform as an identity
`LinearTransform(double[] array)`
Create a transform from an array of doubles.
`LinearTransform(java.lang.Double[] array)`
Create a transform from an array of Doubles.
• ### Method Summary

All Methods
Modifier and Type Method and Description
`double[]` ```evaluate(double x, double y)```
Evaluate the result of applying the transform to a position x, y
`LinearTransform` `extend(LinearTransform t)`
Given a linear transform, extend it by another linear transform.
`double[]` `getCoeffs()`
Return the coefficients of the linear transform as a 1-D array
`double` `getNonperp()`
Return the angle representing the non-perpendicularity of the input and output coordinates
`double` `getOrientation()`
Return the orientation (degs) represented by the transform
`double` `getXscale()`
Return the x scale factor represented by the transform
`double` `getYscale()`
Return the yscale factor represented by the transform
`LinearTransform` `invert()`
Invert a linear transform.
`LinearTransform` `rotate(java.lang.Double angle)`
Rotate the linear transform by the given angle.
`LinearTransform` `scale(double scale)`
Scale the transform by a supplied scale factor
• ### Methods inherited from class java.lang.Object

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

• #### LinearTransform

`public LinearTransform()`
Create a new transform as an identity
• #### LinearTransform

`public LinearTransform(java.lang.Double[] array)`
Create a transform from an array of Doubles. The array should be of length 6. If more elements are provided they are ignored. If fewer than 6 are provided then the results of operations on the transform will be undefined in some cases. If a null array is provided then an identity transform is returned as if you had called LinearTransform()
Parameters:
`array` - - array of 6 linear transform
• #### LinearTransform

`public LinearTransform(double[] array)`
Create a transform from an array of doubles. The array should be of length 6. If more elements are provided they are ignored. If fewer than 6 are provided then the results of operations on the transform will be undefined in some cases.
Parameters:
`array` - - array of 6 linear transform
• ### Method Detail

• #### extend

`public LinearTransform extend(LinearTransform t)`
Given a linear transform, extend it by another linear transform. The resultant transform will be the same as if first the given transform was applied and then the other one. If the transform to extend by is null then the returned transform is the same as the original
Parameters:
`t` - - a linear transform to apply to this transform
Returns:
- the extended linear transform
• #### rotate

`public LinearTransform rotate(java.lang.Double angle)`
Rotate the linear transform by the given angle. If the angle is null then do nothing
Parameters:
`angle` - - angle to rotate by (degs)
Returns:
- rotated transform
• #### invert

`public LinearTransform invert()`
Invert a linear transform. The result of applying a transform and its inverse to a point will be to leave the point unchanged. The there is no inverse then the original transform is returned.
Returns:
- the inverse transform
• #### scale

`public LinearTransform scale(double scale)`
Scale the transform by a supplied scale factor
Parameters:
`scale` - - scale factor to be applied to the transform
Returns:
- scaled transform
• #### evaluate

```public double[] evaluate(double x,
double y)```
Evaluate the result of applying the transform to a position x, y
Parameters:
`x` - - the x coordinate to which the transformation should be applied
`y` - - the y coordinate to which the transformation should be applied
Returns:
- the transformed 2-d position
• #### getXscale

`public double getXscale()`
Return the x scale factor represented by the transform
Returns:
- the scaling factor in x
• #### getYscale

`public double getYscale()`
Return the yscale factor represented by the transform
Returns:
- the scaling factor in y
• #### getOrientation

`public double getOrientation()`
Return the orientation (degs) represented by the transform
Returns:
the orientation of the input frame to the output frame (degs)
• #### getNonperp

`public double getNonperp()`
Return the angle representing the non-perpendicularity of the input and output coordinates
Returns:
- the non-perpendicularity (degs)
• #### getCoeffs

`public double[] getCoeffs()`
Return the coefficients of the linear transform as a 1-D array
Returns:
- coefficients of the linear transform