Class: TransformUtils
Defined in: utils/TransformUtils.ts:10
Utility methods for converting between SimilarityTransform
objects and gl-matrix mat3 matrices
Constructors
Constructor
new TransformUtils():
TransformUtils
Returns
TransformUtils
Methods
asGLMat3x2()
staticasGLMat3x2(m):number[]
Defined in: utils/TransformUtils.ts:75
Extracts a column-major mat3x2 (3 columns × 2 rows) from a mat3,
discarding the third row
Parameters
m
mat3
The source matrix
Returns
number[]
fromSimilarityMatrix()
staticfromSimilarityMatrix(m):SimilarityTransform
Defined in: utils/TransformUtils.ts:19
Decomposes a 3×3 similarity matrix into a SimilarityTransform
Extracts uniform scale, rotation (in degrees), and translation
from a column-major gl-matrix mat3.
Parameters
m
mat3
The source matrix
Returns
toSimilarityMatrix()
statictoSimilarityMatrix(tf,options?):mat3
Defined in: utils/TransformUtils.ts:37
Builds a 3×3 similarity matrix from a (partial) SimilarityTransform
Applies, in order: scale, rotation (around center if provided),
and translation.
Parameters
tf
Partial<SimilarityTransform>
The transform components (all optional)
options?
Optional rotation center in pre-scaled coordinates
center?
{ x: number; y: number; }
center.x
number
center.y
number
Returns
mat3
transformBoundingBox()
statictransformBoundingBox(rect,m):Rect
Defined in: utils/TransformUtils.ts:100
Transforms an axis-aligned rectangle and returns the axis-aligned bounding box of the transformed corners
Parameters
rect
The rectangle to transform
m
mat3
The transformation matrix to apply to the rectangle corners
Returns
The axis-aligned bounding box of the transformed rectangle
transposeAsGLMat2x4()
statictransposeAsGLMat2x4(m):number[]
Defined in: utils/TransformUtils.ts:87
Transposes a mat3 and extracts a column-major mat2x4
(2 columns × 4 rows), zero-padded in the fourth row
Parameters
m
mat3
The source matrix
Returns
number[]