Package org.cip4.jdflib.datatypes
Class JDFMatrix
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<Object>,Collection<Object>,List<Object>,RandomAccess,JDFBaseDataTypes
This class represents a transformation matrix consisting of 6 transformation values a, b, c, d, tx, ty all values are double values. The matrix looks like:
[ x'] [ a b tx ] [ x ] [ m00x + m01y + m02 ] [ y'] = [ c d ty ] [ y ] = [ m10x + m11y + m12 ] [ 1 ] [ 0 0 1 ] [ 1 ] [ 1 ]
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.cip4.jdflib.datatypes.JDFNumList
JDFNumList.NormComparator, JDFNumList.VolumeComparatorNested classes/interfaces inherited from interface org.cip4.jdflib.datatypes.JDFBaseDataTypes
JDFBaseDataTypes.EnumFitsValue -
Field Summary
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementDataFields inherited from class java.util.AbstractList
modCountFields inherited from interface org.cip4.jdflib.datatypes.JDFBaseDataTypes
EPSILON, MAX_CMYK_COLOR, MAX_LAB_COLOR, MAX_MATRIX_DIMENSION, MAX_RECTANGLE_DIMENSION, MAX_RGB_COLOR, MAX_SHAPE_DIMENSION, MAX_XY_DIMENSION -
Constructor Summary
ConstructorsConstructorDescriptionconstructs a matrix with all values set to 0.0 DoubleJDFMatrix(double degrees, double x, double y) constructs a matrix with all values set via arotation and a shiftJDFMatrix(double a, double b, double c, double d, double tx, double ty) constructs a new JDFMatrix with the given double valuesconstructs a matrix with all values set via a StringDeprecated.use typesafe constructorsJDFMatrix(JDFElement.EnumOrientation orientation, double w, double h) constructs a matrix with all values set via an enumerated orientationcopy constructorJDFMatrix(JDFNumList nl) constructs a rectangle with all values set via a JDFNumberListJDFMatrix(JDFRectangle rect) constructs a rectangle with all values set via a JDFNumberList -
Method Summary
Modifier and TypeMethodDescriptionclone()concatinates this with mstatic JDFMatrixfactory for JDFXYPair that silently returns null in case of illegal stringsbooleanequals - returns true if both JDFMatrices are equal, otherwise falsedoublegetA()getA - returns the first coordinategetAffineTransform -doublegetAngle()doublegetB()getB - returns the second coordinatedoublegetC()getC - returns the third coordinatedoublegetD()getD - returns the fourth coordinategetShift()doublegetTx()getTx - returns the tx coordinatedoublegetTy()getTy - returns the ty coordinatestatic JDFMatrixinthashCode()hashCode complements equals() to fulfill the equals/hashCode contractinvert()inverts thisbooleanisFlip()booleanisValid()isValid - true if the size of the vector is 6 and all instances are Double typesrotate(double degrees) rotate this by degrees degrees CouterClockwisevoidsetA(double p_a) setA - sets the first coordinatevoidsetAffineTransform(AffineTransform affineTrans) setAffineTransform -voidsetB(double p_b) setB - sets the second coordinatevoidsetC(double p_c) setC - sets the third coordinatevoidsetD(double p_d) setD - sets the fourth coordinateshift this matrix by an xypairvoidsetTx(double p_tx) setTx - sets the tx coordinatevoidsetTy(double p_ty) setTy - sets the ty coordinateshift(double tx, double ty) shifts Tx and Ty by the amount specifiedshift this matrix by an xypairtransform(JDFRectangle jdfRectangle) applies this to a pointMethods inherited from class org.cip4.jdflib.datatypes.JDFNumList
abs, contains, containsAll, copyNumList, doubleAt, elementAt, getDouble, getDoubleList, getDoubleVector, getIntArray, getString, getString, intAt, isValidString, matches, max, min, norm, removeElementAt, replaceElementAt, scale, scale, scaleFromCM, scaleFromCM, scaleFromMM, scaleFromMM, scaleToCM, scaleToCM, scaleToMM, scaleToMM, set, setString, setX, shift, sort, subtract, toString, unify, volumeMethods inherited from class java.util.Vector
add, add, addAll, addAll, addElement, capacity, clear, contains, containsAll, copyInto, elements, ensureCapacity, firstElement, forEach, get, indexOf, indexOf, insertElementAt, isEmpty, iterator, lastElement, lastIndexOf, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeAllElements, removeElement, removeIf, removeRange, replaceAll, retainAll, set, setElementAt, setSize, size, sort, spliterator, subList, toArray, toArray, trimToSizeMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, stream, toArray
-
Constructor Details
-
JDFMatrix
public JDFMatrix()constructs a matrix with all values set to 0.0 Double -
JDFMatrix
Deprecated.use typesafe constructorsconstructs a matrix with all values set via a Vector of Double objects- Parameters:
Vector- v - the given Vector- Throws:
DataFormatException- - if the Vector has not a valid format
-
JDFMatrix
public JDFMatrix(double degrees, double x, double y) constructs a matrix with all values set via arotation and a shift- Parameters:
degrees- - the rotation in degreesx- the X shifty- the Y shift- Throws:
DataFormatException- - if the Vector has not a valid format
-
JDFMatrix
constructs a matrix with all values set via an enumerated orientation- Parameters:
orientation- - the named orientationw- the width of the unrotated object to transformh- the height of the unrotated object to transform- Throws:
DataFormatException- - if the Vector has not a valid format
-
JDFMatrix
constructs a matrix with all values set via a String- Parameters:
s- the given String- Throws:
DataFormatException- - if the String has not a valid format
-
JDFMatrix
constructs a rectangle with all values set via a JDFNumberList- Parameters:
nl- the given number list- Throws:
DataFormatException- - if the JDFNumberList has not a valid format
-
JDFMatrix
copy constructor- Parameters:
matrix- the given number list
-
JDFMatrix
constructs a rectangle with all values set via a JDFNumberList- Parameters:
rect- the given number list
-
JDFMatrix
public JDFMatrix(double a, double b, double c, double d, double tx, double ty) constructs a new JDFMatrix with the given double values- Parameters:
a- position 01 of the transformation matrixb- position 02 of the transformation matrixc- position 10 of the transformation matrixd- position 11 of the transformation matrixtx- position 03 of the transformation matrixty- position 13 of the transformation matrix
-
-
Method Details
-
getUnitMatrix
- Returns:
- a copy of the unit matrix
-
clone
- Overrides:
clonein classJDFNumList- See Also:
-
createMatrix
factory for JDFXYPair that silently returns null in case of illegal strings- Parameters:
s- the string to parse- Returns:
- the JDFXYPair, null if s is not compatible
-
isValid
isValid - true if the size of the vector is 6 and all instances are Double types- Specified by:
isValidin classJDFNumList- Returns:
- boolean - true if all instances are Double or Integer types
- Throws:
DataFormatException- - if the Vector has not a valid format
-
getA
public double getA()getA - returns the first coordinate- Returns:
- the first coordinate
-
setA
public void setA(double p_a) setA - sets the first coordinate- Parameters:
p_a- the first coordinate
-
getB
public double getB()getB - returns the second coordinate- Returns:
- double - the second coordinate
-
setB
public void setB(double p_b) setB - sets the second coordinate- Parameters:
p_b- the first coordinate
-
getC
public double getC()getC - returns the third coordinate- Returns:
- double - the third coordinate
-
setC
public void setC(double p_c) setC - sets the third coordinate- Parameters:
p_c- the third coordinate
-
getD
public double getD()getD - returns the fourth coordinate- Returns:
- double - the fourth coordinate
-
setD
public void setD(double p_d) setD - sets the fourth coordinate- Parameters:
p_d- the fourth coordinate
-
getTx
public double getTx()getTx - returns the tx coordinate- Returns:
- double - the tx coordinate
-
getShift
- Returns:
-
getOrientation
- Returns:
-
getAngle
public double getAngle()- Returns:
-
isFlip
public boolean isFlip()- Returns:
-
setTx
public void setTx(double p_tx) setTx - sets the tx coordinate- Parameters:
p_tx- the tx coordinate
-
getTy
public double getTy()getTy - returns the ty coordinate- Returns:
- double - the ty coordinate
-
setTy
public void setTy(double p_ty) setTy - sets the ty coordinate- Parameters:
p_ty- the ty coordinate
-
equals
equals - returns true if both JDFMatrices are equal, otherwise false- Specified by:
equalsin interfaceCollection<Object>- Specified by:
equalsin interfaceList<Object>- Overrides:
equalsin classJDFNumList- Returns:
- boolean - true if equal otherwise false
-
hashCode
public int hashCode()hashCode complements equals() to fulfill the equals/hashCode contract- Specified by:
hashCodein interfaceCollection<Object>- Specified by:
hashCodein interfaceList<Object>- Overrides:
hashCodein classJDFNumList
-
getAffineTransform
getAffineTransform -- Returns:
- AffineTransform
-
setAffineTransform
setAffineTransform -- Parameters:
affineTrans- matrix to be stored
-
transform
applies this to a point- Parameters:
inCoordinate-- Returns:
-
shift
shifts Tx and Ty by the amount specified- Parameters:
tx- shift in x directionty- shift in y direction- Returns:
-
rotate
rotate this by degrees degrees CouterClockwise- Parameters:
degrees- the degrees to rotate by in counterclockwise direction
-
concat
concatinates this with m- Parameters:
m- the matrix to concatinate
-
invert
inverts this- Parameters:
m- the matrix to concatinate
-
shift
shift this matrix by an xypair- Parameters:
point- the point to shift by
-
setShift
shift this matrix by an xypair- Parameters:
point- the point to shift by
-
transform
-