Transform Class
A Transform consists of an origin and a Matrix3d. This describes a coordinate frame with this origin, with the columns of the Matrix3d being the local x,y,z axis directions.
- The math for a Transform Tconsisting of a Matrix3dMand a Point3doon a Vector3dpis:Tp = M*p + o. In other words,Tis a combination of two operations onp: the action of matrix multiplication, followed by a translation.Originis a traditional term foro, becauseTcan be interpreted as a change of basis from the global axes centered at the global origin, to a new set of axes specified by matrix M columns centered ato.
- Beware that for common transformations (e.g. scale about point, rotate around an axis) the fixed pointthat is used when describing the transform is NOT theoriginstored in the transform. Setup methods (e.g createFixedPointAndMatrix, createScaleAboutPoint) take care of determining the appropriate origin coordinates.
- If Tis a translation, no point is fixed byT.
- If Tis the identity, all points are fixed byT.
- If Tis a scale about a point, one point is fixed byT.
- If Tis a rotation about an axis, a line is fixed byT.
- If Tis a projection to the plane, a plane is fixed byT.
Implements
Methods
| Name | Description | |
|---|---|---|
| clone(result?: Transform): Transform | Copy the contents of thistransform into a new Transform (or to the result, if specified). | |
| cloneRigid(axisOrder: AxisOrderAxisOrder.XYZ): undefined | Transform | Return a modified copy of thisTransform so that itsmatrixpart is rigid (originpart is untouched). | |
| computeCachedInverse(useCached: booleantrue): boolean | * Compute (if needed) the inverse of the matrixpart of the Transform, thereby ensuring inverse | |
| freeze(): Readonly<Transform> | Freeze this instance (and its members) so it is read-only | |
| getMatrix(): Matrix3d | return a (clone of) the matrixpart of the Transform, as aMatrix3d | |
| getOrigin(): Point3d | return a (clone of) the originpart of the Transform, as aPoint3d | |
| getTranslation(): Vector3d | return a (clone of) the originpart of the Transform, as aVector3d | |
| inverse(result?: Transform): undefined | Transform | Return a Transform which is the inverse of thisTransform. | |
| isAlmostEqual(other: Readonly<Transform>): boolean | Test for near equality with otherTransform. | |
| isAlmostEqualAllowZRotation(other: Transform): boolean | Test for near equality with otherTransform. | |
| multiplyComponentXYZ(componentIndex: number, x: number, y: number, z: number0): number | Multiply a specific row (component) of the 3x4 instance times (x,y,z,1). | |
| multiplyComponentXYZW(componentIndex: number, x: number, y: number, z: number, w: number): number | Multiply a specific row (component) of the 3x4 instance times (x,y,z,w). | |
| multiplyInversePoint3d(point: Readonly<WritableXYAndZ>, result?: Point3d): undefined | Point3d | Multiply the point by the inverse Transform. | |
| multiplyInversePoint3dArray(points: Point3d[], result?: Point3d[]): undefined | Point3d[] | Multiply each point in the array by the inverse of thisTransform. | |
| multiplyInversePoint3dArrayInPlace(points: Point3d[]): boolean | Multiply each point in the array by the inverse of thisTransform in place. | |
| multiplyInversePoint4d(weightedPoint: Point4d, result?: Point4d): undefined | Point4d | Multiply the homogenous point by the inverse Transform. | |
| multiplyInverseXYZ(x: number, y: number, z: number, result?: Point3d): undefined | Point3d | Multiply the point by the inverse Transform. | |
| multiplyPoint2d(point: Readonly<WritableXAndY>, result?: Point2d): Point2d | Transform the input 2d point (using Tp = M*p + o). | |
| multiplyPoint2dArray(points: Point2d[], result?: Point2d[]): Point2d[] | Transform the input 2d point array (using Tp = M*p + o). | |
| multiplyPoint3d(point: Readonly<WritableXYAndZ>, result?: Point3d): Point3d | Transform the input 3d point (using Tp = M*p + o). | |
| multiplyPoint3dArray(points: Point3d[], result?: Point3d[]): Point3d[] | Transform the input 3d point array (using Tp = M*p + o). | |
| multiplyPoint3dArrayArrayInPlace(chains: Point3d[][]): void | For each point in the 2d array, replace point by the transformed point (using Tp = M*p + o) | |
| multiplyPoint3dArrayInPlace(points: Point3d[]): void | For each point in the array, replace point by the transformed point (using Tp = M*p + o) | |
| multiplyRange(range: Range3d, result?: Range3d): Range3d | Return the range of the transformed corners. | |
| multiplyTransformMatrix3d(other: Matrix3d, result?: Transform): Transform | Multiply thisTransform timesotherMatrix3d (considered to be a Transform with 0origin). | |
| multiplyTransformTransform(other: Transform, result?: Transform): Transform | Multiply thisTransform timesotherTransform. | |
| multiplyTransposeXYZW(x: number, y: number, z: number, w: number, result?: Point4d): Point4d | Multiply the homogeneous point by the transpose of thisTransform. | |
| multiplyVector(vector: Vector3d, result?: Vector3d): Vector3d | Multiply the vector by the matrixpart of the Transform. | |
| multiplyVectorInPlace(vector: Vector3d): void | Multiply the vector by the matrixpart of the Transform in place. | |
| multiplyVectorXYZ(x: number, y: number, z: number, result?: Vector3d): Vector3d | Multiply the vector (x,y,z) by the matrixpart of the Transform. | |
| multiplyXYAndZInPlace(point: Readonly<WritableXYAndZ>): void | Transform the input 3d point in place (using Tp = M*p + o). | |
| multiplyXYZ(x: number, y: number, z: number0, result?: Point3d): Point3d | Transform the input 3d point (using Tp = M*p + o). | |
| multiplyXYZToFloat64Array(x: number, y: number, z: number, result?: Float64Array): Float64Array | * Transform the point. | |
| multiplyXYZW(x: number, y: number, z: number, w: number, result?: Point4d): Point4d | Transform the homogeneous point. | |
| multiplyXYZWToFloat64Array(x: number, y: number, z: number, w: number, result?: Float64Array): Float64Array | Transform the homogeneous point. | |
| setFrom(other: Transform): void | Copy contents from other Transform into this Transform | |
| setFromJSON(json?: TransformProps | Transform): void | Set this Transform instance from flexible inputs: | |
| setIdentity(): void | Set this Transform to be an identity. | |
| setMultiplyTransformTransform(transformA: Transform, transformB: Transform): void | Calculate transformA * transformBand store it into the calling instance (this). | |
| setOriginAndMatrixColumns(origin: XYZ, vectorX: Vector3d, vectorY: Vector3d, vectorZ: Vector3d): void | Create a Transform using the given originand columns of thematrix. | |
| toJSON(): TransformProps | Return a 3 by 4 matrix containing the rows of this Transform. | |
| toRows(): number[][] | Return a 3 by 4 matrix containing the rows of this Transform. | |
| createFixedPointAndMatrix(fixedPoint: Readonly<WritableXYAndZ>, matrix: Matrix3d, result?: Transform): Transform Static | Create a Transform with the specified matrix. | |
| createFlattenAlongVectorToPlane(sweepVector: Vector3d, planePoint: Readonly<WritableXYAndZ>, planeNormal: Vector3d): undefined | Transform Static | Return a transformation which flattens space onto a plane, sweeping along a direction which may be different | |
| createIdentity(result?: Transform): Transform Static | Create an identity transform | |
| createMatrixPickupPutdown(matrix: Matrix3d, a: Point3d, b: Point3d, result?: Transform): Transform Static | Create a transform with the specified matrixand pointsaandb. | |
| createOriginAndMatrix(origin: XYZ, matrix: Matrix3d, result?: Transform): Transform Static | Create a Transform using the given originandmatrix. | |
| createOriginAndMatrixColumns(origin: XYZ, vectorX: Vector3d, vectorY: Vector3d, vectorZ: Vector3d, result?: Transform): Transform Static | Create a Transform using the given originand columns of thematrix | |
| createRefs(origin: XYZ, matrix: Matrix3d, result?: Transform): Transform Static | Create a Transform with the given originandmatrix. | |
| createRigidFromOriginAndColumns(origin: XYZ, vectorX: Vector3d, vectorY: Vector3d, axisOrder: AxisOrder, result?: Transform): undefined | Transform Static | Create a Transform such that its matrixpart is rigid. | |
| createRowValues(qxx: number, qxy: number, qxz: number, ax: number, qyx: number, qyy: number, qyz: number, ay: number, qzx: number, qzy: number, qzz: number, az: number, result?: Transform): Transform Static | Create a Transform with complete contents given. | |
| createScaleAboutPoint(fixedPoint: Point3d, scale: number, result?: Transform): Transform Static | Create a Transform which leaves the fixedPoint unchanged and scales everything else around it by | |
| createTranslation(translation: XYZ, result?: Transform): Transform Static | Create a Transform with specified translationpart. | |
| createTranslationXYZ(x: number0, y: number0, z: number0, result?: Transform): Transform Static | Create a Transform with translation provided by x,y,z parts. | |
| createZero(result?: Transform): Transform Static | Create a Transform with all zeros | |
| fromJSON(json?: TransformProps): Transform Static | Return a new Transform initialized by Transform.setFromJSON | |
| initFromRange(min: Point3d, max: Point3d, npcToGlobal?: Transform, globalToNpc?: Transform): void Static | Initialize 2 Transforms that map between the unit box (specified by 000 and 111) and the range box specified | |
| matchArrayLengths(source: any[], dest: any[], constructionFunction: () => any): number Static | Match the length of destination array with the length of source array | 
Properties
| Name | Type | Description | |
|---|---|---|---|
| identity Accessor Static ReadOnly | Transform | The identity Transform. | |
| isIdentity Accessor ReadOnly | boolean | test if the transform has origin= (0,0,0) and identitymatrix | |
| matrix Accessor ReadOnly | Matrix3d | Return a reference (and NOT a copy) to the matrixpart of the Transform. | |
| origin Accessor ReadOnly | XYZ | Return a reference (and NOT a copy) to the originpart of the Transform. | 
Defined in
- geometry3d/Transform.ts Line 35
Last Updated: 24 June, 2025
Found something wrong, missing, or unclear on this page? Raise an issue in our repo.