API / geotoolkit / util / Transformation / Transformation
util.Transformation.Transformation
Create transformation matrix
Constructors
| [new Transformation()](/solutions/geotoolkit/apis/classes/geotoolkit.util.transformation.transformation.md#new transformation()) | [new Transformation(properties)](/solutions/geotoolkit/apis/classes/geotoolkit.util.transformation.transformation.md#new transformation(properties)) | [new Transformation(tr)](/solutions/geotoolkit/apis/classes/geotoolkit.util.transformation.transformation.md#new transformation(tr)) |
|---|---|---|
| [new Transformation(xx, yx, xy, yy, dx, dy)](/solutions/geotoolkit/apis/classes/geotoolkit.util.transformation.transformation.md#new transformation(xx, yx, xy, yy, dx, dy)) |
Methods
Css Properties
| Name | Type | Description |
|---|---|---|
dx | number | X axis translation |
dy | number | Y axis translation |
xx | number | X scale |
xy | number | Xy skew |
yx | number | Yx skew |
yy | number | Y scale |
Constructors
• new Transformation()
Creates identity matrix
• new Transformation(properties)
| Name | Type | Description |
|---|---|---|
properties | Properties | object to copy |
• new Transformation(tr)
| Name | Type | Description |
|---|---|---|
tr | Transformation | Transformation instance to copy |
• new Transformation(xx, yx, xy, yy, dx, dy)
| Name | Type | Description |
|---|---|---|
xx | number | x scale |
yx | number | yx skew |
xy | number | xy skew |
yy | number | y scale |
dx | number | x axis translation |
dy | number | y axis translation |
Methods
▸ clone(): Transformation
Return clone object.
a copy of this transformation
▸ concatenate(Tx): Transformation
Concatenates Tx to transformation
| Name | Type | Description |
|---|---|---|
Tx | Transformation | transformation |
this
▸ createInverse(): Transformation
Create inverse transformation
▸ fastEquals(Tx): boolean
Return true if transformation are identical
| Name | Type | Description |
|---|---|---|
Tx | Transformation | transformation |
boolean
▸ getAngle(): number
Gets rotation angle Note: only for transformation without skewing
number
rotation angle
▸ getClassName(): string
string
▸ getDeterminant(): number
Returns matrix determinant
number
▸ getLengthToXRatioAt(): number
Return length to X ratio
number
▸ getLengthToYRatioAt(): number
Return length to Y ratio
number
▸ getProperties(): Properties
Gets all the properties pertaining to this object
An object containing the properties to set
▸ getScaleX(): number
Returns X Scale(xx)
number
▸ getScaleY(): number
Returns Y Scale(yy)
number
▸ getShearX(): number
Returns X sheer (xy)
number
▸ getShearY(): number
Returns Y sheer (yx)
number
▸ getTranslate(): Point
Returns translation in both X & Y (dx, dy)
▸ getTranslateX(): number
Returns X translation (dx)
number
▸ getTranslateY(): number
Returns Y translation (dy)
number
▸ inverseTransform<T>(source, destination?): T
Performs an inverse transform using points, rect or dimension
| Name | Type | Description |
|---|---|---|
source | T | source rect |
Optional destination | T | destination rect |
T
transformation from source to destination
▸ inverseTransformDimension(sourceSize, targetSize?): Dimension
Inverse transforms the specified dimension
| Name | Type | Description |
|---|---|---|
sourceSize | Dimension | the point to be inverse transformed |
Optional targetSize | Dimension | the size to hold the transformed point |
the result of the inverse transform.
▸ inverseTransformPoint(sourcePoint, destinationPoint?): Point
Inverse transforms the specified point
| Name | Type | Description |
|---|---|---|
sourcePoint | Point | source point to transform |
Optional destinationPoint | Point | optional destination point |
the result of the inverse transform.
▸ inverseTransformRect(source, destination?): Rect
Inverse transform rectangle
the transformed rect
▸ inverseTransformXY(x, y): Point
Inverse transform point defined by two coordinates X and Y
| Name | Type | Description |
|---|---|---|
x | number | x coordinate |
y | number | y coordinate |
▸ isIdentity(): boolean
Is identity transformation
boolean
is this identity transformation.
▸ isRotated(): boolean
Is rotated transformation
boolean
rotation flag
▸ preConcatenate(Tx): Transformation
Pre-concatenates transformation matrix with Tx
| Name | Type | Description |
|---|---|---|
Tx | Transformation | transformation |
this
▸ rotate(theta): Transformation
Rotate
| Name | Type | Description |
|---|---|---|
theta | number | angle to rotate |
this
▸ scale(sx, sy): Transformation
Scale
| Name | Type | Description |
|---|---|---|
sx | number | scale factor along x coordinate |
sy | number | scale factor along y coordinate |
this
▸ setPointsToPointsTransformation(src1, src2, src3, dst1, dst2, dst3): Transformation
Sets transformation based on three (source => destination) point pairs
Throws
Error if determinant === 0
| Name | Type | Description |
|---|---|---|
src1 | Point | first source point |
src2 | Point | second source point |
src3 | Point | third source point |
dst1 | Point | first destination point |
dst2 | Point | second destination point |
dst3 | Point | third destination point |
this
▸ setProperties(properties?): Transformation
Sets all the properties pertaining to this object
| Name | Type | Description |
|---|---|---|
Optional properties | Properties | An object containing the properties to set |
this
▸ setRectToRectTransformation(source, destination, horizontalFlip?, verticalFlip?, aspectRatio?): Transformation
Sets rect to rect transformation
Throws
if illegal source or destination rectangle
| Name | Type | Description |
|---|---|---|
source | Rect | source rectangle |
destination | Rect | destination rectangle |
Optional horizontalFlip | boolean | horizontal flip |
Optional verticalFlip | boolean | vertical flip |
Optional aspectRatio | boolean | keeps aspect ratio |
this
▸ setScale(xx, yy): Transformation
Sets X & Y Scale by xx and yy
| Name | Type | Description |
|---|---|---|
xx | number | x scale |
yy | number | y scale |
this
▸ setToIdentity(): Transformation
Resets this transform to the Identity transform.
this
▸ setTransformation(xx): Transformation
Sets transformation
| Name | Type | Description |
|---|---|---|
xx | Transformation | Transformation |
this
▸ setTransformation(xx, yx, xy, yy, dx, dy): Transformation
Sets transformation
| Name | Type | Description |
|---|---|---|
xx | number | x scale |
yx | number | yx skew |
xy | number | xy skew |
yy | number | y scale |
dx | number | x axis translation |
dy | number | y axis translation |
this
▸ setTranslate(dx, dy): Transformation
Sets X & Y translation by dx and dy
| Name | Type | Description |
|---|---|---|
dx | number | x offset |
dy | number | y offset |
this
▸ shear(shx, shy): Transformation
Applies a shear mapping to the transform
| Name | Type | Description |
|---|---|---|
shx | number | shear coefficient along x coordinate |
shy | number | shear coefficient along y coordinate |
this
▸ toString(): string
Returns transformation parameters as one string
string
▸ transform<T>(source, destination?): T
Transforms from one point, rect, or dimension to another
| Name | Type |
|---|---|
T | extends Point | Rect | GraphicsPath | Dimension |
| Name | Type | Description |
|---|---|---|
source | T | origin to be transformed from |
Optional destination | T | destination rectangle |
T
transformation from source to destination
▸ transform(x, y): Point
Transform point defined by two coordinates X and Y
| Name | Type | Description |
|---|---|---|
x | number | x coordinate |
y | number | y coordinate |
▸ transformDimension(sourceSize, targetSize?): Dimension
Inverse transforms the specified dimension
| Name | Type | Description |
|---|---|---|
sourceSize | TextMetrics | Dimension | the point to be inverse transformed |
Optional targetSize | Dimension | the size to hold the transformed point |
the result of the transform.
▸ transformPath(srcPath, dstPath?): GraphicsPath
Transforms GraphicsPath
| Name | Type | Description |
|---|---|---|
srcPath | GraphicsPath | source path to transform |
Optional dstPath | GraphicsPath | transformed path |
transformed path
▸ transformPoint(src, dst?): Point
Transform point
| Name | Type | Description |
|---|---|---|
src | Point | source point to transform |
Optional dst | Point | optional returned transformed point |
the transformed point
▸ transformPoints(x, y, count): void
Transform a set of point defined by two arrays
| Name | Type | Description |
|---|---|---|
x | number[] | an array of x-coordinates |
y | number[] | an array of y-coordinates |
count | number | a count of point to transform |
void
▸ transformPolygon(source, destination?): Polygon
Transform polygon
▸ transformRect(source, destination?): Rect
Transform rectangle
Throws
if destination is readonly mode
▸ transformX(x, y): number
Apply X transformation to x,y
| Name | Type | Description |
|---|---|---|
x | number | x coordinate |
y | number | y coordinate |
number
▸ transformXY(x, y): Point
Transform point defined by two coordinates X and Y
| Name | Type | Description |
|---|---|---|
x | number | x coordinate |
y | number | y coordinate |
▸ transformY(x, y): number
Apply Y transformation to x,y
| Name | Type | Description |
|---|---|---|
x | number | x coordinate |
y | number | y coordinate |
number
▸ translate(tx, ty): Transformation
Translate
| Name | Type | Description |
|---|---|---|
tx | number | x offset along x coordinate |
ty | number | y offset along y coordinate |
this
▸ Static canCreatePointsToPointsInstance(src1, src2, src3): boolean
Returns true if transformation can be created from provided source points
| Name | Type | Description |
|---|---|---|
src1 | Point | first source point |
src2 | Point | second source point |
src3 | Point | third source point |
boolean
▸ Static canCreateRectToRectInstance(source, destination): boolean
Return true if transformation can be created from source rectangle to destination rectangle. Vertical or horizontal dimension can be empty
boolean
▸ Static divide(a, b, dst?): Transformation
Divide two matrices
| Name | Type | Description |
|---|---|---|
a | Transformation | the first matrix |
b | Transformation | the second matrix |
Optional dst | Transformation | destination transformation object |
new transformation
▸ Static getClassName(): string
string
▸ Static getPointsToPointsInstance(src1, src2, src3, dst1, dst2, dst3, destination?): Transformation
Returns transformation based on three (source => destination) point pairs
| Name | Type | Description |
|---|---|---|
src1 | Point | first source point |
src2 | Point | second source point |
src3 | Point | third source point |
dst1 | Point | first destination point |
dst2 | Point | second destination point |
dst3 | Point | third destination point |
Optional destination | Transformation | destination transformation object |
▸ Static getRectToRectInstance(source, destination, horizontalFlip?, verticalFlip?, aspectRatio?, dst?): Transformation
Gets rect to rect transformation
Throws
Error if source or destination is null
| Name | Type | Description |
|---|---|---|
source | Rect | source rectangle |
destination | Rect | destination rectangle |
Optional horizontalFlip | boolean | horizontal flip |
Optional verticalFlip | boolean | vertical flip |
Optional aspectRatio | boolean | keeps aspect ratio |
Optional dst | Transformation | destination transformation object |
new transformation
▸ Static getRotateInstance(theta, x, y, dst?): Transformation
Gets rotate instance
Throws
Error if x, y or theta is null
| Name | Type | Description |
|---|---|---|
theta | number | angle |
x | number | x coordinate |
y | number | y coordinate |
Optional dst | Transformation | destination transformation object |
new transformation
▸ Static getScaleInstance(scaleX, scaleY, dst?): Transformation
Get a new transformation instance based on scale values
Throws
Error if scaleX or scaleY is null
| Name | Type | Description |
|---|---|---|
scaleX | number | scale factor along x coordinate |
scaleY | number | scale factor along y coordinate |
Optional dst | Transformation | destination transformation object |
new transformation
▸ Static getSegmentToSegmentInstance(from1, from2, to1, to2, dst?): Transformation
Gets segment to segment transformation
Throws
Error if source or destination is null
| Name | Type | Description |
|---|---|---|
from1 | Point | first source segment point |
from2 | Point | second source segment point |
to1 | Point | first destination segment point |
to2 | Point | second destination segment point |
Optional dst | Transformation | destination transformation object |
transformation that transforms point from1 => to1, and from2 => to2
▸ Static getShearInstance(shx, shy, dst?): Transformation
Get a new transformation instance based on shear values
Throws
Error if shx or shy is null
| Name | Type | Description |
|---|---|---|
shx | number | shear coefficient along x coordinate |
shy | number | shear coefficient along y coordinate |
Optional dst | Transformation | destination transformation object |
new transformation
▸ Static getTranslateInstance(x, y, dst?): Transformation
Gets translate instance
Throws
Error if x or y is null
| Name | Type | Description |
|---|---|---|
x | number | x coordinate |
y | number | y coordinate |
Optional dst | Transformation | destination transformation object |
new transformation
▸ Static multiply(a, b, dst?): Transformation
Multiply two matrices
| Name | Type | Description |
|---|---|---|
a | Transformation | the first matrix |
b | Transformation | the second matrix |
Optional dst | Transformation | destination transformation object |
new transformation