@itwin/core-geometry 4.0.0-dev.50 → 4.0.0-dev.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/geometry3d/Matrix3d.d.ts +9 -5
- package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.js +9 -6
- package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
- package/lib/cjs/geometry3d/Transform.d.ts +112 -75
- package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Transform.js +159 -119
- package/lib/cjs/geometry3d/Transform.js.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.d.ts +9 -5
- package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.js +9 -6
- package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
- package/lib/esm/geometry3d/Transform.d.ts +112 -75
- package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
- package/lib/esm/geometry3d/Transform.js +159 -119
- package/lib/esm/geometry3d/Transform.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Transform.js","sourceRoot":"","sources":["../../../src/geometry3d/Transform.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAmB,QAAQ,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAO,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAGlC;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,S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C,CAAC;SAC5D;QACD,IAAI,WAAW,EAAE;YACf,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,CAAE,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,CAAE,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,CAAE,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;YACjF,QAAQ,CAAC,WAAW,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;YACxE,SAAS,CAAC,qBAAqB,CAAC,MAAM,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;SAC/D;IACH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module CartesianGeometry\r\n */\r\n\r\nimport { AxisOrder, BeJSONFunctions, Geometry } from \"../Geometry\";\r\nimport { Point4d } from \"../geometry4d/Point4d\";\r\nimport { Matrix3d } from \"./Matrix3d\";\r\nimport { Point2d } from \"./Point2dVector2d\";\r\nimport { Point3d, Vector3d, XYZ } from \"./Point3dVector3d\";\r\nimport { Range3d } from \"./Range\";\r\nimport { TransformProps, XAndY, XYAndZ } from \"./XYZProps\";\r\n\r\n/**\r\n * A Transform consists of an origin and a Matrix3d. This describes a coordinate frame with this origin, with\r\n * the columns of the Matrix3d being the local x,y,z axis directions.\r\n * * The math for a Transform `T` consisting of a Matrix3d `M` and a Point3d `o` on a Vector3d `p` is: `Tp = M*p + o`.\r\n * In other words, `T` is a combination of two operations on `p`: the action of matrix multiplication, followed by a\r\n * translation. `Origin` is a traditional term for `o`, because `T` can be interpreted as a change of basis from the\r\n * global axes centered at the global origin, to a new set of axes centered at `o`.\r\n * * Beware that for common transformations (e.g. scale about point, rotate around an axis, mirror across a\r\n * plane) the \"fixed point\" that is used when describing the transform is NOT the \"origin\" stored in the\r\n * transform. Setup methods (e.g createFixedPointAndMatrix, createScaleAboutPoint) take care of determining\r\n * the appropriate origin coordinates.\r\n * @public\r\n */\r\nexport class Transform implements BeJSONFunctions {\r\n // static (one per class) vars for temporaries in computation.\r\n // ASSUME any user of these vars needs them only within its own scope\r\n // ASSUME no calls to other methods that use the same scratch.\r\n // When Transform was in the same file with Point3d, this was initialized right here.\r\n // But when split, there is a load order issue, so it has to be initialized at point-of-use\r\n private static _scratchPoint: Point3d;\r\n private _origin: XYZ;\r\n private _matrix: Matrix3d;\r\n // Constructor accepts and uses pointer to content (no copy is done here).\r\n private constructor(origin: XYZ, matrix: Matrix3d) {\r\n this._origin = origin;\r\n this._matrix = matrix;\r\n }\r\n private static _identity?: Transform;\r\n /** The identity Transform. Value is frozen and cannot be modified. */\r\n public static get identity(): Transform {\r\n if (undefined === this._identity) {\r\n this._identity = Transform.createIdentity();\r\n this._identity.freeze();\r\n }\r\n return this._identity;\r\n }\r\n /** Freeze this instance (and its members) so it is read-only */\r\n public freeze(): Readonly<this> {\r\n this._origin.freeze();\r\n this._matrix.freeze();\r\n return Object.freeze(this);\r\n }\r\n /**\r\n * Copy contents from other Transform into this Transform\r\n * @param other source transform\r\n */\r\n public setFrom(other: Transform) {\r\n this._origin.setFrom(other._origin);\r\n this._matrix.setFrom(other._matrix);\r\n }\r\n /** Set this Transform to be an identity. */\r\n public setIdentity() {\r\n this._origin.setZero();\r\n this._matrix.setIdentity();\r\n }\r\n /**\r\n * Set this Transform instance from flexible inputs:\r\n * * Any object (such as another Transform or TransformProps) that has `origin` and `matrix` members\r\n * accepted by `Point3d.setFromJSON` and `Matrix3d.setFromJSON`\r\n * * An array of 3 number arrays, each with 4 entries which are rows in a 3x4 matrix.\r\n * * An array of 12 numbers, each block of 4 entries as a row 3x4 matrix.\r\n * * If no input is provided, the identity Transform is returned.\r\n */\r\n public setFromJSON(json?: TransformProps | Transform): void {\r\n if (json) {\r\n if (json instanceof Object && (json as any).origin && (json as any).matrix) {\r\n this._origin.setFromJSON((json as any).origin);\r\n this._matrix.setFromJSON((json as any).matrix);\r\n return;\r\n }\r\n if (Geometry.isArrayOfNumberArray(json, 3, 4)) {\r\n const data = json as number[][];\r\n this._matrix.setRowValues(\r\n data[0][0], data[0][1], data[0][2],\r\n data[1][0], data[1][1], data[1][2],\r\n data[2][0], data[2][1], data[2][2]\r\n );\r\n this._origin.set(data[0][3], data[1][3], data[2][3]);\r\n return;\r\n }\r\n if (Geometry.isNumberArray(json, 12)) {\r\n const data = json as number[];\r\n this._matrix.setRowValues(\r\n data[0], data[1], data[2],\r\n data[4], data[5], data[6],\r\n data[8], data[9], data[10]\r\n );\r\n this._origin.set(data[3], data[7], data[11]);\r\n return;\r\n }\r\n }\r\n this.setIdentity();\r\n }\r\n /**\r\n * Test for near equality with `other` Transform. Comparison uses the `isAlmostEqual` methods on the `origin` and\r\n * `matrix` parts.\r\n * @param other Transform to compare to.\r\n */\r\n public isAlmostEqual(other: Readonly<Transform>): boolean {\r\n return this.origin.isAlmostEqual(other.origin) && this.matrix.isAlmostEqual(other.matrix);\r\n }\r\n /**\r\n * Test for near equality with `other` Transform. Comparison uses the `isAlmostEqual` methods on the `origin` part\r\n * and the `isAlmostEqualAllowZRotation` method on the `matrix` part.\r\n * @param other Transform to compare to.\r\n */\r\n public isAlmostEqualAllowZRotation(other: Transform): boolean {\r\n return this._origin.isAlmostEqual(other._origin) && this._matrix.isAlmostEqualAllowZRotation(other._matrix);\r\n }\r\n /**\r\n * Return a 3 by 4 matrix containing the rows of this Transform.\r\n * * The transform's origin coordinates are the last entries of the 3 json arrays\r\n */\r\n public toRows(): number[][] {\r\n return [\r\n [this._matrix.coffs[0], this._matrix.coffs[1], this._matrix.coffs[2], this._origin.x],\r\n [this._matrix.coffs[3], this._matrix.coffs[4], this._matrix.coffs[5], this._origin.y],\r\n [this._matrix.coffs[6], this._matrix.coffs[7], this._matrix.coffs[8], this._origin.z],\r\n ];\r\n }\r\n /**\r\n * Return a 3 by 4 matrix containing the rows of this Transform.\r\n * * The transform's origin coordinates are the last entries of the 3 json arrays\r\n */\r\n public toJSON(): TransformProps {\r\n return this.toRows();\r\n }\r\n /** Return a new Transform initialized by `Transform.setFromJSON` */\r\n public static fromJSON(json?: TransformProps): Transform {\r\n const result = Transform.createIdentity();\r\n result.setFromJSON(json);\r\n return result;\r\n }\r\n /** Copy the contents of `this` transform into a new Transform (or to the result, if specified). */\r\n public clone(result?: Transform): Transform {\r\n if (result) {\r\n result._matrix.setFrom(this._matrix);\r\n result._origin.setFrom(this._origin);\r\n return result;\r\n }\r\n return new Transform(\r\n Point3d.createFrom(this._origin),\r\n this._matrix.clone()\r\n );\r\n }\r\n /**\r\n * Return a modified copy of `this` Transform so that its `matrix` part is rigid (`origin` part is untouched).\r\n * * For details of how the matrix is modified to rigid, see documentation of `Matrix3d.axisOrderCrossProductsInPlace`\r\n */\r\n public cloneRigid(axisOrder: AxisOrder = AxisOrder.XYZ): Transform | undefined {\r\n const modifiedMatrix = Matrix3d.createRigidFromMatrix3d(this.matrix, axisOrder);\r\n if (!modifiedMatrix)\r\n return undefined;\r\n return new Transform(this.origin.cloneAsPoint3d(), modifiedMatrix);\r\n }\r\n /** Create a Transform with the given `origin` and `matrix`. */\r\n public static createRefs(origin: XYZ | undefined, matrix: Matrix3d, result?: Transform): Transform {\r\n if (!origin)\r\n origin = Point3d.createZero();\r\n if (result) {\r\n result._origin = origin;\r\n result._matrix = matrix;\r\n return result;\r\n }\r\n return new Transform(origin, matrix);\r\n }\r\n /** Create a Transform with complete contents given */\r\n public static createRowValues(\r\n qxx: number, qxy: number, qxz: number, ax: number,\r\n qyx: number, qyy: number, qyz: number, ay: number,\r\n qzx: number, qzy: number, qzz: number, az: number,\r\n result?: Transform\r\n ): Transform {\r\n if (result) {\r\n result._origin.set(ax, ay, az);\r\n result._matrix.setRowValues(qxx, qxy, qxz, qyx, qyy, qyz, qzx, qzy, qzz);\r\n return result;\r\n }\r\n return new Transform(\r\n Point3d.create(ax, ay, az),\r\n Matrix3d.createRowValues(qxx, qxy, qxz, qyx, qyy, qyz, qzx, qzy, qzz)\r\n );\r\n }\r\n /** Create a Transform with all zeros */\r\n public static createZero(result?: Transform): Transform {\r\n return Transform.createRowValues(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, result);\r\n }\r\n /**\r\n * Create a Transform with translation provided by x,y,z parts.\r\n * @param x x part of translation\r\n * @param y y part of translation\r\n * @param z z part of translation\r\n * @param result optional pre-allocated Transform\r\n * @returns new or updated transform\r\n */\r\n public static createTranslationXYZ(x: number = 0, y: number = 0, z: number = 0, result?: Transform): Transform {\r\n return Transform.createRefs(Vector3d.create(x, y, z), Matrix3d.createIdentity(), result);\r\n }\r\n /**\r\n * Create a Transform with specified `translation` part.\r\n * @param translation x,y,z parts of the translation\r\n * @param result optional pre-allocated Transform\r\n * @returns new or updated transform\r\n */\r\n public static createTranslation(translation: XYZ, result?: Transform): Transform {\r\n return Transform.createRefs(translation, Matrix3d.createIdentity(), result);\r\n }\r\n /** Return a reference (and NOT a copy) to the `matrix` part of the Transform. */\r\n public get matrix(): Matrix3d {\r\n return this._matrix;\r\n }\r\n /** Return a reference (and NOT a copy) to the `origin` part of the Transform. */\r\n public get origin(): XYZ {\r\n return this._origin;\r\n }\r\n /** return a (clone of) the `origin` part of the Transform, as a `Point3d` */\r\n public getOrigin(): Point3d {\r\n return Point3d.createFrom(this._origin);\r\n }\r\n /** return a (clone of) the `origin` part of the Transform, as a `Vector3d` */\r\n public getTranslation(): Vector3d {\r\n return Vector3d.createFrom(this._origin);\r\n }\r\n /** return a (clone of) the `matrix` part of the Transform, as a `Matrix3d` */\r\n public getMatrix(): Matrix3d {\r\n return this._matrix.clone();\r\n }\r\n /** test if the transform has `origin` = (0,0,0) and identity `matrix` */\r\n public get isIdentity(): boolean {\r\n return this._matrix.isIdentity && this._origin.isAlmostZero;\r\n }\r\n /** Create an identity transform */\r\n public static createIdentity(result?: Transform): Transform {\r\n if (result) {\r\n result._origin.setZero();\r\n result._matrix.setIdentity();\r\n return result;\r\n }\r\n return Transform.createRefs(Point3d.createZero(), Matrix3d.createIdentity());\r\n }\r\n /**\r\n * Create a Transform using the given `origin` and `matrix`.\r\n * * This is a the appropriate construction when the columns of the matrix are coordinate axes of a\r\n * local-to-world mapping.\r\n * * This function is a closely related to `createFixedPointAndMatrix` whose point input is the fixed point\r\n * of the world-to-world transformation.\r\n */\r\n public static createOriginAndMatrix(\r\n origin: XYZ | undefined, matrix: Matrix3d | undefined, result?: Transform\r\n ): Transform {\r\n if (result) {\r\n result._origin.setFromPoint3d(origin);\r\n result._matrix.setFrom(matrix);\r\n return result;\r\n }\r\n return Transform.createRefs(\r\n origin ? origin.cloneAsPoint3d() : Point3d.createZero(),\r\n matrix === undefined ? Matrix3d.createIdentity() : matrix.clone(),\r\n result\r\n );\r\n }\r\n /** Create a Transform using the given `origin` and columns of the `matrix`. If `undefined` zero is used. */\r\n public setOriginAndMatrixColumns(\r\n origin: XYZ | undefined, vectorX: Vector3d | undefined, vectorY: Vector3d | undefined, vectorZ: Vector3d | undefined\r\n ): void {\r\n if (origin !== undefined)\r\n this._origin.setFrom(origin);\r\n this._matrix.setColumns(vectorX, vectorY, vectorZ);\r\n }\r\n /** Create a Transform using the given `origin` and columns of the `matrix` */\r\n public static createOriginAndMatrixColumns(\r\n origin: XYZ, vectorX: Vector3d, vectorY: Vector3d, vectorZ: Vector3d, result?: Transform\r\n ): Transform {\r\n if (result)\r\n result.setOriginAndMatrixColumns(origin, vectorX, vectorY, vectorZ);\r\n else\r\n result = Transform.createRefs(Vector3d.createFrom(origin), Matrix3d.createColumns(vectorX, vectorY, vectorZ));\r\n return result;\r\n }\r\n /**\r\n * Create a Transform such that its `matrix` part is rigid.\r\n * * For details of how the matrix is created to be rigid, see documentation of `Matrix3d.createRigidFromColumns`\r\n */\r\n public static createRigidFromOriginAndColumns(\r\n origin: XYZ | undefined, vectorX: Vector3d, vectorY: Vector3d, axisOrder: AxisOrder, result?: Transform\r\n ): Transform | undefined {\r\n const matrix = Matrix3d.createRigidFromColumns(vectorX, vectorY, axisOrder, result ? result._matrix : undefined);\r\n if (!matrix)\r\n return undefined;\r\n if (result) {\r\n // result._matrix was already modified to become rigid via createRigidFromColumns\r\n result._origin.setFrom(origin);\r\n return result;\r\n }\r\n /**\r\n * We don't want to pass \"origin\" to createRefs because createRefs does not clone \"origin\" and use its reference.\r\n * That means if \"origin\" is changed via Transform at any point, the initial \"origin\" passed by the user is also\r\n * changed. To avoid that, we pass undefined to createRefs. This would cause createRefs to create a new \"origin\"\r\n * equals (0,0,0) which then we set it to the \"origin\" passed by user in the next line.\r\n */\r\n result = Transform.createRefs(undefined, matrix);\r\n result._origin.setFromPoint3d(origin);\r\n return result;\r\n }\r\n /**\r\n * Create a Transform with the specified `matrix`. Compute an `origin` (different from the given `fixedPoint`)\r\n * so that the `fixedPoint` maps back to itself. The returned Transform, transforms a point `p` to `M*p + (f - M*f)`\r\n * where `f` is the fixedPoint (i.e., `Tp = M*(p-f) + f`).\r\n */\r\n public static createFixedPointAndMatrix(\r\n fixedPoint: XYAndZ | undefined, matrix: Matrix3d, result?: Transform\r\n ): Transform {\r\n if (fixedPoint) {\r\n /**\r\n * if f is a fixed point, then Tf = M*f + o = f where M is the matrix and o is the origin.\r\n * we define the origin o = f - M*f. Therefore, Tf = Mf + o = M*f + (f - M*f) = f.\r\n */\r\n const origin = Matrix3d.xyzMinusMatrixTimesXYZ(fixedPoint, matrix, fixedPoint);\r\n return Transform.createRefs(origin, matrix.clone(), result);\r\n }\r\n return Transform.createRefs(undefined, matrix.clone());\r\n }\r\n /**\r\n * Create a transform with the specified `matrix` and points `a` and `b`. The returned Transform, transforms\r\n * point `p` to `M*(p-a) + b` (i.e., `Tp = M*(p-a) + b`) so transforms point `a` to 'b'.\r\n */\r\n public static createMatrixPickupPutdown(\r\n matrix: Matrix3d, a: Point3d, b: Point3d, result?: Transform\r\n ): Transform {\r\n // we define the origin o = b - M*a so Tp = M*p + o = M*p + (b - M*a) = M*(x-a) + b\r\n const origin = Matrix3d.xyzMinusMatrixTimesXYZ(b, matrix, a);\r\n return Transform.createRefs(origin, matrix.clone(), result);\r\n }\r\n /**\r\n * Create a Transform which leaves the fixedPoint unchanged and scales everything else around it by\r\n * a single scale factor. The returned Transform, transforms a point `p` to `M*p + (f - M*f)`\r\n * where `f` is the fixedPoint and M is the scale matrix (i.e., `Tp = M*(p-f) + f`).\r\n */\r\n public static createScaleAboutPoint(fixedPoint: Point3d, scale: number, result?: Transform): Transform {\r\n const matrix = Matrix3d.createScale(scale, scale, scale);\r\n /**\r\n * if f is a fixed point, then Tf = M*f + o = f where M is the matrix and o is the origin.\r\n * we define the origin o = f - M*f. Therefore, Tf = M*f + o = M*f + (f - M*f) = f.\r\n */\r\n const origin = Matrix3d.xyzMinusMatrixTimesXYZ(fixedPoint, matrix, fixedPoint);\r\n return Transform.createRefs(origin, matrix, result);\r\n }\r\n /** Transform the input 2d point. Return as a new point or in the pre-allocated result (if result is given). */\r\n public multiplyPoint2d(point: XAndY, result?: Point2d): Point2d {\r\n // Tx = Mx + o so we return Mx + o\r\n return Matrix3d.xyPlusMatrixTimesXY(this._origin, this._matrix, point, result);\r\n }\r\n /** Transform the input 3d point. Return as a new point or in the pre-allocated result (if result is given). */\r\n public multiplyPoint3d(point: XYAndZ, result?: Point3d): Point3d {\r\n // Tx = Mx + o so we return Mx + o\r\n return Matrix3d.xyzPlusMatrixTimesXYZ(this._origin, this._matrix, point, result);\r\n }\r\n /** Transform the input 3d point in place (override the input point by the transformed point). */\r\n public multiplyXYAndZInPlace(point: XYAndZ): void {\r\n // Tx = Mx + o so we override x by Mx + o\r\n return Matrix3d.xyzPlusMatrixTimesXYZInPlace(this._origin, this._matrix, point);\r\n }\r\n /** Transform the input point. Return as a new point or in the pre-allocated result (if result is given). */\r\n public multiplyXYZ(x: number, y: number, z: number = 0, result?: Point3d): Point3d {\r\n // Tx = Mx + o so we return Mx + o\r\n return Matrix3d.xyzPlusMatrixTimesCoordinates(this._origin, this._matrix, x, y, z, result);\r\n }\r\n /**\r\n * Multiply a specific row (component) of the transform matrix times xyz and add it to the origin element\r\n * at the same row. Return the result.\r\n */\r\n public multiplyComponentXYZ(componentIndex: number, x: number, y: number, z: number = 0): number {\r\n const coffs = this._matrix.coffs;\r\n const idx = 3 * componentIndex;\r\n return this.origin.at(componentIndex) + (coffs[idx] * x) + (coffs[idx + 1] * y) + (coffs[idx + 2] * z);\r\n }\r\n /**\r\n * Multiply a specific row (component) of the transform matrix times xyz and add it to the origin element\r\n * at the same row times w. Return the result.\r\n */\r\n public multiplyComponentXYZW(componentIndex: number, x: number, y: number, z: number, w: number): number {\r\n const coffs = this._matrix.coffs;\r\n const idx = 3 * componentIndex;\r\n return (this.origin.at(componentIndex) * w) + (coffs[idx] * x) + (coffs[idx + 1] * y) + (coffs[idx + 2] * z);\r\n }\r\n /**\r\n * If `p = (x,y,z)` then transform is `Tp = M*p + o*w`. This function returns the transformed point as a new\r\n * point4d (`Tp` as first 3 elements and `w` as last element) or in the pre-allocated result (if result is given).\r\n */\r\n public multiplyXYZW(x: number, y: number, z: number, w: number, result?: Point4d): Point4d {\r\n return Matrix3d.xyzPlusMatrixTimesWeightedCoordinates(this._origin, this._matrix, x, y, z, w, result);\r\n }\r\n /**\r\n * If `p = (x,y,z)` then transform is `Tp = M*p + o*w`. This function returns the transformed point as a new\r\n * Float64Array with size 4 (`Tp` as first 3 elements and `w` as last element) or in the pre-allocated result\r\n * (if result is given).\r\n */\r\n public multiplyXYZWToFloat64Array(x: number, y: number, z: number, w: number, result?: Float64Array): Float64Array {\r\n return Matrix3d.xyzPlusMatrixTimesWeightedCoordinatesToFloat64Array(this._origin, this._matrix, x, y, z, w, result);\r\n }\r\n /**\r\n * If `p = (x,y,z)` then transform is `Tp = M*p + o`. This function returns the transformed point as a new\r\n * Float64Array with size 3 (`Tp` as 3 elements) or in the pre-allocated result (if result is given).\r\n */\r\n public multiplyXYZToFloat64Array(x: number, y: number, z: number, result?: Float64Array): Float64Array {\r\n return Matrix3d.xyzPlusMatrixTimesCoordinatesToFloat64Array(this._origin, this._matrix, x, y, z, result);\r\n }\r\n /**\r\n * Treat the 3x3 matrix and origin as upper 3x4 part of a 4x4 matrix, with 0001 as the final row. Now multiply\r\n * the transposed of this 4x4 matrix by Point4d given as xyzw. Return as a new point4d (`M*p` as first 3 elements\r\n * and `o*p + w` as last element where `p = (x,y,z)`) or in the pre-allocated result (if result is given).\r\n */\r\n public multiplyTransposeXYZW(x: number, y: number, z: number, w: number, result?: Point4d): Point4d {\r\n const coffs = this._matrix.coffs;\r\n const origin = this._origin;\r\n return Point4d.create(\r\n (x * coffs[0]) + (y * coffs[3]) + (z * coffs[6]),\r\n (x * coffs[1]) + (y * coffs[4]) + (z * coffs[7]),\r\n (x * coffs[2]) + (y * coffs[5]) + (z * coffs[8]),\r\n (x * origin.x) + (y * origin.y) + (z * origin.z) + w,\r\n result\r\n );\r\n }\r\n /** For each point in the array, replace point by the transformed point (by `Tp = M*p + o`) */\r\n public multiplyPoint3dArrayInPlace(points: Point3d[]) {\r\n let point;\r\n for (point of points)\r\n Matrix3d.xyzPlusMatrixTimesXYZ(this._origin, this._matrix, point, point);\r\n }\r\n /** For each point in the 2d array, replace point by the transformed point (by `Tp = M*p + o`) */\r\n public multiplyPoint3dArrayArrayInPlace(chains: Point3d[][]) {\r\n for (const chain of chains)\r\n this.multiplyPoint3dArrayInPlace(chain);\r\n }\r\n /**\r\n * If for a point `p` we have `Tp = M*p + o = point` (where `point` is the transformed point), then\r\n * `p = MInverse * (point - o)`. This function returns the original point `p` if `point` is the\r\n * transformed point (`Tp = point`).\r\n * * Return as a new point or in the optional `result`.\r\n * * Returns `undefined` if the `matrix` part if this Transform is singular.\r\n */\r\n public multiplyInversePoint3d(point: XYAndZ, result?: Point3d): Point3d | undefined {\r\n return this._matrix.multiplyInverseXYZAsPoint3d(\r\n point.x - this._origin.x,\r\n point.y - this._origin.y,\r\n point.z - this._origin.z,\r\n result\r\n );\r\n }\r\n /**\r\n * If for a point `p` we have `Tp = M*p + w*o = weightedPoint` (where `weightedPoint` is the transformed point), then\r\n * `p = MInverse * (weightedPoint - w*o)`. This function returns a Point4d where first 3 elements are the original\r\n * point `p` if `weightedPoint` is the transformed point (`Tp = weightedPoint`) and the last element is `w`.\r\n * * Return as a new point or in the optional `result`.\r\n * * Returns `undefined` if the `matrix` part if this Transform is singular.\r\n */\r\n public multiplyInversePoint4d(weightedPoint: Point4d, result?: Point4d): Point4d | undefined {\r\n const w = weightedPoint.w;\r\n return this._matrix.multiplyInverseXYZW(\r\n weightedPoint.x - w * this.origin.x,\r\n weightedPoint.y - w * this.origin.y,\r\n weightedPoint.z - w * this.origin.z,\r\n w,\r\n result\r\n );\r\n }\r\n /**\r\n * If for a point `p = (x,y,z)` we have `Tp = M*p + o = point` (where `point` is the transformed point), then\r\n * `p = MInverse * (point - o)`. This function returns the original point `p` if `point` is the transformed\r\n * point (`Tp = point`).\r\n * * Return as a new point or in the optional `result`.\r\n * * Returns `undefined` if the `matrix` part if this Transform is singular.\r\n */\r\n public multiplyInverseXYZ(x: number, y: number, z: number, result?: Point3d): Point3d | undefined {\r\n return this._matrix.multiplyInverseXYZAsPoint3d(\r\n x - this._origin.x,\r\n y - this._origin.y,\r\n z - this._origin.z,\r\n result\r\n );\r\n }\r\n /**\r\n * * for each point: multiply transform * point\r\n * * if result is given, resize to match source and replace each corresponding pi\r\n * * if result is not given, return a new array.\r\n */\r\n public multiplyInversePoint3dArray(source: Point3d[], result?: Point3d[]): Point3d[] | undefined {\r\n if (!this._matrix.computeCachedInverse(true))\r\n return undefined;\r\n const originX = this.origin.x;\r\n const originY = this.origin.y;\r\n const originZ = this.origin.z;\r\n if (result) {\r\n const n = Transform.matchArrayLengths(source, result, Point3d.createZero);\r\n for (let i = 0; i < n; i++)\r\n this._matrix.multiplyInverseXYZAsPoint3d(\r\n source[i].x - originX,\r\n source[i].y - originY,\r\n source[i].z - originZ,\r\n result[i]\r\n );\r\n }\r\n result = [];\r\n for (const p of source)\r\n result.push(\r\n this._matrix.multiplyInverseXYZAsPoint3d(\r\n p.x - originX,\r\n p.y - originY,\r\n p.z - originZ\r\n )!\r\n );\r\n\r\n return result;\r\n }\r\n /**\r\n * * For each point in source: multiply transformInverse * point in place in the point.\r\n * * Return false if not invertible.\r\n */\r\n public multiplyInversePoint3dArrayInPlace(source: Point3d[]): boolean {\r\n if (!this._matrix.computeCachedInverse(true))\r\n return false;\r\n const originX = this.origin.x;\r\n const originY = this.origin.y;\r\n const originZ = this.origin.z;\r\n const n = source.length;\r\n for (let i = 0; i < n; i++)\r\n this._matrix.multiplyInverseXYZAsPoint3d(\r\n source[i].x - originX,\r\n source[i].y - originY,\r\n source[i].z - originZ,\r\n source[i]\r\n );\r\n return true;\r\n }\r\n /**\r\n * * Compute (if needed) the inverse of the matrix part, thereby ensuring inverse operations can complete.\r\n * * Return true if matrix inverse completes.\r\n * @param useCached If true, accept prior cached inverse if available.\r\n */\r\n public computeCachedInverse(useCached: boolean = true): boolean {\r\n return this._matrix.computeCachedInverse(useCached);\r\n }\r\n /**\r\n * * If destination has more values than source, remove the extras.\r\n * * If destination has fewer values, use the constructionFunction to create new ones.\r\n * @param source array\r\n * @param dest destination array, to be modified to match source length\r\n * @param constructionFunction function to call to create new entries.\r\n */\r\n // modify destination so it has non-null points for the same length as the source.\r\n // (ASSUME existing elements of dest are non-null, and that parameters are given as either Point2d or Point3d arrays)\r\n public static matchArrayLengths(source: any[], dest: any[], constructionFunction: () => any): number {\r\n const numSource = source.length;\r\n const numDest = dest.length;\r\n if (numSource > numDest) {\r\n for (let i = numDest; i < numSource; i++) {\r\n dest.push(constructionFunction());\r\n }\r\n } else if (numDest > numSource) {\r\n dest.length = numSource;\r\n }\r\n return numSource;\r\n }\r\n /**\r\n * * For each point: multiply transform * point\r\n * * If result is given, resize to match source and replace each corresponding pi\r\n * * If result is not given, return a new array.\r\n */\r\n public multiplyPoint2dArray(source: Point2d[], result?: Point2d[]): Point2d[] {\r\n if (result) {\r\n const n = Transform.matchArrayLengths(source, result, Point2d.createZero);\r\n for (let i = 0; i < n; i++)\r\n Matrix3d.xyPlusMatrixTimesXY(this._origin, this._matrix, source[i], result[i]);\r\n return result;\r\n }\r\n result = [];\r\n for (const p of source)\r\n result.push(Matrix3d.xyPlusMatrixTimesXY(this._origin, this._matrix, p));\r\n return result;\r\n }\r\n /**\r\n * * For each point: multiply transform * point\r\n * * If result is given, resize to match source and replace each corresponding pi\r\n * * If result is not given, return a new array.\r\n */\r\n public multiplyPoint3dArray(source: Point3d[], result?: Point3d[]): Point3d[] {\r\n if (result) {\r\n const n = Transform.matchArrayLengths(source, result, Point3d.createZero);\r\n for (let i = 0; i < n; i++)\r\n Matrix3d.xyzPlusMatrixTimesXYZ(this._origin, this._matrix, source[i], result[i]);\r\n return result;\r\n }\r\n result = [];\r\n for (const p of source)\r\n result.push(Matrix3d.xyzPlusMatrixTimesXYZ(this._origin, this._matrix, p));\r\n return result;\r\n }\r\n /**\r\n * Multiply the vector by the Matrix3d part of the transform.\r\n * * The transform's origin is not used.\r\n * * Return as new or result by usual optional result convention\r\n */\r\n public multiplyVector(vector: Vector3d, result?: Vector3d): Vector3d {\r\n return this._matrix.multiplyVector(vector, result);\r\n }\r\n /**\r\n * Multiply the vector in place by the Matrix3d part of the transform.\r\n * * The transform's origin is not used.\r\n */\r\n public multiplyVectorInPlace(vector: Vector3d): void {\r\n this._matrix.multiplyVectorInPlace(vector);\r\n }\r\n /**\r\n * Multiply the vector (x,y,z) by the Matrix3d part of the transform.\r\n * * The transform's origin is not used.\r\n * * Return as new or result by usual optional result convention\r\n */\r\n public multiplyVectorXYZ(x: number, y: number, z: number, result?: Vector3d): Vector3d {\r\n return this._matrix.multiplyXYZ(x, y, z, result);\r\n }\r\n /** Multiply this Transform times other Transform.\r\n * ```\r\n * equation\r\n * \\begin{matrix}\r\n * \\text{`this` transform with matrix part }\\bold{A}\\text{ and translation }\\bold{a} & \\blockTransform{A}{a}\\\\\r\n * \\text{`other` transform with matrix part }\\bold{B}\\text{ and translation part }\\bold{b}\\text{ promoted to block transform} & \\blockTransform{B}{b} \\\\\r\n * \\text{product}& \\blockTransform{A}{a}\\blockTransform{B}{b}=\\blockTransform{AB}{Ab + a}\r\n * \\end{matrix}\r\n * ```\r\n * @param other right hand transform for multiplication.\r\n * @param result optional preallocated result to reuse.\r\n */\r\n public multiplyTransformTransform(other: Transform, result?: Transform) {\r\n if (!result)\r\n return Transform.createRefs(\r\n Matrix3d.xyzPlusMatrixTimesXYZ(this._origin, this._matrix, other._origin),\r\n this._matrix.multiplyMatrixMatrix(other._matrix)\r\n );\r\n result.setMultiplyTransformTransform(this, other);\r\n return result;\r\n }\r\n /**\r\n * Multiply transformA * transformB, store to calling instance.\r\n * @param transformA left operand\r\n * @param transformB right operand\r\n */\r\n public setMultiplyTransformTransform(transformA: Transform, transformB: Transform): void {\r\n if (Transform._scratchPoint === undefined)\r\n Transform._scratchPoint = Point3d.create();\r\n Matrix3d.xyzPlusMatrixTimesXYZ(transformA._origin, transformA._matrix, transformB._origin, Transform._scratchPoint);\r\n this._origin.setFrom(Transform._scratchPoint);\r\n transformA._matrix.multiplyMatrixMatrix(transformB._matrix, this._matrix);\r\n }\r\n // [Q A][R 0] = [QR A]\r\n // [0 1][0 1] [0 1]\r\n /**\r\n * Multiply this Transform times other Matrix3d, with other considered to be a Transform with 0 translation.\r\n * ```\r\n * equation\r\n * \\begin{matrix}\r\n * \\text{`this` transform with matrix part }\\bold{A}\\text{ and translation }\\bold{b} & \\blockTransform{B}{b}\\\\\r\n * \\text{`other` matrix }\\bold{B}\\text{ promoted to block transform} & \\blockTransform{B}{0} \\\\\r\n * \\text{product}& \\blockTransform{A}{a}\\blockTransform{B}{0}=\\blockTransform{AB}{a}\r\n * \\end{matrix}\r\n * ```\r\n * @param other right hand Matrix3d for multiplication.\r\n * @param result optional preallocated result to reuse.\r\n */\r\n public multiplyTransformMatrix3d(other: Matrix3d, result?: Transform): Transform {\r\n if (!result)\r\n return Transform.createRefs(\r\n this._origin.cloneAsPoint3d(),\r\n this._matrix.multiplyMatrixMatrix(other)\r\n );\r\n this._matrix.multiplyMatrixMatrix(other, result._matrix);\r\n result._origin.setFrom(this._origin);\r\n return result;\r\n }\r\n /**\r\n * Return the range of the transformed corners.\r\n * * The 8 corners are transformed individually.\r\n * * Note that if there is anything other than translation and principal axis scaling in the transform, the volume of the range rotation will increase.\r\n * * Hence to get a \"tight\" range on rotated geometry, a range computation must be made on the rotated geometry itself.\r\n */\r\n public multiplyRange(range: Range3d, result?: Range3d): Range3d {\r\n if (range.isNull)\r\n return range.clone(result);\r\n // snag current values to allow aliasing.\r\n const lowX = range.low.x;\r\n const lowY = range.low.y;\r\n const lowZ = range.low.z;\r\n const highX = range.high.x;\r\n const highY = range.high.y;\r\n const highZ = range.high.z;\r\n result = Range3d.createNull(result);\r\n result.extendTransformedXYZ(this, lowX, lowY, lowZ);\r\n result.extendTransformedXYZ(this, highX, lowY, lowZ);\r\n result.extendTransformedXYZ(this, lowX, highY, lowZ);\r\n result.extendTransformedXYZ(this, highX, highY, lowZ);\r\n result.extendTransformedXYZ(this, lowX, lowY, highZ);\r\n result.extendTransformedXYZ(this, highX, lowY, highZ);\r\n result.extendTransformedXYZ(this, lowX, highY, highZ);\r\n result.extendTransformedXYZ(this, highX, highY, highZ);\r\n return result;\r\n }\r\n /**\r\n * * Return a Transform which is the inverse of this transform.\r\n * @param result optional pre-allocated result\r\n * @return the inverse Transform, or undefined if the matrix is singular\r\n */\r\n public inverse(result?: Transform): Transform | undefined {\r\n const matrixInverse = this._matrix.inverse(result ? result._matrix : undefined);\r\n if (!matrixInverse)\r\n return undefined;\r\n if (result) {\r\n // result._matrix is already defined\r\n matrixInverse.multiplyXYZ(-this._origin.x, -this._origin.y, -this._origin.z, result._origin as Vector3d);\r\n return result;\r\n }\r\n return Transform.createRefs(\r\n matrixInverse.multiplyXYZ(-this._origin.x, -this._origin.y, -this._origin.z),\r\n matrixInverse\r\n );\r\n }\r\n /**\r\n * Initialize transforms that map each direction of a box (axis aligned) to `[0,1]`.\r\n * * The corner coordinates do _not_ need to be in order in any of the x,y,z directions.\r\n * * The npcToGlobalTransform (if supplied) maps 000 to the point named point000.\r\n * * The npcToGlobalTransform (if supplied) maps 11 to the point named point000.\r\n * * The globalToNpc transform is the inverse.\r\n * @param min the \"000\" corner of the box\r\n * @param max the \"111\" corner of the box\r\n * @param npcToGlobal (object created by caller, re-initialized here) transform that carries 01 coordinates into the min,max box.\r\n * @param globalToNpc (object created by caller, re-initialized here) transform that carries world coordinates into 01\r\n */\r\n public static initFromRange(min: Point3d, max: Point3d, npcToGlobal?: Transform, globalToNpc?: Transform) {\r\n const diag = max.minus(min);\r\n if (diag.x === 0.0) diag.x = 1.0;\r\n if (diag.y === 0.0) diag.y = 1.0;\r\n if (diag.z === 0.0) diag.z = 1.0;\r\n const rMatrix = new Matrix3d();\r\n if (npcToGlobal) {\r\n Matrix3d.createScale(diag.x, diag.y, diag.z, rMatrix);\r\n Transform.createOriginAndMatrix(min, rMatrix, npcToGlobal);\r\n }\r\n if (globalToNpc) {\r\n const origin = new Point3d(- min.x / diag.x, - min.y / diag.y, - min.z / diag.z);\r\n Matrix3d.createScale(1.0 / diag.x, 1.0 / diag.y, 1.0 / diag.z, rMatrix);\r\n Transform.createOriginAndMatrix(origin, rMatrix, globalToNpc);\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"Transform.js","sourceRoot":"","sources":["../../../src/geometry3d/Transform.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAmB,QAAQ,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OA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AC,CAAC;YAC9E,QAAQ,CAAC,WAAW,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;YACxE,SAAS,CAAC,qBAAqB,CAAC,MAAM,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;SAC/D;IACH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module CartesianGeometry\r\n */\r\n\r\nimport { AxisOrder, BeJSONFunctions, Geometry } from \"../Geometry\";\r\nimport { Point4d } from \"../geometry4d/Point4d\";\r\nimport { Matrix3d } from \"./Matrix3d\";\r\nimport { Point2d } from \"./Point2dVector2d\";\r\nimport { Point3d, Vector3d, XYZ } from \"./Point3dVector3d\";\r\nimport { Range3d } from \"./Range\";\r\nimport { TransformProps, XAndY, XYAndZ } from \"./XYZProps\";\r\n\r\n/**\r\n * A Transform consists of an origin and a Matrix3d. This describes a coordinate frame with this origin, with\r\n * the columns of the Matrix3d being the local x,y,z axis directions.\r\n * * The math for a Transform `T` consisting of a Matrix3d `M` and a Point3d `o` on a Vector3d `p` is: `Tp = M*p + o`.\r\n * In other words, `T` is a combination of two operations on `p`: the action of matrix multiplication, followed by a\r\n * translation. `Origin` is a traditional term for `o`, because `T` can be interpreted as a change of basis from the\r\n * global axes centered at the global origin, to a new set of axes specified by matrix M columns centered at `o`.\r\n * * Beware that for common transformations (e.g. scale about point, rotate around an axis) the `fixed point` that\r\n * is used when describing the transform is NOT the `origin` stored in the transform. Setup methods (e.g\r\n * createFixedPointAndMatrix, createScaleAboutPoint) take care of determining the appropriate origin coordinates.\r\n * * If `T` is a translation, no point is fixed by `T`.\r\n * * If `T` is the identity, all points are fixed by `T`.\r\n * * If `T` is a scale about a point, one point is fixed by `T`.\r\n * * If `T` is a rotation about an axis, a line is fixed by `T`.\r\n * * If `T` is a projection to the plane, a plane is fixed by `T`.\r\n * @public\r\n */\r\nexport class Transform implements BeJSONFunctions {\r\n private _origin: XYZ;\r\n private _matrix: Matrix3d;\r\n // Constructor accepts and uses pointer to content (no copy is done here).\r\n private constructor(origin: XYZ, matrix: Matrix3d) {\r\n this._origin = origin;\r\n this._matrix = matrix;\r\n }\r\n private static _identity?: Transform;\r\n /** The identity Transform. Value is frozen and cannot be modified. */\r\n public static get identity(): Transform {\r\n if (undefined === this._identity) {\r\n this._identity = Transform.createIdentity();\r\n this._identity.freeze();\r\n }\r\n return this._identity;\r\n }\r\n /** Freeze this instance (and its members) so it is read-only */\r\n public freeze(): Readonly<this> {\r\n this._origin.freeze();\r\n this._matrix.freeze();\r\n return Object.freeze(this);\r\n }\r\n /**\r\n * Copy contents from other Transform into this Transform\r\n * @param other source transform\r\n */\r\n public setFrom(other: Transform) {\r\n this._origin.setFrom(other._origin);\r\n this._matrix.setFrom(other._matrix);\r\n }\r\n /** Set this Transform to be an identity. */\r\n public setIdentity() {\r\n this._origin.setZero();\r\n this._matrix.setIdentity();\r\n }\r\n /**\r\n * Set this Transform instance from flexible inputs:\r\n * * Any object (such as another Transform or TransformProps) that has `origin` and `matrix` members\r\n * accepted by `Point3d.setFromJSON` and `Matrix3d.setFromJSON`\r\n * * An array of 3 number arrays, each with 4 entries which are rows in a 3x4 matrix.\r\n * * An array of 12 numbers, each block of 4 entries as a row 3x4 matrix.\r\n * * If no input is provided, the identity Transform is returned.\r\n */\r\n public setFromJSON(json?: TransformProps | Transform): void {\r\n if (json) {\r\n if (json instanceof Object && (json as any).origin && (json as any).matrix) {\r\n this._origin.setFromJSON((json as any).origin);\r\n this._matrix.setFromJSON((json as any).matrix);\r\n return;\r\n }\r\n if (Geometry.isArrayOfNumberArray(json, 3, 4)) {\r\n const data = json as number[][];\r\n this._matrix.setRowValues(\r\n data[0][0], data[0][1], data[0][2],\r\n data[1][0], data[1][1], data[1][2],\r\n data[2][0], data[2][1], data[2][2]\r\n );\r\n this._origin.set(data[0][3], data[1][3], data[2][3]);\r\n return;\r\n }\r\n if (Geometry.isNumberArray(json, 12)) {\r\n const data = json as number[];\r\n this._matrix.setRowValues(\r\n data[0], data[1], data[2],\r\n data[4], data[5], data[6],\r\n data[8], data[9], data[10]\r\n );\r\n this._origin.set(data[3], data[7], data[11]);\r\n return;\r\n }\r\n }\r\n this.setIdentity();\r\n }\r\n /**\r\n * Test for near equality with `other` Transform. Comparison uses the `isAlmostEqual` methods on the `origin` and\r\n * `matrix` parts.\r\n * @param other Transform to compare to.\r\n */\r\n public isAlmostEqual(other: Readonly<Transform>): boolean {\r\n return this.origin.isAlmostEqual(other.origin) && this.matrix.isAlmostEqual(other.matrix);\r\n }\r\n /**\r\n * Test for near equality with `other` Transform. Comparison uses the `isAlmostEqual` methods on the `origin` part\r\n * and the `isAlmostEqualAllowZRotation` method on the `matrix` part.\r\n * @param other Transform to compare to.\r\n */\r\n public isAlmostEqualAllowZRotation(other: Transform): boolean {\r\n return this._origin.isAlmostEqual(other._origin) && this._matrix.isAlmostEqualAllowZRotation(other._matrix);\r\n }\r\n /**\r\n * Return a 3 by 4 matrix containing the rows of this Transform.\r\n * * The transform's origin coordinates are the last entries of the 3 json arrays\r\n */\r\n public toRows(): number[][] {\r\n return [\r\n [this._matrix.coffs[0], this._matrix.coffs[1], this._matrix.coffs[2], this._origin.x],\r\n [this._matrix.coffs[3], this._matrix.coffs[4], this._matrix.coffs[5], this._origin.y],\r\n [this._matrix.coffs[6], this._matrix.coffs[7], this._matrix.coffs[8], this._origin.z],\r\n ];\r\n }\r\n /**\r\n * Return a 3 by 4 matrix containing the rows of this Transform.\r\n * * The transform's origin coordinates are the last entries of the 3 json arrays\r\n */\r\n public toJSON(): TransformProps {\r\n return this.toRows();\r\n }\r\n /** Return a new Transform initialized by `Transform.setFromJSON` */\r\n public static fromJSON(json?: TransformProps): Transform {\r\n const result = Transform.createIdentity();\r\n result.setFromJSON(json);\r\n return result;\r\n }\r\n /** Copy the contents of `this` transform into a new Transform (or to the result, if specified). */\r\n public clone(result?: Transform): Transform {\r\n if (result) {\r\n result._matrix.setFrom(this._matrix);\r\n result._origin.setFrom(this._origin);\r\n return result;\r\n }\r\n return new Transform(\r\n Point3d.createFrom(this._origin),\r\n this._matrix.clone()\r\n );\r\n }\r\n /**\r\n * Return a modified copy of `this` Transform so that its `matrix` part is rigid (`origin` part is untouched).\r\n * * For details of how the matrix is modified to rigid, see documentation of `Matrix3d.axisOrderCrossProductsInPlace`\r\n */\r\n public cloneRigid(axisOrder: AxisOrder = AxisOrder.XYZ): Transform | undefined {\r\n const modifiedMatrix = Matrix3d.createRigidFromMatrix3d(this.matrix, axisOrder);\r\n if (!modifiedMatrix)\r\n return undefined;\r\n return new Transform(this.origin.cloneAsPoint3d(), modifiedMatrix);\r\n }\r\n /** Create a Transform with the given `origin` and `matrix`. */\r\n public static createRefs(origin: XYZ | undefined, matrix: Matrix3d, result?: Transform): Transform {\r\n if (!origin)\r\n origin = Point3d.createZero();\r\n if (result) {\r\n result._origin = origin;\r\n result._matrix = matrix;\r\n return result;\r\n }\r\n return new Transform(origin, matrix);\r\n }\r\n /** Create a Transform with complete contents given */\r\n public static createRowValues(\r\n qxx: number, qxy: number, qxz: number, ax: number,\r\n qyx: number, qyy: number, qyz: number, ay: number,\r\n qzx: number, qzy: number, qzz: number, az: number,\r\n result?: Transform\r\n ): Transform {\r\n if (result) {\r\n result._origin.set(ax, ay, az);\r\n result._matrix.setRowValues(qxx, qxy, qxz, qyx, qyy, qyz, qzx, qzy, qzz);\r\n return result;\r\n }\r\n return new Transform(\r\n Point3d.create(ax, ay, az),\r\n Matrix3d.createRowValues(qxx, qxy, qxz, qyx, qyy, qyz, qzx, qzy, qzz)\r\n );\r\n }\r\n /** Create a Transform with all zeros */\r\n public static createZero(result?: Transform): Transform {\r\n return Transform.createRowValues(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, result);\r\n }\r\n /**\r\n * Create a Transform with translation provided by x,y,z parts.\r\n * @param x x part of translation\r\n * @param y y part of translation\r\n * @param z z part of translation\r\n * @param result optional pre-allocated Transform\r\n * @returns new or updated transform\r\n */\r\n public static createTranslationXYZ(x: number = 0, y: number = 0, z: number = 0, result?: Transform): Transform {\r\n return Transform.createRefs(Vector3d.create(x, y, z), Matrix3d.createIdentity(), result);\r\n }\r\n /**\r\n * Create a Transform with specified `translation` part.\r\n * @param translation x,y,z parts of the translation\r\n * @param result optional pre-allocated Transform\r\n * @returns new or updated transform\r\n */\r\n public static createTranslation(translation: XYZ, result?: Transform): Transform {\r\n return Transform.createRefs(translation, Matrix3d.createIdentity(), result);\r\n }\r\n /** Return a reference (and NOT a copy) to the `matrix` part of the Transform. */\r\n public get matrix(): Matrix3d {\r\n return this._matrix;\r\n }\r\n /** Return a reference (and NOT a copy) to the `origin` part of the Transform. */\r\n public get origin(): XYZ {\r\n return this._origin;\r\n }\r\n /** return a (clone of) the `origin` part of the Transform, as a `Point3d` */\r\n public getOrigin(): Point3d {\r\n return Point3d.createFrom(this._origin);\r\n }\r\n /** return a (clone of) the `origin` part of the Transform, as a `Vector3d` */\r\n public getTranslation(): Vector3d {\r\n return Vector3d.createFrom(this._origin);\r\n }\r\n /** return a (clone of) the `matrix` part of the Transform, as a `Matrix3d` */\r\n public getMatrix(): Matrix3d {\r\n return this._matrix.clone();\r\n }\r\n /** test if the transform has `origin` = (0,0,0) and identity `matrix` */\r\n public get isIdentity(): boolean {\r\n return this._matrix.isIdentity && this._origin.isAlmostZero;\r\n }\r\n /** Create an identity transform */\r\n public static createIdentity(result?: Transform): Transform {\r\n if (result) {\r\n result._origin.setZero();\r\n result._matrix.setIdentity();\r\n return result;\r\n }\r\n return Transform.createRefs(Point3d.createZero(), Matrix3d.createIdentity());\r\n }\r\n /**\r\n * Create a Transform using the given `origin` and `matrix`.\r\n * * This is a the appropriate construction when the columns of the matrix are coordinate axes of a\r\n * local-to-world mapping.\r\n * * This function is a closely related to `createFixedPointAndMatrix` whose point input is the fixed point\r\n * of the world-to-world transformation.\r\n */\r\n public static createOriginAndMatrix(\r\n origin: XYZ | undefined, matrix: Matrix3d | undefined, result?: Transform\r\n ): Transform {\r\n if (result) {\r\n result._origin.setFromPoint3d(origin);\r\n result._matrix.setFrom(matrix);\r\n return result;\r\n }\r\n return Transform.createRefs(\r\n origin ? origin.cloneAsPoint3d() : Point3d.createZero(),\r\n matrix === undefined ? Matrix3d.createIdentity() : matrix.clone(),\r\n result\r\n );\r\n }\r\n /** Create a Transform using the given `origin` and columns of the `matrix`. If `undefined` zero is used. */\r\n public setOriginAndMatrixColumns(\r\n origin: XYZ | undefined, vectorX: Vector3d | undefined, vectorY: Vector3d | undefined, vectorZ: Vector3d | undefined\r\n ): void {\r\n if (origin !== undefined)\r\n this._origin.setFrom(origin);\r\n this._matrix.setColumns(vectorX, vectorY, vectorZ);\r\n }\r\n /** Create a Transform using the given `origin` and columns of the `matrix` */\r\n public static createOriginAndMatrixColumns(\r\n origin: XYZ, vectorX: Vector3d, vectorY: Vector3d, vectorZ: Vector3d, result?: Transform\r\n ): Transform {\r\n if (result)\r\n result.setOriginAndMatrixColumns(origin, vectorX, vectorY, vectorZ);\r\n else\r\n result = Transform.createRefs(Vector3d.createFrom(origin), Matrix3d.createColumns(vectorX, vectorY, vectorZ));\r\n return result;\r\n }\r\n /**\r\n * Create a Transform such that its `matrix` part is rigid.\r\n * * For details of how the matrix is created to be rigid, see documentation of `Matrix3d.createRigidFromColumns`\r\n */\r\n public static createRigidFromOriginAndColumns(\r\n origin: XYZ | undefined, vectorX: Vector3d, vectorY: Vector3d, axisOrder: AxisOrder, result?: Transform\r\n ): Transform | undefined {\r\n const matrix = Matrix3d.createRigidFromColumns(vectorX, vectorY, axisOrder, result ? result._matrix : undefined);\r\n if (!matrix)\r\n return undefined;\r\n if (result) {\r\n // result._matrix was already modified to become rigid via createRigidFromColumns\r\n result._origin.setFrom(origin);\r\n return result;\r\n }\r\n /**\r\n * We don't want to pass \"origin\" to createRefs because createRefs does not clone \"origin\" and use its reference.\r\n * That means if \"origin\" is changed via Transform at any point, the initial \"origin\" passed by the user is also\r\n * changed. To avoid that, we pass undefined to createRefs. This would cause createRefs to create a new \"origin\"\r\n * equals (0,0,0) which then we set it to the \"origin\" passed by user in the next line.\r\n */\r\n result = Transform.createRefs(undefined, matrix);\r\n result._origin.setFromPoint3d(origin);\r\n return result;\r\n }\r\n /**\r\n * Create a Transform with the specified `matrix`. Compute an `origin` (different from the given `fixedPoint`)\r\n * so that the `fixedPoint` maps back to itself. The returned Transform, transforms a point `p` to `M*p + (f - M*f)`\r\n * where `f` is the fixedPoint (i.e., `Tp = M*(p-f) + f`).\r\n */\r\n public static createFixedPointAndMatrix(\r\n fixedPoint: XYAndZ | undefined, matrix: Matrix3d, result?: Transform\r\n ): Transform {\r\n if (fixedPoint) {\r\n /**\r\n * if f is a fixed point, then Tf = M*f + o = f where M is the matrix and o is the origin.\r\n * we define the origin o = f - M*f. Therefore, Tf = Mf + o = M*f + (f - M*f) = f.\r\n */\r\n const origin = Matrix3d.xyzMinusMatrixTimesXYZ(fixedPoint, matrix, fixedPoint);\r\n return Transform.createRefs(origin, matrix.clone(), result);\r\n }\r\n return Transform.createRefs(undefined, matrix.clone());\r\n }\r\n /**\r\n * Create a transform with the specified `matrix` and points `a` and `b`. The returned Transform, transforms\r\n * point `p` to `M*(p-a) + b` (i.e., `Tp = M*(p-a) + b`) so transforms point `a` to 'b'.\r\n */\r\n public static createMatrixPickupPutdown(\r\n matrix: Matrix3d, a: Point3d, b: Point3d, result?: Transform\r\n ): Transform {\r\n // we define the origin o = b - M*a so Tp = M*p + o = M*p + (b - M*a) = M*(x-a) + b\r\n const origin = Matrix3d.xyzMinusMatrixTimesXYZ(b, matrix, a);\r\n return Transform.createRefs(origin, matrix.clone(), result);\r\n }\r\n /**\r\n * Create a Transform which leaves the fixedPoint unchanged and scales everything else around it by\r\n * a single scale factor. The returned Transform, transforms a point `p` to `M*p + (f - M*f)`\r\n * where `f` is the fixedPoint and M is the scale matrix (i.e., `Tp = M*(p-f) + f`).\r\n */\r\n public static createScaleAboutPoint(fixedPoint: Point3d, scale: number, result?: Transform): Transform {\r\n const matrix = Matrix3d.createScale(scale, scale, scale);\r\n /**\r\n * if f is a fixed point, then Tf = M*f + o = f where M is the matrix and o is the origin.\r\n * we define the origin o = f - M*f. Therefore, Tf = M*f + o = M*f + (f - M*f) = f.\r\n */\r\n const origin = Matrix3d.xyzMinusMatrixTimesXYZ(fixedPoint, matrix, fixedPoint);\r\n return Transform.createRefs(origin, matrix, result);\r\n }\r\n /**\r\n * Transform the input 2d point (using `Tp = M*p + o`).\r\n * Return as a new point or in the pre-allocated result (if result is given).\r\n */\r\n public multiplyPoint2d(point: XAndY, result?: Point2d): Point2d {\r\n return Matrix3d.xyPlusMatrixTimesXY(this._origin, this._matrix, point, result);\r\n }\r\n /**\r\n * Transform the input 3d point (using `Tp = M*p + o`).\r\n * Return as a new point or in the pre-allocated result (if result is given).\r\n */\r\n public multiplyPoint3d(point: XYAndZ, result?: Point3d): Point3d {\r\n // Tx = Mx + o so we return Mx + o\r\n return Matrix3d.xyzPlusMatrixTimesXYZ(this._origin, this._matrix, point, result);\r\n }\r\n /**\r\n * Transform the input 3d point in place (using `Tp = M*p + o`).\r\n * Return as a new point or in the pre-allocated result (if result is given).\r\n */\r\n public multiplyXYAndZInPlace(point: XYAndZ): void {\r\n return Matrix3d.xyzPlusMatrixTimesXYZInPlace(this._origin, this._matrix, point);\r\n }\r\n /**\r\n * Transform the input 3d point (using `Tp = M*p + o`).\r\n * Return as a new point or in the pre-allocated result (if result is given).\r\n */\r\n public multiplyXYZ(x: number, y: number, z: number = 0, result?: Point3d): Point3d {\r\n // Tx = Mx + o so we return Mx + o\r\n return Matrix3d.xyzPlusMatrixTimesCoordinates(this._origin, this._matrix, x, y, z, result);\r\n }\r\n /**\r\n * Multiply a specific row (component) of the transform matrix times xyz and add it to the origin element\r\n * at the same row. Return the result.\r\n */\r\n public multiplyComponentXYZ(componentIndex: number, x: number, y: number, z: number = 0): number {\r\n const coffs = this._matrix.coffs;\r\n const idx = 3 * componentIndex;\r\n return this.origin.at(componentIndex) + (coffs[idx] * x) + (coffs[idx + 1] * y) + (coffs[idx + 2] * z);\r\n }\r\n /**\r\n * Multiply a specific row (component) of the transform matrix times xyz and add it to the origin element\r\n * at the same row times w. Return the result.\r\n */\r\n public multiplyComponentXYZW(componentIndex: number, x: number, y: number, z: number, w: number): number {\r\n const coffs = this._matrix.coffs;\r\n const idx = 3 * componentIndex;\r\n return (this.origin.at(componentIndex) * w) + (coffs[idx] * x) + (coffs[idx + 1] * y) + (coffs[idx + 2] * z);\r\n }\r\n /**\r\n * If `p = (x,y,z)` then transform is `Tp = M*p + o*w`. This function returns the transformed point as a new\r\n * point4d (`Tp` as first 3 elements and `w` as last element) or in the pre-allocated result (if result is given).\r\n */\r\n public multiplyXYZW(x: number, y: number, z: number, w: number, result?: Point4d): Point4d {\r\n return Matrix3d.xyzPlusMatrixTimesWeightedCoordinates(this._origin, this._matrix, x, y, z, w, result);\r\n }\r\n /**\r\n * If `p = (x,y,z)` then transform is `Tp = M*p + o*w`. This function returns the transformed point as a new\r\n * Float64Array with size 4 (`Tp` as first 3 elements and `w` as last element) or in the pre-allocated result\r\n * (if result is given).\r\n */\r\n public multiplyXYZWToFloat64Array(x: number, y: number, z: number, w: number, result?: Float64Array): Float64Array {\r\n return Matrix3d.xyzPlusMatrixTimesWeightedCoordinatesToFloat64Array(this._origin, this._matrix, x, y, z, w, result);\r\n }\r\n /**\r\n * If `p = (x,y,z)` then transform is `Tp = M*p + o`. This function returns the transformed point as a new\r\n * Float64Array with size 3 (`Tp` as 3 elements) or in the pre-allocated result (if result is given).\r\n */\r\n public multiplyXYZToFloat64Array(x: number, y: number, z: number, result?: Float64Array): Float64Array {\r\n return Matrix3d.xyzPlusMatrixTimesCoordinatesToFloat64Array(this._origin, this._matrix, x, y, z, result);\r\n }\r\n /**\r\n * Treat the 3x3 `matrix` and `origin` as upper 3x4 part of a 4x4 matrix, with 0001 as the final row. Now multiply\r\n * the transposed of this 4x4 matrix by Point4d given as xyzw. Return as a new point4d (`M*p` as first 3 elements\r\n * and `o*p + w` as last element where `p = (x,y,z)`) or in the pre-allocated result (if result is given).\r\n */\r\n public multiplyTransposeXYZW(x: number, y: number, z: number, w: number, result?: Point4d): Point4d {\r\n const coffs = this._matrix.coffs;\r\n const origin = this._origin;\r\n return Point4d.create(\r\n (x * coffs[0]) + (y * coffs[3]) + (z * coffs[6]),\r\n (x * coffs[1]) + (y * coffs[4]) + (z * coffs[7]),\r\n (x * coffs[2]) + (y * coffs[5]) + (z * coffs[8]),\r\n (x * origin.x) + (y * origin.y) + (z * origin.z) + w,\r\n result\r\n );\r\n }\r\n /** For each point in the array, replace point by the transformed point (using `Tp = M*p + o`) */\r\n public multiplyPoint3dArrayInPlace(points: Point3d[]) {\r\n let point;\r\n for (point of points)\r\n Matrix3d.xyzPlusMatrixTimesXYZ(this._origin, this._matrix, point, point);\r\n }\r\n /** For each point in the 2d array, replace point by the transformed point (using `Tp = M*p + o`) */\r\n public multiplyPoint3dArrayArrayInPlace(chains: Point3d[][]) {\r\n for (const chain of chains)\r\n this.multiplyPoint3dArrayInPlace(chain);\r\n }\r\n /**\r\n * If for a point `p` we have `Tp = M*p + o = point` (where `point` is the transformed point), then\r\n * `p = MInverse * (point - o)`. This function returns the original point `p` if `point` is the\r\n * transformed point (`Tp = point`).\r\n * * Return as a new point or in the optional `result`.\r\n * * Returns `undefined` if the `matrix` part if this Transform is singular.\r\n */\r\n public multiplyInversePoint3d(point: XYAndZ, result?: Point3d): Point3d | undefined {\r\n return this._matrix.multiplyInverseXYZAsPoint3d(\r\n point.x - this._origin.x,\r\n point.y - this._origin.y,\r\n point.z - this._origin.z,\r\n result\r\n );\r\n }\r\n /**\r\n * If for a point `p` we have `Tp = M*p + w*o = weightedPoint` (where `weightedPoint` is the transformed point), then\r\n * `p = MInverse * (weightedPoint - w*o)`. This function returns a Point4d where first 3 elements are the original\r\n * point `p` if `weightedPoint` is the transformed point (`Tp = weightedPoint`) and the last element is `w`.\r\n * * Return as a new point or in the optional `result`.\r\n * * Returns `undefined` if the `matrix` part if this Transform is singular.\r\n */\r\n public multiplyInversePoint4d(weightedPoint: Point4d, result?: Point4d): Point4d | undefined {\r\n const w = weightedPoint.w;\r\n return this._matrix.multiplyInverseXYZW(\r\n weightedPoint.x - w * this.origin.x,\r\n weightedPoint.y - w * this.origin.y,\r\n weightedPoint.z - w * this.origin.z,\r\n w,\r\n result\r\n );\r\n }\r\n /**\r\n * If for a point `p = (x,y,z)` we have `Tp = M*p + o = point` (where `point` is the transformed point), then\r\n * `p = MInverse * (point - o)`. This function returns the original point `p` if `point` is the transformed\r\n * point (`Tp = point`).\r\n * * Return as a new point or in the optional `result`.\r\n * * Returns `undefined` if the `matrix` part if this Transform is singular.\r\n */\r\n public multiplyInverseXYZ(x: number, y: number, z: number, result?: Point3d): Point3d | undefined {\r\n return this._matrix.multiplyInverseXYZAsPoint3d(\r\n x - this._origin.x,\r\n y - this._origin.y,\r\n z - this._origin.z,\r\n result\r\n );\r\n }\r\n /**\r\n * * Compute (if needed) the inverse of the `matrix` part of the Transform, thereby ensuring inverse\r\n * operations can complete.\r\n * @param useCached If true, accept prior cached inverse if available.\r\n * @returns `true` if matrix inverse completes, `false` otherwise.\r\n */\r\n public computeCachedInverse(useCached: boolean = true): boolean {\r\n return this._matrix.computeCachedInverse(useCached);\r\n }\r\n /**\r\n * Match the length of destination array with the length of source array\r\n * * If destination has more elements than source, remove the extra elements.\r\n * * If destination has fewer elements than source, use `constructionFunction` to create new elements.\r\n * *\r\n * @param source the source array\r\n * @param dest the destination array\r\n * @param constructionFunction function to call to create new elements.\r\n */\r\n public static matchArrayLengths(source: any[], dest: any[], constructionFunction: () => any): number {\r\n const numSource = source.length;\r\n const numDest = dest.length;\r\n if (numSource > numDest) {\r\n for (let i = numDest; i < numSource; i++) {\r\n dest.push(constructionFunction());\r\n }\r\n } else if (numDest > numSource) {\r\n dest.length = numSource;\r\n }\r\n return numSource;\r\n }\r\n /**\r\n * If for each point `p` we have `Tp = M*p + o = point` (where `point` is the transformed point), then\r\n * `p = MInverse * (point - o)`. This function returns the array of original points `p[]` if `points`\r\n * is the array of transformed point (`Tp = point` for each `p` and `point`).\r\n * * If `results` is given, resize it to match the input `points` array and update it with original points `p[]`.\r\n * * If `results` is not given, return a new array.\r\n * * Returns `undefined` if the `matrix` part if this Transform is singular.\r\n */\r\n public multiplyInversePoint3dArray(points: Point3d[], results?: Point3d[]): Point3d[] | undefined {\r\n if (!this._matrix.computeCachedInverse(true))\r\n return undefined;\r\n const originX = this.origin.x;\r\n const originY = this.origin.y;\r\n const originZ = this.origin.z;\r\n if (results) {\r\n const n = Transform.matchArrayLengths(points, results, Point3d.createZero);\r\n for (let i = 0; i < n; i++)\r\n this._matrix.multiplyInverseXYZAsPoint3d(\r\n points[i].x - originX,\r\n points[i].y - originY,\r\n points[i].z - originZ,\r\n results[i]\r\n );\r\n }\r\n results = [];\r\n for (const point of points)\r\n results.push(\r\n this._matrix.multiplyInverseXYZAsPoint3d(\r\n point.x - originX,\r\n point.y - originY,\r\n point.z - originZ\r\n )!\r\n );\r\n return results;\r\n }\r\n /**\r\n * If for each point `p` we have `Tp = M*p + o = point` (where `point` is the transformed point), then\r\n * `p = MInverse * (point - o)`. This function calculates the array of original points `p[]` if `points`\r\n * is the array of transformed point (`Tp = point` for each `p` and `point`) and replaces `points`\r\n * with the array of original points.\r\n * * Returns `true` if the `matrix` part if this Transform is invertible and `false if singular.\r\n */\r\n public multiplyInversePoint3dArrayInPlace(points: Point3d[]): boolean {\r\n if (!this._matrix.computeCachedInverse(true))\r\n return false;\r\n for (const point of points)\r\n this._matrix.multiplyInverseXYZAsPoint3d(\r\n point.x - this.origin.x,\r\n point.y - this.origin.y,\r\n point.z - this.origin.z,\r\n point\r\n );\r\n return true;\r\n }\r\n /**\r\n * Transform the input 2d point array (using `Tp = M*p + o`).\r\n * * If `result` is given, resize it to match the input `points` array and update it with transformed points.\r\n * * If `result` is not given, return a new array.\r\n */\r\n public multiplyPoint2dArray(points: Point2d[], result?: Point2d[]): Point2d[] {\r\n if (result) {\r\n const n = Transform.matchArrayLengths(points, result, Point2d.createZero);\r\n for (let i = 0; i < n; i++)\r\n Matrix3d.xyPlusMatrixTimesXY(this._origin, this._matrix, points[i], result[i]);\r\n return result;\r\n }\r\n result = [];\r\n for (const p of points)\r\n result.push(Matrix3d.xyPlusMatrixTimesXY(this._origin, this._matrix, p));\r\n return result;\r\n }\r\n /**\r\n * Transform the input 3d point array (using `Tp = M*p + o`).\r\n * * If `result` is given, resize it to match the input `points` array and update it with transformed points.\r\n * * If `result` is not given, return a new array.\r\n */\r\n public multiplyPoint3dArray(points: Point3d[], result?: Point3d[]): Point3d[] {\r\n if (result) {\r\n const n = Transform.matchArrayLengths(points, result, Point3d.createZero);\r\n for (let i = 0; i < n; i++)\r\n Matrix3d.xyzPlusMatrixTimesXYZ(this._origin, this._matrix, points[i], result[i]);\r\n return result;\r\n }\r\n result = [];\r\n for (const p of points)\r\n result.push(Matrix3d.xyzPlusMatrixTimesXYZ(this._origin, this._matrix, p));\r\n return result;\r\n }\r\n /**\r\n * Multiply the vector by the `matrix` part of the Transform.\r\n * * The `origin` part of Transform is not used.\r\n * * If `result` is given, update it with the multiplication. Otherwise, create a new Vector3d.\r\n */\r\n public multiplyVector(vector: Vector3d, result?: Vector3d): Vector3d {\r\n return this._matrix.multiplyVector(vector, result);\r\n }\r\n /**\r\n * Multiply the vector by the `matrix` part of the Transform in place.\r\n * * The `origin` part of Transform is not used.\r\n */\r\n public multiplyVectorInPlace(vector: Vector3d): void {\r\n this._matrix.multiplyVectorInPlace(vector);\r\n }\r\n /**\r\n * Multiply the vector (x,y,z) by the `matrix` part of the Transform.\r\n * * The `origin` part of Transform is not used.\r\n * * If `result` is given, update it with the multiplication. Otherwise, create a new Vector3d.\r\n */\r\n public multiplyVectorXYZ(x: number, y: number, z: number, result?: Vector3d): Vector3d {\r\n return this._matrix.multiplyXYZ(x, y, z, result);\r\n }\r\n /**\r\n * Calculate `transformA * transformB` and store it into the calling instance (`this`).\r\n * * **Note:** If `transformA = [A a]` and `transformB = [B b]` then `transformA * transformB` is defined as\r\n * `[A*B Ab+a]`. See `multiplyTransformTransform` doc for math details.\r\n * @param transformA first operand\r\n * @param transformB second operand\r\n */\r\n public setMultiplyTransformTransform(transformA: Transform, transformB: Transform): void {\r\n Matrix3d.xyzPlusMatrixTimesXYZ(\r\n transformA._origin,\r\n transformA._matrix,\r\n transformB._origin,\r\n this._origin as Point3d\r\n );\r\n transformA._matrix.multiplyMatrixMatrix(transformB._matrix, this._matrix);\r\n }\r\n /**\r\n * Multiply `this` Transform times `other` Transform.\r\n * **Note:** If `this = [A a]` and `other = [B b]` then `this * other` is defined as [A*B Ab+a].\r\n * That's because we create a 4x4 matrix for each Transform with the 3x3 `matrix` and `origin`\r\n * as upper 3x4 part of a 4x4 matrix and 0001 as the final row. Then we multiply those two 4x4 matrixes:\r\n * ```\r\n * equation\r\n * \\begin{matrix}\r\n * \\text{`this` Transform with `matrix` part }\\bold{A}\\text{ and `origin` part }\\bold{a} & \\blockTransform{A}{a}\\\\\r\n * \\text{`other` Transform with `matrix` part }\\bold{B}\\text{ and `origin` part }\\bold{b} & \\blockTransform{B}{b} \\\\\r\n * \\text{product}& \\blockTransform{A}{a}\\blockTransform{B}{b}=\\blockTransform{AB}{Ab + a}\r\n * \\end{matrix}\r\n * ```\r\n * @param other the 'other` Transform to be multiplied to `this` Transform.\r\n * @param result optional preallocated result to reuse.\r\n */\r\n public multiplyTransformTransform(other: Transform, result?: Transform) {\r\n if (!result)\r\n return Transform.createRefs(\r\n Matrix3d.xyzPlusMatrixTimesXYZ(this._origin, this._matrix, other._origin),\r\n this._matrix.multiplyMatrixMatrix(other._matrix)\r\n );\r\n result.setMultiplyTransformTransform(this, other);\r\n return result;\r\n }\r\n /**\r\n * Multiply `this` Transform times `other` Matrix3d (considered to be a Transform with 0 `origin`).\r\n * **Note:** If `this = [A a]`, then we promote `other` matrix to be a Transform [B 0].\r\n * Then `this * other` is defined as [A*B a]. That's because we create a 4x4 matrix for each Transform\r\n * with the 3x3 `matrix` and `origin` as upper 3x4 part of a 4x4 matrix and 0001 as the final row. Then we\r\n * multiply those two 4x4 matrixes:\r\n * ```\r\n * equation\r\n * \\begin{matrix}\r\n * \\text{`this` Transform with `matrix` part }\\bold{A}\\text{ and `origin` part }\\bold{a} & \\blockTransform{A}{a}\\\\\r\n * \\text{`other` matrix }\\bold{B}\\text{ promoted to block Transform} & \\blockTransform{B}{0} \\\\\r\n * \\text{product}& \\blockTransform{A}{a}\\blockTransform{B}{0}=\\blockTransform{AB}{a}\r\n * \\end{matrix}\r\n * ```\r\n * @param other the `other` Matrix3d to be multiplied to `this` Transform.\r\n * @param result optional preallocated result to reuse.\r\n */\r\n public multiplyTransformMatrix3d(other: Matrix3d, result?: Transform): Transform {\r\n if (!result)\r\n return Transform.createRefs(\r\n this._origin.cloneAsPoint3d(),\r\n this._matrix.multiplyMatrixMatrix(other)\r\n );\r\n this._matrix.multiplyMatrixMatrix(other, result._matrix);\r\n result._origin.setFrom(this._origin);\r\n return result;\r\n }\r\n /**\r\n * Return the Range of the transformed corners.\r\n * * The 8 corners are transformed individually.\r\n * * **Note:** Suppose you have a geometry, a range box around that geometry, and your Transform is a rotation.\r\n * If you rotate the range box and recompute a new range box around the rotated range box, then the new range\r\n * box will have a larger volume than the original range box. However, if you rotate the geometry itself and\r\n * then recompute the range box, it will be a tighter range box around the rotated geometry. `multiplyRange`\r\n * function creates the larger range box because it only has access to the range box and the geometry itself.\r\n */\r\n public multiplyRange(range: Range3d, result?: Range3d): Range3d {\r\n if (range.isNull)\r\n return range.clone(result);\r\n const lowX = range.low.x;\r\n const lowY = range.low.y;\r\n const lowZ = range.low.z;\r\n const highX = range.high.x;\r\n const highY = range.high.y;\r\n const highZ = range.high.z;\r\n result = Range3d.createNull(result);\r\n result.extendTransformedXYZ(this, lowX, lowY, lowZ);\r\n result.extendTransformedXYZ(this, highX, lowY, lowZ);\r\n result.extendTransformedXYZ(this, lowX, highY, lowZ);\r\n result.extendTransformedXYZ(this, highX, highY, lowZ);\r\n result.extendTransformedXYZ(this, lowX, lowY, highZ);\r\n result.extendTransformedXYZ(this, highX, lowY, highZ);\r\n result.extendTransformedXYZ(this, lowX, highY, highZ);\r\n result.extendTransformedXYZ(this, highX, highY, highZ);\r\n return result;\r\n }\r\n /**\r\n * Return a Transform which is the inverse of `this` Transform.\r\n * * If `transform = [M o]` then `transformInverse = [MInverse MInverse*-o]`\r\n * * Return `undefined` if this Transform's matrix is singular.\r\n */\r\n public inverse(result?: Transform): Transform | undefined {\r\n const matrixInverse = this._matrix.inverse(result ? result._matrix : undefined);\r\n if (!matrixInverse)\r\n return undefined;\r\n if (result) {\r\n // result._matrix is already defined\r\n matrixInverse.multiplyXYZ(-this._origin.x, -this._origin.y, -this._origin.z, result._origin as Vector3d);\r\n return result;\r\n }\r\n return Transform.createRefs(\r\n matrixInverse.multiplyXYZ(-this._origin.x, -this._origin.y, -this._origin.z),\r\n matrixInverse\r\n );\r\n }\r\n /**\r\n * Initialize 2 Transforms: First Transform maps a box (axis aligned) specified by `min` and `max` to\r\n * the unit box specified by 000 and 111 and inverse of it. Second Transform is the reverse of first.\r\n * @param min the min corner of the box\r\n * @param max the max corner of the box\r\n * @param npcToGlobal maps global (the unit box specified by 000 and 111) to NPC (a box specified by `min`\r\n * and `max`). Object created by caller, re-initialized here.\r\n * @param globalToNpc maps NPC (a box specified by `min` and `max`) to global (the unit box specified by\r\n * 000 and 111). Object created by caller, re-initialized here.\r\n * * NPC stands for `Normalized Projection Coordinate`\r\n */\r\n public static initFromRange(min: Point3d, max: Point3d, npcToGlobal?: Transform, globalToNpc?: Transform): void {\r\n const diag = max.minus(min);\r\n if (diag.x === 0.0)\r\n diag.x = 1.0;\r\n if (diag.y === 0.0)\r\n diag.y = 1.0;\r\n if (diag.z === 0.0)\r\n diag.z = 1.0;\r\n const rMatrix = new Matrix3d();\r\n /**\r\n * [diag.x 0 0 min.x]\r\n * npcToGlobal = [ 0 diag.y 0 min.y]\r\n * [ 0 0 diag.y min.z]\r\n *\r\n * npcToGlobal * 0 = min\r\n * npcToGlobal * 1 = diag + min = max\r\n */\r\n if (npcToGlobal) {\r\n Matrix3d.createScale(diag.x, diag.y, diag.z, rMatrix);\r\n Transform.createOriginAndMatrix(min, rMatrix, npcToGlobal);\r\n }\r\n /**\r\n * [1/diag.x 0 0 -min.x/diag.x]\r\n * globalToNpc = [ 0 1/diag.y 0 -min.y/diag.y]\r\n * [ 0 0 1/diag.y -min.z/diag.z]\r\n *\r\n * globalToNpc * min = min/diag - min/diag = 0\r\n * globalToNpc * max = max/diag - min/diag = diag/diag = 1\r\n */\r\n if (globalToNpc) {\r\n const origin = new Point3d(-min.x / diag.x, -min.y / diag.y, -min.z / diag.z);\r\n Matrix3d.createScale(1.0 / diag.x, 1.0 / diag.y, 1.0 / diag.z, rMatrix);\r\n Transform.createOriginAndMatrix(origin, rMatrix, globalToNpc);\r\n }\r\n }\r\n}\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/core-geometry",
|
|
3
|
-
"version": "4.0.0-dev.
|
|
3
|
+
"version": "4.0.0-dev.52",
|
|
4
4
|
"description": "iTwin.js Core Geometry library",
|
|
5
5
|
"main": "lib/cjs/core-geometry.js",
|
|
6
6
|
"module": "lib/esm/core-geometry.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"url": "http://www.bentley.com"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@itwin/build-tools": "4.0.0-dev.
|
|
25
|
+
"@itwin/build-tools": "4.0.0-dev.52",
|
|
26
26
|
"@itwin/eslint-plugin": "nightly",
|
|
27
27
|
"@types/chai": "4.3.1",
|
|
28
28
|
"@types/flatbuffers": "~1.10.0",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"typescript": "~4.4.0"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@itwin/core-bentley": "4.0.0-dev.
|
|
41
|
+
"@itwin/core-bentley": "4.0.0-dev.52",
|
|
42
42
|
"flatbuffers": "~1.12.0"
|
|
43
43
|
},
|
|
44
44
|
"nyc": {
|