public class Transform2 extends RealSquareMatrix
The basic stuff is all there - the user will do best to look at examples. NOTE; this has been hacked in a hurry from Transform3. Many of the internal routines are grossly overcomplicated. I'll clean it up some time.
| Modifier and Type | Class and Description |
|---|---|
static class |
Transform2.Type
type
|
cols, flmat, rowsC_AMP, C_APOS, C_ATSIGN, C_BACKSLASH, C_BACKSPACE, C_CARET, C_COLON, C_COMMA, C_DEL, C_DOLLAR, C_EQUALS, C_FORMFEED, C_HASH, C_LANGLE, C_LBRAK, C_LCURLY, C_LSQUARE, C_MINUS, C_NBSP, C_NEWLINE, C_NL, C_PERCENT, C_PERIOD, C_PIPE, C_PLUS, C_POUND, C_QUERY, C_QUOT, C_RANGLE, C_RBRAK, C_RCURLY, C_RETURN, C_RSQUARE, C_SEMICOLON, C_SHRIEK, C_SLASH, C_SPACE, C_STAR, C_TAB, C_TILDE, C_UNDER, EPS, F_S, NONWHITEPUNC, NONWHITEPUNC0, NONWHITEPUNC0REGEX, ONE_THIRD, PUNC, S_AMP, S_APOS, S_ATSIGN, S_BACKSLASH, S_CARET, S_COLON, S_COMMA, S_DOLLAR, S_EMPTY, S_EQUALS, S_FORMFEED, S_HASH, S_LANGLE, S_LBRAK, S_LCURLY, S_LSQUARE, S_MINUS, S_NEWLINE, S_NL, S_PERCENT, S_PERIOD, S_PIPE, S_PLUS, S_POUND, S_QUERY, S_QUOT, S_RANGLE, S_RBRAK, S_RCURLY, S_RETURN, S_RSQUARE, S_SEMICOLON, S_SHRIEK, S_SLASH, S_SPACE, S_STAR, S_TAB, S_TILDE, S_UNDER, S_WHITEREGEX, TWO_THIRDS, U_S, WHITESPACE| Constructor and Description |
|---|
Transform2()
default is a unit matrix
|
Transform2(AffineTransform at) |
Transform2(Angle zrot)
clockwise rotation about z- axis
|
Transform2(double[] array)
construct from an array.
|
Transform2(Real2 v1,
Real2 v2)
from 2 vector components - NOT checked for validity
|
Transform2(Real2 originIn,
Real2 dimensionIn,
Real2 originOut,
Real2 dimensionOut,
boolean keepAspectRatio)
graphics transform (transforms between rectangular coordinates
("windows") originIn maps onto originOut and dimensionIn (width, height)
onto dimensionOut.
|
Transform2(RealSquareMatrix m)
from a 2x2 or 3x3 matrix
|
Transform2(RealSquareMatrix m,
Vector2 v)
from a 2x2 rotation matrix and a translation vector
|
Transform2(Transform2.Type t)
This gives a default unit matrix of type t (default ROT_ORIG)
|
Transform2(Transform2 m)
copy constructors - assumed to be an OK matrix.
|
Transform2(Transform2 t,
Real2 p)
from rotation about a point, given a matrix NOT CHECKED
|
Transform2(Vector2 v)
identity matrix with translation component
|
Transform2(Vector2 v1,
Vector2 v2)
rotation of one vector onto another
|
Transform2(Window2 in,
Window2 out,
boolean keepAspectRatio)
Carries out graphics transform
transforms between rectangular coordinates.
|
| Modifier and Type | Method and Description |
|---|---|
static Transform2 |
applyScale(double scale)
apply scale to each axis
|
static Transform2 |
applyScales(double scaleX,
double scaleY)
Deprecated.
use createScaleTransform
|
void |
applyScalesToThis(double scaleX,
double scaleY) |
Transform2.Type |
calculateMatrixType()
get new matrix type
|
Transform2 |
clone(Transform2 m)
clone
|
Transform2 |
concatenate(Transform2 m2)
concatenate
|
static Transform2 |
createScaleTransform(double scaleX,
double scaleY)
create diagonal scale matrix.
|
static Transform2 |
flipAboutVector(Real2 r)
get Transformation to mirror ('flip') across an axis NOT YET CHECKED
|
AffineTransform |
getAffineTransform()
at.getMatrix(dd);
flmat[0][0] = dd[0];
flmat[0][1] = dd[2];
flmat[0][2] = dd[4];
flmat[1][0] = dd[1];
flmat[1][1] = dd[3];
flmat[1][2] = dd[5];
|
Angle |
getAngleOfRotation()
interpret current matrix as rotation about axis NOT YET CHECKED;
assume combined rotation and Xskew
and isotropic scale
(cos -sin) * (1 d) // d is tan(skew angle)
(sin cos) (0 1)
gives
(cos d.cos-sin)
(sin d.sin+cos)
|
Angle |
getAngleOfRotationNew()
interpret current matrix as rotation about axis NOT YET CHECKED;
assume combined rotation and Xskew
and isotropic scale
(cos -sin) * (1 tand) // d is tan(skew angle)
(sin cos) (0 1)
gives
(cos tand.cos-sin)
(sin tand.sin+cos)
|
Angle |
getAngleOfSkew(double eps)
interpret current matrix as rotation about axis NOT YET CHECKED;
assume combined rotation and Xskew
and isotropic scale
(cos -sin) * (1 tand) // d is tan(skew angle)
(sin cos) (0 1)
gives
(cos tand.cos-sin)
(sin tand.sin+cos)
|
static Transform2 |
getRotationAboutPoint(Angle angle,
Real2 point)
rotate about a point.
|
RealSquareMatrix |
getRotationMatrix()
get Unitary matrix (that is eliminate scales and translation)
|
RealArray |
getScales()
get scales (as a 2-element RealArray)
|
Transform2.Type |
getTransformationType()
get transformation type
|
static Transform2 |
getTransformToRotateAndStretchLine(Real2 pivotPoint,
Real2 movingPoint,
Real2 targetPoint)
transform describing the rotation and stretching of a line.
|
Real2 |
getTranslation()
get translation component only
|
static Transform2 |
getTranslationTransform(Real2 translation) |
boolean |
isEqualTo(Transform2 m)
Description of the Method
|
Transform2 |
removeTranslations()
remove translations
does to alter this
|
int |
setTransformationType(Transform2.Type option)
set transformation type may attempt to orthonomalise if type includes a
rotation
|
void |
setTranslation(Real2 xy)
get translation component only
|
String |
toString()
Description of the Method
|
calculateEigenvalues, calculateEigenvectors, calculateInverse, copyLowerToUpper, copyUpperToLower, determinant, diagonal, diagonaliseAndReturnRank, fromLowerTriangle, fromUpperTriangle, getCrystallographicOrthogonalisation, getInverse, isEqualTo, isImproperRotation, isLowerTriangular, isOrthogonal, isOrthonormal, isSymmetric, isUnit, isUnitary, isUpperTriangular, lowerTriangle, multiply, orthogonalise, orthonormalize, outerProduct, plus, resetEigenDecomposition, shallowCopy, subtract, trace, transposeappendColumnData, appendColumnData, appendRowData, appendRowData, checkNonEmptyMatrix, clearMatrix, columnwiseDivide, createMatrixWithOriginShifted, deleteColumn, deleteColumns, deleteRow, deleteRows, elementAt, elementAt, elementsInRange, euclideanColumnLength, euclideanColumnLengths, euclideanRowLength, euclideanRowLengths, extractColumnData, extractColumns, extractRowData, extractRows, extractSubMatrixData, format, getCols, getFormat, getIntMatrix, getMatrix, getMatrixAsArray, getRows, getTranspose, indexOfLargestElement, indexOfLargestElementInColumn, indexOfLargestElementInRow, indexOfSmallestElement, indexOfSmallestElementInColumn, indexOfSmallestElementInRow, insertColumnData, insertColumnData, insertRowData, insertRowData, insertRows, isEqualTo, isSquare, isZero, largestElement, largestElementInColumn, largestElementInRow, makeSpaceForNewColumns, multiply, multiply, multiplyBy, multiplyEquals, negative, normaliseByColumns, normaliseByRows, plus, reorderColumnsBy, reorderRowsBy, replaceColumnData, replaceColumnData, replaceColumnData, replaceRowData, replaceRowData, replaceRowData, replaceSubMatrixData, scaleAndInterpolate, setAllElements, setElementAt, setFormat, shallowCopy, smallestElement, smallestElementInColumn, smallestElementInRow, subtract, translateByColumn, writeXMLpublic Transform2()
public Transform2(Transform2.Type t)
t - Description of the Parameterpublic Transform2(Vector2 v)
v - amount to translate bypublic Transform2(AffineTransform at)
public Transform2(Angle zrot)
zrot - radians clockwise rotationpublic Transform2(Transform2 t, Real2 p)
t - Description of the Parameterp - Description of the Parameterpublic Transform2(Vector2 v1, Vector2 v2) throws EuclidRuntimeException
v1 - Description of the Parameterv2 - Description of the ParameterEuclidRuntimeException - v1 or v2 is zero lengthpublic Transform2(Real2 v1, Real2 v2)
v1 - Description of the Parameterv2 - Description of the Parameterpublic Transform2(double[] array)
throws EuclidRuntimeException
array - to create the Transform fromEuclidRuntimeException - array must have 9 elementspublic Transform2(Transform2 m)
m - the transform to copypublic Transform2(RealSquareMatrix m) throws EuclidRuntimeException
m - Description of the ParameterEuclidRuntimeException - m must be 2*2 or 3*3public Transform2(RealSquareMatrix m, Vector2 v) throws EuclidRuntimeException
m - Description of the Parameterv - Description of the ParameterEuclidRuntimeException - m must be 2*2public Transform2(Window2 in, Window2 out, boolean keepAspectRatio) throws ArithmeticException
Real2 inputDim = new Real2(2.7, 20000); Real2 outputDim = new Real2(-300, 300);
in - Description of the Parameterout - Description of the ParameterkeepAspectRatio - Description of the ParameterArithmeticExceptionpublic Transform2(Real2 originIn, Real2 dimensionIn, Real2 originOut, Real2 dimensionOut, boolean keepAspectRatio) throws ArithmeticException
Real2 inputDim = new Real2(2.7, 20000); Real2 outputDim = new Real2(-300, 300);
originIn - Description of the ParameterdimensionIn - Description of the ParameteroriginOut - Description of the ParameterdimensionOut - Description of the ParameterkeepAspectRatio - Description of the ParameterArithmeticExceptionpublic Transform2 clone(Transform2 m)
m - Description of the Parameterpublic static Transform2 getTranslationTransform(Real2 translation)
public boolean isEqualTo(Transform2 m)
m - Description of the Parameterpublic static Transform2 getRotationAboutPoint(Angle angle, Real2 point)
angle - point - public static Transform2 applyScales(double scaleX, double scaleY)
scaleX - scaleY - public static Transform2 createScaleTransform(double scaleX, double scaleY)
scaleX - scaleY - public static Transform2 applyScale(double scale)
scale - public void applyScalesToThis(double scaleX,
double scaleY)
public Transform2 concatenate(Transform2 m2)
m2 - postmultiplies thispublic int setTransformationType(Transform2.Type option)
option - The new transformationType valuepublic Transform2.Type getTransformationType()
public Transform2.Type calculateMatrixType()
public Angle getAngleOfRotation()
public Angle getAngleOfRotationNew()
public Angle getAngleOfSkew(double eps)
public static Transform2 flipAboutVector(Real2 r) throws EuclidRuntimeException
r - Description of the ParameterEuclidRuntimeExceptionpublic Real2 getTranslation()
public void setTranslation(Real2 xy)
xy - public RealArray getScales()
public RealSquareMatrix getRotationMatrix()
public Transform2 removeTranslations()
public static Transform2 getTransformToRotateAndStretchLine(Real2 pivotPoint, Real2 movingPoint, Real2 targetPoint)
pivotPoint - movingPoint - targetPoint - point to translate movingAtom topublic String toString()
toString in class RealMatrixpublic AffineTransform getAffineTransform()
Copyright © 1994–2024 Peter Murray-Rust. All rights reserved.