Transform Class

A transform is 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.
  • Beware that for common transformations (e.g. scale about point, rotate around line, mirror across a plane) the "fixed point" that is used when describing the transform is NOT the "origin" stored in the transform. Setup methods (e.g createFixedPointAndMatrix, createScaleAboutPoint) take care of determining the appropriate origin coordinates.

Implements

Methods

Name Description
clone(result?: Transform): Transform Copy the contents of this transform into a new Transform (or to the result, if specified).  
cloneRigid(axisOrder: AxisOrder.XYZ = AxisOrder.XYZ): Transform | undefined Return a copy of this Transform, modified so that its axes are rigid  
computeCachedInverse(useCached: boolean = true): boolean * Compute (if needed) the inverse of the matrix part, thereby ensuring inverse operations can complete.  
freeze(): Readonly<this> Freeze this instance (and its members) so it is read-only  
getOrigin(): Point3d return a (clone of) the origin part of the transform, as a Point3d  
getTranslation(): Vector3d return a (clone of) the origin part of the transform, as a Vector3d  
inverse(): Transform | undefined * Return a Transform which is the inverse of this transform.  
isAlmostEqual(other: Transform): boolean Test for near equality with other Transform.  
isAlmostEqualAllowZRotation(other: Transform): boolean Test for near equality with other Transform.  
multiplyComponentXYZ(componentIndex: number, x: number, y: number, z: number = 0): number Multiply a specific row of the transform times xyz.  
multiplyComponentXYZW(componentIndex: number, x: number, y: number, z: number, w: number): number Multiply a specific row of the transform times (weighted!) xyzw.  
multiplyInversePoint3d(point: XYAndZ, result?: Point3d): Point3d | undefined Return product of the transform's inverse times a point.  
multiplyInversePoint3dArray(source: Point3d[], result?: Point3d[]): Point3d[] | undefined * for each point: multiply transform * point  
multiplyInversePoint3dArrayInPlace(source: Point3d[]): boolean * for each point in source: multiply transformInverse * point in place in the point.  
multiplyInversePoint4d(weightedPoint: Point4d, result?: Point4d): Point4d | undefined Inverse transform the input homogeneous point.  
multiplyInverseXYZ(x: number, y: number, z: number, result?: Point3d): Point3d | undefined Return product of the transform's inverse times a point (point given as x,y,z)  
multiplyPoint2d(source: XAndY, result?: Point2d): Point2d Transform the input 2d point.  
multiplyPoint2dArray(source: Point2d[], result?: Point2d[]): Point2d[] * for each point: multiply transform * point  
multiplyPoint3d(point: XYAndZ, result?: Point3d): Point3d Transform the input 3d point.  
multiplyPoint3dArray(source: Point3d[], result?: Point3d[]): Point3d[] * for each point: multiply transform * point  
multiplyPoint3dArrayArrayInPlace(chains: Point3d[][]): void for each point: replace point by Transform*point  
multiplyPoint3dArrayInPlace(points: Point3d[]): void for each point: replace point by Transform*point  
multiplyRange(range: Range3d.createNull, result?: Range3d.createNull): Range3d.createNull Return the range of the transformed corners.  
multiplyTransformMatrix3d(other: Matrix3d, result?: Transform): Transform multiply this Transform times other Matrix3d, with other considered to be a Transform with 0 translation.  
multiplyTransformTransform(other: Transform, result?: Transform): Transform multiply this Transform times other Transform.  
multiplyTransposeXYZW(x: number, y: number, z: number, w: number, result?: Point4d): Point4d Multiply the transposed transform (as 4x4 with 0001 row) by Point4d given as xyzw..  
multiplyVector(vector: Vector3d, result?: Vector3d): Vector3d Multiply the vector by the Matrix3d part of the transform.  
multiplyVectorXYZ(x: number, y: number, z: number, result?: Vector3d): Vector3d Multiply the vector (x,y,z) by the Matrix3d part of the transform.  
multiplyXYAndZInPlace(point: XYAndZ): void Transform the input object with x,y,z members  
multiplyXYZ(x: number, y: number, z: number = 0, result?: Point3d): Point3d Transform the input point.  
multiplyXYZToFloat64Array(x: number, y: number, z: number, result?: Float64Array): Float64Array Transform the input homogeneous point.  
multiplyXYZW(x: number, y: number, z: number, w: number, result?: Point4d): Point4d Transform the input homogeneous point.  
multiplyXYZWToFloat64Array(x: number, y: number, z: number, w: number, result?: Float64Array): Float64Array Transform the input 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 multiply transformA * transformB, store to calling instance.  
setOriginAndMatrixColumns(origin: XYZ | undefined, vectorX: Vector3d | undefined, vectorY: Vector3d | undefined, vectorZ: Vector3d | undefined): void Reinitialize by directly installing origin and columns of the matrix  
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: XYAndZ | undefined, matrix: Matrix3d, result?: Transform): Transform Static Create a transform with the specified matrix.  
createIdentity(result?: Transform): Transform Static Return an identity transform, optionally filling existing transform.  
createMatrixPickupPutdown(matrix: Matrix3d, pointA: Point3d, pointB: Point3d, result?: Transform): Transform Static Create a transform with the specified matrix, acting on any pointXvia  
createOriginAndMatrix(origin: XYZ | undefined, matrix: Matrix3d | undefined, result?: Transform): Transform Static Create by directly installing origin and matrix  
createOriginAndMatrixColumns(origin: XYZ, vectorX: Vector3d, vectorY: Vector3d, vectorZ: Vector3d, result?: Transform): Transform Static Create by directly installing origin and columns of the matrix  
createRefs(origin: XYZ | undefined, matrix: Matrix3d, result?: Transform): Transform Static Create a copy with the given origin and matrix captured as the Transform origin and Matrix3d.  
createRigidFromOriginAndColumns(origin: XYZ | undefined, vectorX: Vector3d, vectorY: Vector3d, axisOrder: AxisOrder.XYZ, result?: Transform): Transform | undefined Static Create by with matrix from Matrix3d.createRigidFromColumns.  
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  
createTranslation(translation: XYZ, result?: Transform): Transform Static Create a matrix with specified translation part.  
createTranslationXYZ(x: number = 0, y: number = 0, z: number = 0, 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 setFromJSON (json)  
initFromRange(min: Point3d, max: Point3d, npcToGlobal?: Transform, globalToNpc?: Transform): void Static Initialize transforms that map each direction of a box (axis aligned) to [0,1].  
matchArrayLengths(source: any[], dest: any[], constructionFunction: () => any): number Static * If destination has more values than source, remove the extras.  

Properties

Name Type Description
identity Accessor StaticReadOnly Transform The identity Transform.  
isIdentity Accessor ReadOnly boolean test if the transform has 000 origin and identity Matrix3d  
matrix Accessor ReadOnly Matrix3d Return a reference to the matrix within the transform.  
origin Accessor ReadOnly XYZ Return a reference to the origin within the transform.  

Defined in

Last Updated: 06 October, 2021