@itwin/core-geometry 4.0.0-dev.63 → 4.0.0-dev.68
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/Geometry.d.ts +367 -243
- package/lib/cjs/Geometry.d.ts.map +1 -1
- package/lib/cjs/Geometry.js +481 -311
- package/lib/cjs/Geometry.js.map +1 -1
- package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts +6 -4
- package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
- package/lib/cjs/clipping/ConvexClipPlaneSet.js +9 -7
- package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
- package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts +5 -3
- package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
- package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js +4 -2
- package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
- package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.d.ts +4 -4
- package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js +17 -9
- package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
- package/lib/cjs/geometry3d/Point2dVector2d.js +2 -2
- package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts +13 -7
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js +19 -18
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry4d/Point4d.d.ts +1 -1
- package/lib/cjs/geometry4d/Point4d.d.ts.map +1 -1
- package/lib/cjs/geometry4d/Point4d.js +12 -13
- package/lib/cjs/geometry4d/Point4d.js.map +1 -1
- package/lib/esm/Geometry.d.ts +367 -243
- package/lib/esm/Geometry.d.ts.map +1 -1
- package/lib/esm/Geometry.js +481 -311
- package/lib/esm/Geometry.js.map +1 -1
- package/lib/esm/clipping/ConvexClipPlaneSet.d.ts +6 -4
- package/lib/esm/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
- package/lib/esm/clipping/ConvexClipPlaneSet.js +9 -7
- package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
- package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts +5 -3
- package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
- package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js +4 -2
- package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
- package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.d.ts +4 -4
- package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.d.ts.map +1 -1
- package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js +17 -9
- package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
- package/lib/esm/geometry3d/Point2dVector2d.js +2 -2
- package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.d.ts +13 -7
- package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.js +19 -18
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry4d/Point4d.d.ts +1 -1
- package/lib/esm/geometry4d/Point4d.d.ts.map +1 -1
- package/lib/esm/geometry4d/Point4d.js +12 -13
- package/lib/esm/geometry4d/Point4d.js.map +1 -1
- package/package.json +3 -3
package/lib/cjs/Geometry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Geometry.js","sourceRoot":"","sources":["../../src/Geometry.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAO/F,kEAAqE;AACrE,kEAAsE;A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AAK,EAAG,CAAC,CAAC;SACpB;QACD,OAAO,CAAC,CAAC;IACX,CAAC;;AAjxBD,0DAA0D;AACnC,4BAAmB,GAAG,MAAM,CAAC;AACpD,uCAAuC;AAChB,mCAA0B,GAAG,OAAO,CAAC;AAC5D,qDAAqD;AAC9B,0BAAiB,GAAG,OAAO,CAAC;AACnD,oCAAoC;AACb,iCAAwB,GAAG,OAAO,CAAC;AAC1D,qDAAqD;AAC9B,0BAAiB,GAAG,OAAO,CAAC;AACnD,yDAAyD;AAClC,0BAAiB,GAAG,IAAI,CAAC;AAChD;;GAEG;AACoB,4BAAmB,GAAG,MAAM,CAAC;AACpD,+EAA+E;AACxD,sBAAa,GAAG,OAAO,CAAC;AAC/C;;GAEG;AACoB,8BAAqB,GAAG,MAAM,CAAC;AACtD;;GAEG;AACoB,uBAAc,GAAG,MAAM,CAAC;AAa/C,0EAA0E;AACnD,yCAAgC,GAAG,GAAG,GAAG,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC,CAAI,yCAAyC;AAxCpH,4BAAQ","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 { AngleSweep } from \"./geometry3d/AngleSweep\";\r\nimport { Point2d, Vector2d, XY } from \"./geometry3d/Point2dVector2d\";\r\nimport { Point3d, Vector3d, XYZ } from \"./geometry3d/Point3dVector3d\";\r\nimport { XAndY } from \"./geometry3d/XYZProps\";\r\nimport { Point4d } from \"./geometry4d/Point4d\";\r\n\r\n/* eslint-disable @typescript-eslint/naming-convention, no-empty */\r\n\r\n/**\r\n * Enumeration of the 6 possible orderings of XYZ axis order\r\n * * **Note:** There are 3 axis order with right hand system (XYZ = 0, YZX = 1, ZXY = 2) and 3 axis order with\r\n * left hand system (XZY = 4, YXZ = 5, ZYX = 6). Note that AxisOrder is encoding the handedness as well. Cross\r\n * product of the i_th axis in an ordering (i=0,1,2), with the i+1_th in that ordering, will produce the i+2_th\r\n * axis in that ordering.\r\n * @public\r\n */\r\nexport enum AxisOrder {\r\n /** Right handed system, X then Y then Z */\r\n XYZ = 0, /* eslint-disable-line @typescript-eslint/no-shadow */\r\n /** Right handed system, Y then Z then X */\r\n YZX = 1,\r\n /** Right handed system, Z then X then Y */\r\n ZXY = 2,\r\n /** Left handed system, X then Z then Y */\r\n XZY = 4,\r\n /** Left handed system, Y then X then Z */\r\n YXZ = 5,\r\n /** Left handed system, Z then Y then X */\r\n ZYX = 6,\r\n}\r\n/**\r\n * Enumeration of numeric indices of 3 axes AxisIndex.X, AxisIndex.Y, AxisIndex.Z\r\n * @public\r\n */\r\nexport enum AxisIndex {\r\n /** x axis is index 0 */\r\n X = 0,\r\n /** y axis is index 1 */\r\n Y = 1,\r\n /** 2 axis is index 2 */\r\n Z = 2,\r\n}\r\n/** Standard views. Used in `Matrix3d.createStandardViewAxes(index: StandardViewIndex, invert: boolean)`\r\n * @public\r\n */\r\nexport enum StandardViewIndex {\r\n /** X to right, Y up */\r\n Top = 1,\r\n /** X to right, negative Y up */\r\n Bottom = 2,\r\n /** negative Y to right, Z up */\r\n Left = 3,\r\n /** Y to right, Z up */\r\n Right = 4,\r\n /** X to right, Z up */\r\n Front = 5,\r\n /** negative X to right, Z up */\r\n Back = 6,\r\n /** isometric: view towards origin from (-1,-1,1) */\r\n Iso = 7, //\r\n /** right isometric: view towards origin from (1,-1,1) */\r\n RightIso = 8,\r\n}\r\n/** Enumeration among choice for how a coordinate transformation should incorporate scaling.\r\n * @public\r\n */\r\nexport enum AxisScaleSelect {\r\n /** All axes of unit length. */\r\n Unit = 0,\r\n /** On each axis, the vector length matches the longest side of the range of the data. */\r\n LongestRangeDirection = 1,\r\n /** On each axis, the vector length matches he length of the corresponding edge of the range. */\r\n NonUniformRangeContainment = 2,\r\n}\r\n/** object with a radians value and its associated cosine and sine values.\r\n * @public\r\n */\r\nexport interface TrigValues {\r\n /** the cosine value */\r\n c: number;\r\n /** the sine value */\r\n s: number;\r\n /** the radians value */\r\n radians: number;\r\n}\r\n\r\n/**\r\n * Plane Evaluation methods.\r\n * * These provide the necessary queries to implement clipping operations without knowing if the plane in use\r\n * is a [[ClipPlane]], [[Plane3dByOriginAndUnitNormal]], [[Plane3dByOriginAndVectors]], [[Point4d]].\r\n * * The Plane3d class declares obligation to implement these methods, and\r\n * passes the obligation on to concrete implementations by declaring them as abstract members which the particular classes can implement.\r\n * * It is intended that this interface be deprecated because its implementation by [[Plane3d]] provides all of its functionality and allows more to be added.\r\n * @public\r\n */\r\nexport interface PlaneAltitudeEvaluator {\r\n /**\r\n * Return the altitude of the point from the plane.\r\n * @param point point for evaluation\r\n */\r\n altitude(point: Point3d): number;\r\n /**\r\n * Return the altitude of the point from the plane, with the point supplied as simple x,y,z\r\n * @param x x coordinate\r\n * @param y y coordinate\r\n * @param z z coordinate\r\n */\r\n altitudeXYZ(x: number, y: number, z: number): number;\r\n /**\r\n * Return the derivative of altitude wrt motion along a vector.\r\n * @param point point for evaluation\r\n */\r\n velocity(vector: Vector3d): number;\r\n /**\r\n * Return the derivative of altitude wrt motion along a vector given by components\r\n * @param point point for evaluation\r\n */\r\n velocityXYZ(x: number, y: number, z: number): number;\r\n /**\r\n * Return the weighted altitude\r\n * @param point xyzw data.\r\n */\r\n weightedAltitude(point: Point4d): number;\r\n /** x part of normal vector */\r\n normalX(): number;\r\n /** x part of normal vector */\r\n normalY(): number;\r\n /** x part of normal vector */\r\n normalZ(): number;\r\n}\r\n\r\n/** Enumeration of possible locations of a point in the plane of a polygon.\r\n * @public\r\n */\r\nexport enum PolygonLocation {\r\n /** No location specified. */\r\n Unknown = 0,\r\n /** Point is at a vertex. */\r\n OnPolygonVertex = 1,\r\n /** Point is on an edge (but not a vertex). */\r\n OnPolygonEdgeInterior = 2,\r\n /** Point is strictly inside the polygon with unknown projection. */\r\n InsidePolygon = 3,\r\n /** Point is strictly inside the polygon and projects to a vertex. */\r\n InsidePolygonProjectsToVertex = 4,\r\n /** Point is strictly inside the polygon and projects to an edge (but not a vertex). */\r\n InsidePolygonProjectsToEdgeInterior = 5,\r\n /** Point is strictly outside the polygon with unknown projection. */\r\n OutsidePolygon = 6,\r\n /** Point is strictly outside the polygon and projects to a vertex. */\r\n OutsidePolygonProjectsToVertex = 7,\r\n /** Point is strictly outside the polygon and projects to an edge (but not a vertex). */\r\n OutsidePolygonProjectsToEdgeInterior = 8,\r\n}\r\n\r\n/**\r\n * Interface for `toJSON` and `setFromJSON` methods\r\n * @public\r\n */\r\nexport interface BeJSONFunctions {\r\n /**\r\n * Set content from a JSON object.\r\n * If the json object is undefined or unrecognized, always set a default value.\r\n */\r\n setFromJSON(json: any): void;\r\n /** Return a json object with this object's contents. */\r\n toJSON(): any;\r\n}\r\n/** The Properties for a JSON representation of an Angle.\r\n * If value is a number, it is in *degrees*.\r\n * If value is an object, it can have either degrees or radians.\r\n * @public\r\n */\r\nexport type AngleProps =\r\n { degrees: number } |\r\n { radians: number } |\r\n { _radians: number } |\r\n { _degrees: number } |\r\n number;\r\n/** The Properties for a JSON representation of an AngleSweep.\r\n * * The json data is always start and end angles as a pair in an array.\r\n * If AngleProps data is an array of two numbers, it is an angle in degrees.\r\n * If the AngleProps is an object with key degrees, the degrees value must be an array with the two degrees angles as numbers\r\n * If the AngleProps is an object with key radians, the radians value must be an array with the two radians angles as numbers\r\n * @public\r\n */\r\nexport type AngleSweepProps =\r\n AngleSweep |\r\n { degrees: [number, number] } |\r\n { radians: [number, number] } |\r\n [number, number];\r\n\r\n/**\r\n * Class containing static methods for typical numeric operations.\r\n * * Experimentally, methods like Geometry.hypotenuse are observed to be faster than the system intrinsics.\r\n * * This is probably due to\r\n * * Fixed length arg lists\r\n * * strongly typed parameters\r\n * @public\r\n */\r\nexport class Geometry {\r\n /** Tolerance for small distances in metric coordinates */\r\n public static readonly smallMetricDistance = 1.0e-6;\r\n /** Square of `smallMetricTolerance` */\r\n public static readonly smallMetricDistanceSquared = 1.0e-12;\r\n /** tolerance for small angle measured in radians. */\r\n public static readonly smallAngleRadians = 1.0e-12;\r\n /** square of `smallAngleRadians` */\r\n public static readonly smallAngleRadiansSquared = 1.0e-24;\r\n /** tolerance for small angle measured in degrees. */\r\n public static readonly smallAngleDegrees = 5.7e-11;\r\n /** tolerance for small angle measured in arc-seconds. */\r\n public static readonly smallAngleSeconds = 2e-7;\r\n /** numeric value that may be considered huge for a ratio of numbers.\r\n * * Note that the \"allowed\" result value is vastly larger than 1.\r\n */\r\n public static readonly largeFractionResult = 1.0e10;\r\n /** numeric value that may be considered zero for fractions between 0 and 1. */\r\n public static readonly smallFraction = 1.0e-10;\r\n /** numeric value that may considered huge for numbers expected to be coordinates.\r\n * * This allows larger results than `largeFractionResult`.\r\n */\r\n public static readonly largeCoordinateResult = 1.0e13;\r\n /** numeric value that may considered infinite for metric coordinates.\r\n * * This coordinate should be used only as a placeholder indicating \"at infinity\" -- computing actual points at this coordinate invites numerical problems.\r\n */\r\n public static readonly hugeCoordinate = 1.0e12;\r\n /** Test if absolute value of x is huge.\r\n * * See `Geometry.hugeCoordinate`\r\n */\r\n public static isHugeCoordinate(x: number): boolean {\r\n return x > this.hugeCoordinate || x < - this.hugeCoordinate;\r\n }\r\n\r\n /** Test if a number is odd.\r\n */\r\n public static isOdd(x: number): boolean {\r\n return (x & (0x01)) === 1;\r\n }\r\n /** Radians value for full circle 2PI radians minus `smallAngleRadians` */\r\n public static readonly fullCircleRadiansMinusSmallAngle = 2.0 * Math.PI - 1.0e-12; // smallAngleRadians less than 360degrees\r\n /** Correct `distance` to zero if undefined or smaller than metric tolerance. Otherwise return it unchanged. */\r\n public static correctSmallMetricDistance(distance: number | undefined, replacement: number = 0.0): number {\r\n if (distance === undefined || Math.abs(distance) < Geometry.smallMetricDistance) {\r\n return replacement;\r\n }\r\n return distance;\r\n }\r\n /**\r\n * If `a` is large enough for safe division, return `1/a`, using Geometry.smallMetricDistance as the tolerance for declaring it as divide by zero. Otherwise return `undefined`.\r\n * @param a denominator of division\r\n */\r\n public static inverseMetricDistance(a: number): number | undefined {\r\n return (Math.abs(a) <= Geometry.smallMetricDistance) ? undefined : 1.0 / a;\r\n }\r\n /**\r\n * If `a` is large enough, return `1/a`, using the square of Geometry.smallMetricDistance as the tolerance for declaring it as divide by zero. Otherwise return `undefined`.\r\n * @param a denominator of division\r\n */\r\n public static inverseMetricDistanceSquared(a: number): number | undefined {\r\n return (Math.abs(a) <= Geometry.smallMetricDistanceSquared) ? undefined : 1.0 / a;\r\n }\r\n /**\r\n * Boolean test for metric coordinate near-equality (i.e., if x and y are almost equal). If tolerance is not passed,\r\n * `Geometry.smallMetricDistance` is used as tolerance.\r\n */\r\n public static isSameCoordinate(x: number, y: number, tol?: number): boolean {\r\n if (tol)\r\n return Math.abs(x - y) < Math.abs(tol);\r\n return Math.abs(x - y) < Geometry.smallMetricDistance;\r\n }\r\n /** Boolean test for metric coordinate near-equality, with toleranceFactor applied to the usual smallMetricDistance */\r\n public static isSameCoordinateWithToleranceFactor(x: number, y: number, toleranceFactor: number): boolean {\r\n return Geometry.isSameCoordinate(x, y, toleranceFactor * Geometry.smallMetricDistance);\r\n }\r\n /** Boolean test for metric coordinate near-equality of x, y pair */\r\n public static isSameCoordinateXY(x0: number, y0: number, x1: number, y1: number, tol: number = Geometry.smallMetricDistance): boolean {\r\n let d = x1 - x0;\r\n if (d < 0)\r\n d = -d;\r\n if (d > tol)\r\n return false;\r\n d = y1 - y0;\r\n if (d < 0)\r\n d = -d;\r\n return d < tol;\r\n }\r\n /** Boolean test for squared metric coordinate near-equality */\r\n public static isSameCoordinateSquared(x: number, y: number): boolean {\r\n return Math.abs(Math.sqrt(x) - Math.sqrt(y)) < Geometry.smallMetricDistance;\r\n }\r\n /** boolean test for small `dataA.distance (dataB)` within `smallMetricDistance` */\r\n public static isSamePoint3d(dataA: Point3d, dataB: Point3d): boolean { return dataA.distance(dataB) < Geometry.smallMetricDistance; }\r\n /** boolean test for distance between `XYZ` objects within `smallMetricDistance`\r\n * * Note that Point3d and Vector3d are both derived from XYZ, so this method tolerates mixed types.\r\n */\r\n public static isSameXYZ(dataA: XYZ, dataB: XYZ): boolean { return dataA.distance(dataB) < Geometry.smallMetricDistance; }\r\n /** boolean test for small `dataA.distanceXY (dataB)` within `smallMetricDistance` */\r\n public static isSamePoint3dXY(dataA: Point3d, dataB: Point3d): boolean { return dataA.distanceXY(dataB) < Geometry.smallMetricDistance; }\r\n /** boolean test for small `dataA.distanceXY (dataB)` within `smallMetricDistance` */\r\n public static isSameVector3d(dataA: Vector3d, dataB: Vector3d): boolean { return dataA.distance(dataB) < Geometry.smallMetricDistance; }\r\n /** boolean test for small `dataA.distanceXY (dataB)` within `smallMetricDistance` */\r\n public static isSamePoint2d(dataA: Point2d, dataB: Point2d): boolean { return dataA.distance(dataB) < Geometry.smallMetricDistance; }\r\n /** boolean test for small `dataA.distanceXY (dataB)` within `smallMetricDistance` */\r\n public static isSameVector2d(dataA: Vector2d, dataB: Vector2d): boolean { return dataA.distance(dataB) < Geometry.smallMetricDistance; }\r\n /**\r\n * Lexical comparison of (a.x,a.y) (b.x,b.y) with x as first test, y second.\r\n * * This is appropriate for a horizontal sweep in the plane.\r\n */\r\n public static lexicalXYLessThan(a: XY | XYZ, b: XY | XYZ): -1 | 0 | 1 {\r\n if (a.x < b.x)\r\n return -1;\r\n else if (a.x > b.x)\r\n return 1;\r\n if (a.y < b.y)\r\n return -1;\r\n else if (a.y > b.y)\r\n return 1;\r\n return 0;\r\n }\r\n /**\r\n * Lexical comparison of (a.x,a.y) (b.x,b.y) with y as first test, x second.\r\n * * This is appropriate for a vertical sweep in the plane.\r\n */\r\n public static lexicalYXLessThan(a: XY | XYZ, b: XY | XYZ): -1 | 0 | 1 {\r\n if (a.y < b.y)\r\n return -1;\r\n else if (a.y > b.y)\r\n return 1;\r\n if (a.x < b.x)\r\n return -1;\r\n else if (a.x > b.x)\r\n return 1;\r\n return 0;\r\n }\r\n /**\r\n * Lexical test, based on x first, y second, z third.\r\n */\r\n public static lexicalXYZLessThan(a: XYZ, b: XYZ): -1 | 0 | 1 {\r\n if (a.x < b.x)\r\n return -1;\r\n else if (a.x > b.x)\r\n return 1;\r\n if (a.y < b.y)\r\n return -1;\r\n else if (a.y > b.y)\r\n return 1;\r\n if (a.z < b.z)\r\n return -1;\r\n else if (a.z > b.z)\r\n return 1;\r\n return 0;\r\n }\r\n /** Test if `value` is small compared to `smallAngleRadians`.\r\n * * This is appropriate if `value` is know to be a typical 0..1 fraction.\r\n */\r\n public static isSmallRelative(value: number): boolean {\r\n return Math.abs(value) < Geometry.smallAngleRadians;\r\n }\r\n /** Test if `value` is small compared to `smallAngleRadians` */\r\n public static isSmallAngleRadians(value: number): boolean {\r\n return Math.abs(value) < Geometry.smallAngleRadians;\r\n }\r\n /** Returns true if both values are undefined or if both are defined and almost equal within tolerance.\r\n * If one is undefined and the other is not then false is returned.\r\n */\r\n public static isAlmostEqualOptional(a: number | undefined, b: number | undefined, tolerance: number): boolean {\r\n if (a !== undefined && b !== undefined) {\r\n if (Math.abs(a - b) > tolerance)\r\n return false;\r\n } else {\r\n if (a !== undefined || b !== undefined)\r\n return false;\r\n }\r\n return true;\r\n }\r\n /** Toleranced equality test, using tolerance `smallAngleRadians * ( 1 + abs(a) + (abs(b)))`\r\n * * Effectively an absolute tolerance of `smallAngleRadians`, with tolerance increasing for larger values of a and b.\r\n */\r\n public static isAlmostEqualNumber(a: number, b: number): boolean {\r\n const sumAbs = 1.0 + Math.abs(a) + Math.abs(b);\r\n return Math.abs(a - b) <= Geometry.smallAngleRadians * sumAbs;\r\n }\r\n /** Toleranced equality test, using tolerance `smallAngleRadians * ( 1 + abs(a) + (abs(b)))`\r\n * * Effectively an absolute tolerance of `smallAngleRadians`, with tolerance increasing for larger values of a and b.\r\n */\r\n public static isAlmostEqualXAndY(a: XAndY, b: XAndY): boolean {\r\n const sumAbs = 1.0 + Math.abs(a.x) + Math.abs(b.x) + Math.abs(a.y) + Math.abs(b.y);\r\n const tolerance = Geometry.smallAngleRadians * sumAbs;\r\n return Math.abs(a.x - b.x) <= tolerance && Math.abs(a.y - b.y) <= tolerance;\r\n }\r\n /**\r\n * Toleranced equality test, using caller-supplied tolerance.\r\n * If no tolerance is given, use smallMetricDistance.\r\n */\r\n public static isDistanceWithinTol(distance: number, tol?: number): boolean {\r\n if (tol !== undefined)\r\n return Math.abs(distance) <= Math.abs(tol);\r\n return Math.abs(distance) <= Geometry.smallMetricDistance;\r\n }\r\n /** Toleranced equality test, using `smallMetricDistance` tolerance. */\r\n public static isSmallMetricDistance(distance: number): boolean {\r\n return Math.abs(distance) <= Geometry.smallMetricDistance;\r\n }\r\n\r\n /** Toleranced equality, using `smallMetricDistanceSquared` tolerance. */\r\n public static isSmallMetricDistanceSquared(distanceSquared: number): boolean {\r\n return Math.abs(distanceSquared) <= Geometry.smallMetricDistanceSquared;\r\n }\r\n /**\r\n * Return `axis modulo 3` with proper handling of negative indices\r\n * ..., -3:x, -2:y, -1:z, 0:x, 1:y, 2:z, 3:x, 4:y, 5:z, 6:x, 7:y, 8:z, ...\r\n * */\r\n public static cyclic3dAxis(axis: number): number {\r\n /* Direct test for the most common cases, avoid modulo */\r\n if (axis >= 0) {\r\n if (axis < 3)\r\n return axis;\r\n if (axis < 6)\r\n return axis - 3;\r\n return axis % 3;\r\n }\r\n const j = axis + 3;\r\n if (j >= 0)\r\n return j;\r\n return 2 - ((-axis - 1) % 3);\r\n }\r\n /** Return the AxisOrder for which axisIndex is the first named axis.\r\n * * `axisIndex === 0` returns `AxisOrder.XYZ`\r\n * * `axisIndex === 1` returns `AxisOrder.YZX`\r\n * * `axisIndex === 2` returns `AxisOrder.ZXY`\r\n */\r\n public static axisIndexToRightHandedAxisOrder(axisIndex: AxisIndex): AxisOrder {\r\n if (axisIndex === 0)\r\n return AxisOrder.XYZ;\r\n if (axisIndex === 1)\r\n return AxisOrder.YZX;\r\n if (axisIndex === 2)\r\n return AxisOrder.ZXY;\r\n return Geometry.axisIndexToRightHandedAxisOrder(Geometry.cyclic3dAxis(axisIndex));\r\n }\r\n /** Return the largest absolute distance from a to either of b0 or b1 */\r\n public static maxAbsDiff(a: number, b0: number, b1: number): number {\r\n return Math.max(Math.abs(a - b0), Math.abs(a - b1));\r\n }\r\n /** Return the largest absolute absolute value among x,y,z */\r\n public static maxAbsXYZ(x: number, y: number, z: number): number {\r\n return Geometry.maxXYZ(Math.abs(x), Math.abs(y), Math.abs(z));\r\n }\r\n /** Return the largest absolute absolute value among x,y */\r\n public static maxAbsXY(x: number, y: number): number {\r\n return Geometry.maxXY(Math.abs(x), Math.abs(y));\r\n }\r\n /** Return the largest signed value among a, b, c */\r\n public static maxXYZ(a: number, b: number, c: number): number {\r\n let q = a;\r\n if (b > q) q = b;\r\n if (c > q) q = c;\r\n return q;\r\n }\r\n /**\r\n * Examine the value (particularly sign) of x.\r\n * * If x is negative, return outNegative.\r\n * * If x is true zero, return outZero\r\n * * If x is positive, return outPositive\r\n */\r\n public static split3WaySign(x: number, outNegative: number, outZero: number, outPositive: number): number {\r\n if (x < 0)\r\n return outNegative;\r\n if (x > 0.0)\r\n return outPositive;\r\n return outZero;\r\n }\r\n /**\r\n * Examine the value (particularly sign) of x.\r\n * * If x is negative, return -1\r\n * * If x is true zero, return 0\r\n * * If x is positive, return 1\r\n */\r\n public static split3Way01(x: number, tolerance: number = Geometry.smallMetricDistance): -1 | 0 | 1 {\r\n if (x > tolerance)\r\n return 1;\r\n if (x < -tolerance)\r\n return -1;\r\n return 0;\r\n }\r\n /** Return the largest signed value among a, b */\r\n public static maxXY(a: number, b: number): number {\r\n let q = a;\r\n if (b > q) q = b;\r\n return q;\r\n }\r\n /** Return the smallest signed value among a, b */\r\n public static minXY(a: number, b: number): number {\r\n let q = a;\r\n if (b < q) q = b;\r\n return q;\r\n }\r\n /** Return the hypotenuse `sqrt(x*x + y*y)`. This is much faster than `Math.hypot(x,y)`. */\r\n public static hypotenuseXY(x: number, y: number): number {\r\n return Math.sqrt(x * x + y * y);\r\n }\r\n /** Return the squared `hypotenuse (x*x + y*y)`. */\r\n public static hypotenuseSquaredXY(x: number, y: number): number {\r\n return x * x + y * y;\r\n }\r\n /** Return the square of x */\r\n public static square(x: number): number {\r\n return x * x;\r\n }\r\n /** Return the hypotenuse `sqrt(x*x + y*y + z*z)`. This is much faster than `Math.hypot(x,y,z)`. */\r\n public static hypotenuseXYZ(x: number, y: number, z: number): number {\r\n return Math.sqrt(x * x + y * y + z * z);\r\n }\r\n /** Return the squared hypotenuse `(x*x + y*y + z*z)`. This is much faster than `Math.hypot(x,y,z)`. */\r\n public static hypotenuseSquaredXYZ(x: number, y: number, z: number): number {\r\n return x * x + y * y + z * z;\r\n }\r\n /** Return the (full 4d) hypotenuse `sqrt(x*x + y*y + z*z + w*w)`. This is much faster than `Math.hypot(x,y,z,w)`. */\r\n public static hypotenuseXYZW(x: number, y: number, z: number, w: number): number {\r\n return Math.sqrt(x * x + y * y + z * z + w * w);\r\n }\r\n /** Return the squared hypotenuse `(x*x + y*y + z*z+w*w)`. This is much faster than `Math.hypot(x,y,z)`. */\r\n public static hypotenuseSquaredXYZW(x: number, y: number, z: number, w: number): number {\r\n return x * x + y * y + z * z + w * w;\r\n }\r\n /**\r\n * Return the distance between xy points given as numbers.\r\n * @param x0 x coordinate of point 0\r\n * @param y0 y coordinate of point 0\r\n * @param x1 x coordinate of point 1\r\n * @param y1 y coordinate of point 1\r\n */\r\n public static distanceXYXY(x0: number, y0: number, x1: number, y1: number): number {\r\n return Geometry.hypotenuseXY(x1 - x0, y1 - y0);\r\n }\r\n /**\r\n * Return the distance between xyz points given as numbers.\r\n * @param x0 x coordinate of point 0\r\n * @param y0 y coordinate of point 0\r\n * @param z0 z coordinate of point 0\r\n * @param x1 x coordinate of point 1\r\n * @param y1 y coordinate of point 1\r\n * @param z1 z coordinate of point 1\r\n */\r\n public static distanceXYZXYZ(x0: number, y0: number, z0: number, x1: number, y1: number, z1: number): number {\r\n return Geometry.hypotenuseXYZ(x1 - x0, y1 - y0, z1 - z0);\r\n }\r\n /** Returns Returns the triple product of 3 vectors provided as x,y,z number sequences.\r\n *\r\n * * The triple product is the determinant of the 3x3 matrix with the 9 numbers (3 vectors placed in 3 rows).\r\n * * The triple product is positive if the 3 vectors form a right handed coordinate system.\r\n * * The triple product is negative if the 3 vectors form a left handed coordinate system.\r\n * * Treating the 9 numbers as 3 vectors U, V, W, any of these formulas gives the same result:\r\n * * U dot (V cross W)\r\n * * V dot (W cross U)\r\n * * W dot (U cross V)\r\n * * (-U dot (W cross V)) -- (note the negative -- reversing cross product order changes the sign)\r\n * * (-V dot (U cross W)) -- (note the negative -- reversing cross product order changes the sign)\r\n * * (-W dot (V cross U)) -- (note the negative -- reversing cross product order changes the sign)\r\n * * the triple product is 6 times the (signed) volume of the tetrahedron with the three vectors as edges from a common vertex.\r\n */\r\n public static tripleProduct(\r\n ux: number, uy: number, uz: number,\r\n vx: number, vy: number, vz: number,\r\n wx: number, wy: number, wz: number): number {\r\n return ux * (vy * wz - vz * wy)\r\n + uy * (vz * wx - vx * wz)\r\n + uz * (vx * wy - vy * wx);\r\n }\r\n /** Returns the determinant of the 4x4 matrix unrolled as the 16 parameters.\r\n */\r\n public static determinant4x4(\r\n xx: number, xy: number, xz: number, xw: number,\r\n yx: number, yy: number, yz: number, yw: number,\r\n zx: number, zy: number, zz: number, zw: number,\r\n wx: number, wy: number, wz: number, ww: number): number {\r\n return xx * this.tripleProduct(yy, yz, yw, zy, zz, zw, wy, wz, ww)\r\n - yx * this.tripleProduct(xy, xz, xw, zy, zz, zw, wy, wz, ww)\r\n + zx * this.tripleProduct(xy, xz, xw, yy, yz, yw, wy, wz, ww)\r\n - wx * this.tripleProduct(xy, xz, xw, yy, yz, yw, zy, zz, zw);\r\n }\r\n /** Return the mean curvature for two radii, with 0 radius implying 0 curvature */\r\n public static meanCurvatureOfRadii(r0: number, r1: number): number {\r\n return 0.5 * (this.safeDivideFraction(1, r0, 0) + this.safeDivideFraction(1, r1, 0));\r\n }\r\n /**\r\n * Returns curvature magnitude from a first and second derivative vector.\r\n * @param ux first derivative x component\r\n * @param uy first derivative y component\r\n * @param uz first derivative z component\r\n * @param vx second derivative x component\r\n * @param vy second derivative y component\r\n * @param vz second derivative z component\r\n */\r\n public static curvatureMagnitude(\r\n ux: number, uy: number, uz: number,\r\n vx: number, vy: number, vz: number): number {\r\n let q = uy * vz - uz * vy;\r\n let sum = q * q;\r\n q = uz * vx - ux * vz;\r\n sum += q * q;\r\n q = ux * vy - uy * vx;\r\n sum += q * q;\r\n const a = Math.sqrt(ux * ux + uy * uy + uz * uz);\r\n const b = Math.sqrt(sum);\r\n // (sum and a are both nonnegative)\r\n const aaa = a * a * a;\r\n // radius of curvature = aaa / b;\r\n // curvature = b/aaa\r\n const tol = Geometry.smallAngleRadians;\r\n if (aaa > tol * b)\r\n return b / aaa;\r\n return 0; // hm.. maybe should be infinite?\r\n }\r\n /** Returns the determinant of 3x3 matrix with x and y rows taken from 3 points, third row from corresponding numbers.\r\n *\r\n */\r\n public static tripleProductXYW(\r\n columnA: XAndY, weightA: number,\r\n columnB: XAndY, weightB: number,\r\n columnC: XAndY, weightC: number): number {\r\n return Geometry.tripleProduct(\r\n columnA.x, columnB.x, columnC.x,\r\n columnA.y, columnB.y, columnC.y,\r\n weightA, weightB, weightC);\r\n }\r\n /** Returns the determinant of 3x3 matrix with x and y rows taken from 3 points, third row from corresponding numbers.\r\n *\r\n */\r\n public static tripleProductPoint4dXYW(\r\n columnA: Point4d,\r\n columnB: Point4d,\r\n columnC: Point4d): number {\r\n return Geometry.tripleProduct(\r\n columnA.x, columnB.x, columnC.x,\r\n columnA.y, columnB.y, columnC.y,\r\n columnA.w, columnB.w, columnC.w);\r\n }\r\n /** 2D cross product of vectors layed out as scalars. */\r\n public static crossProductXYXY(ux: number, uy: number, vx: number, vy: number): number {\r\n return ux * vy - uy * vx;\r\n }\r\n /** 3D cross product of vectors layed out as scalars. */\r\n public static crossProductXYZXYZ(ux: number, uy: number, uz: number, vx: number, vy: number, vz: number, result?: Vector3d): Vector3d {\r\n return Vector3d.create(\r\n uy * vz - uz * vy,\r\n uz * vx - ux * vz,\r\n ux * vy - uy * vx, result);\r\n }\r\n /** magnitude of 3D cross product of vectors, with the vectors presented as */\r\n public static crossProductMagnitude(ux: number, uy: number, uz: number, vx: number, vy: number, vz: number): number {\r\n return Geometry.hypotenuseXYZ(\r\n uy * vz - uz * vy,\r\n uz * vx - ux * vz,\r\n ux * vy - uy * vx);\r\n }\r\n /** 3D dot product of vectors layed out as scalars. */\r\n public static dotProductXYZXYZ(ux: number, uy: number, uz: number, vx: number, vy: number, vz: number): number {\r\n return ux * vx + uy * vy + uz * vz;\r\n }\r\n /** 2D dot product of vectors layed out as scalars. */\r\n public static dotProductXYXY(ux: number, uy: number, vx: number, vy: number): number {\r\n return ux * vx + uy * vy;\r\n }\r\n /**\r\n * Clamp to (min(a,b), max(a,b))\r\n * * always returns a number between a and b\r\n * @param x\r\n * @param a\r\n * @param b\r\n */\r\n public static clampToStartEnd(x: number, a: number, b: number): number {\r\n if (a > b)\r\n return Geometry.clampToStartEnd(x, b, a);\r\n if (x < a)\r\n return a;\r\n if (b < x)\r\n return b;\r\n return x;\r\n }\r\n /**\r\n * Clamp value to (min,max) with no test for order of (min,max)\r\n * @param value value to clamp\r\n * @param min smallest allowed output\r\n * @param max largest allowed result.\r\n */\r\n public static clamp(value: number, min: number, max: number): number { return Math.max(min, Math.min(max, value)); }\r\n /** If given a number, return it. If given undefined, return `defaultValue`. */\r\n public static resolveNumber(value: number | undefined, defaultValue: number = 0): number {\r\n return value !== undefined ? value : defaultValue;\r\n }\r\n /** If given a value, return it. If given undefined, return `defaultValue`. */\r\n public static resolveValue<T>(value: T | undefined, defaultValue: T): T {\r\n return value !== undefined ? value : defaultValue;\r\n }\r\n /** If given value matches a target, return undefined. Otherwise return the value. */\r\n public static resolveToUndefined<T>(value: T | undefined, targetValue: T): T | undefined {\r\n return value === targetValue ? undefined : value;\r\n }\r\n /**\r\n * Simple interpolation between values, but choosing (based on fraction) a or b as starting\r\n * point for maximum accuracy.\r\n * * If `f = 0`, then `a` is returned and if `f = 1`, then `b` is returned.\r\n */\r\n public static interpolate(a: number, f: number, b: number): number {\r\n return f <= 0.5 ? a + f * (b - a) : b - (1.0 - f) * (b - a);\r\n }\r\n /**\r\n * Given an axisOrder (e.g. XYZ, YZX, etc) and an index, returns the axis index at the given index.\r\n * * For example, if axisOrder = XYZ, then for index 0 returns X (or axis index 0), for index 1 returns\r\n * Y (or axis index 1), and for index 2 returns Z (or axis index 2). For indexes greater than 2 or smaller\r\n * than 0, it returns cyclic axis index. See Geometry.cyclic3dAxis for more info.\r\n * * Another example: if axisOrder = ZYX, then for index 0 returns Z (or axis index 2), for index 1 returns\r\n * Y (or axis index 1), and for index 2 returns X (or axis index 0).\r\n * */\r\n public static axisOrderToAxis(order: AxisOrder, index: number): number {\r\n const axis = order <= AxisOrder.ZXY ? order + index : (order - AxisOrder.XZY) - index;\r\n return Geometry.cyclic3dAxis(axis);\r\n }\r\n /** Return (a modulo period), e.g. for use as a cyclic index. Both a and period may be negative. */\r\n public static modulo(a: number, period: number): number {\r\n if (period <= 0) {\r\n if (period === 0)\r\n return a;\r\n return -Geometry.modulo(-a, -period);\r\n }\r\n\r\n if (a >= 0) {\r\n if (a < period)\r\n return a;\r\n if (a < 2 * period)\r\n return a - period;\r\n } else {\r\n a += period; // hopefully move into primary period without division and floor\r\n if (a > 0)\r\n return a;\r\n }\r\n const m = Math.floor(a / period);\r\n return a - m * period;\r\n }\r\n /** return 0 if the value is undefined, 1 if defined. */\r\n public static defined01(value: any): number { return value === undefined ? 0 : 1; }\r\n /**\r\n * Return `numerator` divided by `denominator`, or `undefined`.\r\n * @param numerator the numerator\r\n * @param denominator the denominator\r\n * @returns return `numerator/denominator` but if the ratio would exceed `Geometry.largeFractionResult`,\r\n * return `undefined`.\r\n */\r\n public static conditionalDivideFraction(numerator: number, denominator: number): number | undefined {\r\n if (Math.abs(denominator) * Geometry.largeFractionResult > Math.abs(numerator))\r\n return numerator / denominator;\r\n return undefined;\r\n }\r\n /**\r\n * Return `numerator` divided by `denominator`.\r\n * @param numerator the numerator\r\n * @param denominator the denominator\r\n * @returns return `numerator/denominator` but if the ratio would exceed `Geometry.largeFractionResult`,\r\n * return `defaultResult`.\r\n */\r\n public static safeDivideFraction(numerator: number, denominator: number, defaultResult: number): number {\r\n const a = Geometry.conditionalDivideFraction(numerator, denominator);\r\n if (a !== undefined)\r\n return a;\r\n return defaultResult;\r\n }\r\n /**\r\n * Return `numerator` divided by `denominator` (with a given `largestResult`), or `undefined`.\r\n * @param numerator the numerator\r\n * @param denominator the denominator\r\n * @param largestResult the ratio threshold.\r\n * @returns return `numerator/denominator` but if the ratio would exceed `largestResult`, return `undefined`.\r\n */\r\n public static conditionalDivideCoordinate(numerator: number, denominator: number,\r\n largestResult: number = Geometry.largeCoordinateResult): number | undefined {\r\n if (Math.abs(denominator * largestResult) > Math.abs(numerator))\r\n return numerator / denominator;\r\n return undefined;\r\n }\r\n /** return the 0, 1, or 2 pairs of (c,s) values that solve\r\n * {constCoff + cosCoff * c + sinCoff * s = 0}\r\n * with the constraint {c*c+s*s = 1}\r\n */\r\n public static solveTrigForm(constCoff: number, cosCoff: number, sinCoff: number): Vector2d[] | undefined {\r\n {\r\n const delta2 = cosCoff * cosCoff + sinCoff * sinCoff;\r\n const constCoff2 = constCoff * constCoff;\r\n // nSolution = 0\r\n let result;\r\n if (delta2 > 0.0) {\r\n const lambda = - constCoff / delta2;\r\n const a2 = constCoff2 / delta2;\r\n const D2 = 1.0 - a2;\r\n if (-Geometry.smallMetricDistanceSquared < D2 && D2 <= 0.0) { // observed D2 = -2.22e-16 in rotated system\r\n // nSolution = 1\r\n const c0 = lambda * cosCoff;\r\n const s0 = lambda * sinCoff;\r\n result = [Vector2d.create(c0, s0)];\r\n } else if (D2 > 0.0) {\r\n const mu = Math.sqrt(D2 / delta2);\r\n /* c0,s0 = closest approach of line to origin */\r\n const c0 = lambda * cosCoff;\r\n const s0 = lambda * sinCoff;\r\n // nSolution = 2\r\n result = [Vector2d.create(c0 - mu * sinCoff, s0 + mu * cosCoff), Vector2d.create(c0 + mu * sinCoff, s0 - mu * cosCoff)];\r\n }\r\n }\r\n return result;\r\n }\r\n }\r\n /** For a line f(x) whose function values at x0 and x1 are f0 and f1, return the x value at which f(x)=fTarget; */\r\n public static inverseInterpolate(x0: number, f0: number, x1: number, f1: number, targetF: number = 0,\r\n defaultResult?: number): number | undefined {\r\n const g = Geometry.conditionalDivideFraction(targetF - f0, f1 - f0);\r\n if (g)\r\n return Geometry.interpolate(x0, g, x1);\r\n return defaultResult;\r\n }\r\n /** For a line f(x) whose function values at x=0 and x=1 are f0 and f1, return the x value at which f(x)=fTarget; */\r\n public static inverseInterpolate01(f0: number, f1: number, targetF: number = 0): number | undefined {\r\n return Geometry.conditionalDivideFraction(targetF - f0, f1 - f0);\r\n }\r\n /** Return true if json is an array with at least minEntries, and all entries are numbers (including those beyond minEntries) */\r\n public static isNumberArray(json: any, minEntries: number = 0): boolean {\r\n if (Array.isArray(json) && json.length >= minEntries) {\r\n let entry;\r\n for (entry of json) {\r\n // if (!(entry as number) && entry !== 0.0)\r\n if (!Number.isFinite(entry))\r\n return false;\r\n }\r\n return true;\r\n }\r\n return false;\r\n }\r\n /** Return true if json is an array of at least numNumberArrays, with at least minEntries in each number array.\r\n */\r\n public static isArrayOfNumberArray(json: any, numNumberArray: number, minEntries: number = 0): boolean {\r\n if (Array.isArray(json) && json.length >= numNumberArray) {\r\n let entry;\r\n for (entry of json)\r\n if (!Geometry.isNumberArray(entry, minEntries)) return false;\r\n return true;\r\n }\r\n return false;\r\n }\r\n /** return the number of steps to take so that numSteps * stepSize >= total.\r\n * minCount is returned for both (a) setSize 0 or less and (b) stepSize > total.\r\n * A small tolerance is applied for almost\r\n */\r\n public static stepCount(stepSize: number, total: number, minCount = 1, maxCount = 101): number {\r\n if (stepSize <= 0)\r\n return minCount;\r\n total = Math.abs(total);\r\n if (stepSize >= total)\r\n return minCount;\r\n const stepCount = Math.floor((total + 0.999999 * stepSize) / stepSize);\r\n if (stepCount < minCount)\r\n return minCount;\r\n if (stepCount > maxCount)\r\n return maxCount;\r\n return stepCount;\r\n }\r\n /** Test if x is in simple 0..1 interval. But optionally skip the test. (this odd behavior is very convenient for code that sometimes does not do the filtering.)\r\n * @param x value to test.\r\n * @param apply01 if false, accept all x.\r\n */\r\n public static isIn01(x: number, apply01: boolean = true): boolean { return apply01 ? x >= 0.0 && x <= 1.0 : true; }\r\n /** Test if x is in simple 0..1 interval. But optionally skip the test. (this odd behavior is very convenient for code that sometimes does not do the filtering.)\r\n * @param x value to test.\r\n * @param apply01 if false, accept all x.\r\n */\r\n public static isIn01WithTolerance(x: number, tolerance: number): boolean { return x + tolerance >= 0.0 && x - tolerance <= 1.0; }\r\n /**\r\n * restrict x so it is in the interval `[a,b]`, allowing a,b to be in either order.\r\n * @param x\r\n * @param a (usually the lower) interval limit\r\n * @param b (usually the upper) interval limit\r\n */\r\n public static restrictToInterval(x: number, a: number, b: number): number {\r\n if (a <= b) {\r\n if (x < a) return a;\r\n if (x > b) return b;\r\n return x;\r\n }\r\n // reversed interval ....\r\n if (x < b) return b;\r\n if (x > a) return a;\r\n return x;\r\n }\r\n /**\r\n * Case-insensitive string comparison.\r\n * * Return true if the toUpperCase values match.\r\n */\r\n public static equalStringNoCase(string1: string, string2: string): boolean {\r\n return string1.toUpperCase() === string2.toUpperCase();\r\n }\r\n /** test for EXACT match of number arrays. */\r\n public static exactEqualNumberArrays(a: number[] | undefined, b: number[] | undefined): boolean {\r\n if (Array.isArray(a) && a.length === 0)\r\n a = undefined;\r\n if (Array.isArray(b) && b.length === 0)\r\n b = undefined;\r\n if (a === undefined && b === undefined)\r\n return true;\r\n if (Array.isArray(a) && Array.isArray(b)) {\r\n if (a.length !== b.length)\r\n return false;\r\n for (let i = 0; i < a.length; i++)\r\n if (a[i] !== b[i])\r\n return false;\r\n return true;\r\n }\r\n return false;\r\n }\r\n /** test for match of XYZ arrays. */\r\n public static almostEqualArrays<T>(a: T[] | undefined, b: T[] | undefined,\r\n testFunction: (p: T, q: T) => boolean): boolean {\r\n if (Array.isArray(a) && a.length === 0)\r\n a = undefined;\r\n if (Array.isArray(b) && b.length === 0)\r\n b = undefined;\r\n if (a === undefined && b === undefined)\r\n return true;\r\n if (Array.isArray(a) && Array.isArray(b)) {\r\n if (a.length !== b.length)\r\n return false;\r\n for (let i = 0; i < a.length; i++) {\r\n if (!testFunction(a[i], b[i]))\r\n return false;\r\n }\r\n return true;\r\n }\r\n return false;\r\n }\r\n /** test for match of typed arrays (e.g. Float64Array). */\r\n public static almostEqualNumberArrays(a: number[] | Float64Array | undefined, b: number[] | Float64Array | undefined,\r\n testFunction: (p: number, q: number) => boolean): boolean {\r\n if (Array.isArray(a) && a.length === 0)\r\n a = undefined;\r\n if (Array.isArray(b) && b.length === 0)\r\n b = undefined;\r\n if (a === undefined && b === undefined)\r\n return true;\r\n if (Array.isArray(a) && Array.isArray(b)) {\r\n if (a.length !== b.length)\r\n return false;\r\n for (let i = 0; i < a.length; i++) {\r\n if (!testFunction(a[i], b[i]))\r\n return false;\r\n }\r\n return true;\r\n }\r\n return false;\r\n }\r\n /**\r\n * Return\r\n * * true if both values are defined and equal (with ===).\r\n * * false if both defined by not equal\r\n * * return (option arg) resultIfBothUndefined when both are undefined.\r\n * * return false if one is defined and the other undefined\r\n * @param a first value\r\n * @param b second value\r\n * @param resultIfBothUndefined return value when both are undefined.\r\n * @returns\r\n */\r\n public static areEqualAllowUndefined<T>(a: T | undefined, b: T | undefined, resultIfBothUndefined: boolean = true): boolean {\r\n if (a === undefined && b === undefined)\r\n return resultIfBothUndefined;\r\n if (a !== undefined && b !== undefined)\r\n return a === b;\r\n return false;\r\n }\r\n /** clone an array whose members have a clone method.\r\n * * undefined return from clone is forced into the output array.\r\n */\r\n public static cloneMembers<T extends Cloneable<T>>(a: T[] | undefined): T[] | undefined {\r\n if (a === undefined)\r\n return undefined;\r\n const b: T[] = [];\r\n for (const p of a) {\r\n b.push(p.clone()!);\r\n }\r\n return b;\r\n }\r\n}\r\n/**\r\n * interface for method with a clone operation\r\n * @public\r\n */\r\nexport interface Cloneable<T> {\r\n /** required method to return a deep clone. */\r\n clone(): T | undefined;\r\n}\r\n/** Options used for methods like [[Vector2d.isPerpendicularTo]] and [[Vector3d.isParallelTo]].\r\n * @public\r\n */\r\nexport interface PerpParallelOptions {\r\n /** Squared radian tolerance for comparing the angle between two vectors.\r\n * Default: [[Geometry.smallAngleRadiansSquared]].\r\n */\r\n radianSquaredTol?: number;\r\n /** Squared distance tolerance for detecting a zero-length vector.\r\n * Default: [[Geometry.smallMetricDistanceSquared]].\r\n */\r\n distanceSquaredTol?: number;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"Geometry.js","sourceRoot":"","sources":["../../src/Geometry.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAO/F,kEAAqE;AACrE,kEAAsE;AAItE,mEAAmE;AAEnE;;;;;;;GAOG;AACH,IAAY,SAaX;AAbD,WAAY,SAAS;IACnB,2CAA2C;IAC3C,uCAAO,CAAA;IACP,2CAA2C;IAC3C,uCAAO,CAAA;IACP,2CAA2C;IAC3C,uCAAO,CAAA;IACP,0CAA0C;IAC1C,uCAAO,CAAA;IACP,0CAA0C;IAC1C,uCAAO,CAAA;IACP,0CAA0C;IAC1C,uCAAO,CAAA;AACT,CAAC,EAbW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAapB;AACD;;;GAGG;AACH,IAAY,SAOX;AAPD,WAAY,SAAS;IACnB,wBAAwB;IACxB,mCAAK,CAAA;IACL,wBAAwB;IACxB,mCAAK,CAAA;IACL,wBAAwB;IACxB,mCAAK,CAAA;AACP,CAAC,EAPW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAOpB;AACD;;;GAGG;AACH,IAAY,iBAiBX;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jB,OAAO,KAAK,CAAC;IACf,CAAC;IACD;;;OAGG;IACI,MAAM,CAAC,YAAY,CAAyB,KAAsB;QACvE,IAAI,KAAK,KAAK,SAAS;YACrB,OAAO,SAAS,CAAC;QACnB,MAAM,WAAW,GAAQ,EAAE,CAAC;QAC5B,KAAK,MAAM,OAAO,IAAI,KAAK,EAAE;YAC3B,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAG,CAAC,CAAC;SACpC;QACD,OAAO,WAAW,CAAC;IACrB,CAAC;;AA/9BD,2DAA2D;AACpC,4BAAmB,GAAG,MAAM,CAAC;AACpD,uCAAuC;AAChB,mCAA0B,GAAG,OAAO,CAAC;AAC5D,qDAAqD;AAC9B,0BAAiB,GAAG,OAAO,CAAC;AACnD,qCAAqC;AACd,iCAAwB,GAAG,OAAO,CAAC;AAC1D,qDAAqD;AAC9B,0BAAiB,GAAG,OAAO,CAAC;AACnD,yDAAyD;AAClC,0BAAiB,GAAG,IAAI,CAAC;AAChD,+EAA+E;AACxD,sBAAa,GAAG,OAAO,CAAC;AAC/C,2EAA2E;AACpD,yCAAgC,GAAG,GAAG,GAAG,IAAI,CAAC,EAAE,GAAG,QAAQ,CAAC,iBAAiB,CAAC;AACrG;;;GAGG;AACoB,4BAAmB,GAAG,MAAM,CAAC;AACpD;;;GAGG;AACoB,8BAAqB,GAAG,MAAM,CAAC;AACtD;;;;;GAKG;AACoB,uBAAc,GAAG,MAAM,CAAC;AAjCpC,4BAAQ","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 { AngleSweep } from \"./geometry3d/AngleSweep\";\r\nimport { Point2d, Vector2d, XY } from \"./geometry3d/Point2dVector2d\";\r\nimport { Point3d, Vector3d, XYZ } from \"./geometry3d/Point3dVector3d\";\r\nimport { XAndY } from \"./geometry3d/XYZProps\";\r\nimport { Point4d } from \"./geometry4d/Point4d\";\r\n\r\n/* eslint-disable @typescript-eslint/naming-convention, no-empty */\r\n\r\n/**\r\n * Enumeration of the 6 possible orderings of XYZ axis order\r\n * * **Note:** There are 3 axis order with right hand system (XYZ = 0, YZX = 1, ZXY = 2) and 3 axis order with\r\n * left hand system (XZY = 4, YXZ = 5, ZYX = 6). Note that `AxisOrder` is encoding the handedness as well. Cross\r\n * product of the i_th axis in an ordering (i=0,1,2), with the i+1_th in that ordering, will produce the i+2_th\r\n * axis in that ordering.\r\n * @public\r\n */\r\nexport enum AxisOrder {\r\n /** Right handed system, X then Y then Z */\r\n XYZ = 0, /* eslint-disable-line @typescript-eslint/no-shadow */\r\n /** Right handed system, Y then Z then X */\r\n YZX = 1,\r\n /** Right handed system, Z then X then Y */\r\n ZXY = 2,\r\n /** Left handed system, X then Z then Y */\r\n XZY = 4,\r\n /** Left handed system, Y then X then Z */\r\n YXZ = 5,\r\n /** Left handed system, Z then Y then X */\r\n ZYX = 6,\r\n}\r\n/**\r\n * Enumeration of numeric indices of 3 axes AxisIndex.X, AxisIndex.Y, AxisIndex.Z\r\n * @public\r\n */\r\nexport enum AxisIndex {\r\n /** x axis is index 0 */\r\n X = 0,\r\n /** y axis is index 1 */\r\n Y = 1,\r\n /** 2 axis is index 2 */\r\n Z = 2,\r\n}\r\n/**\r\n * Standard views. Used in `Matrix3d.createStandardViewAxes(index: StandardViewIndex, invert: boolean)`\r\n * @public\r\n */\r\nexport enum StandardViewIndex {\r\n /** X to right, Y up */\r\n Top = 1,\r\n /** X to right, negative Y up */\r\n Bottom = 2,\r\n /** Negative Y to right, Z up */\r\n Left = 3,\r\n /** Y to right, Z up */\r\n Right = 4,\r\n /** X to right, Z up */\r\n Front = 5,\r\n /** Negative X to right, Z up */\r\n Back = 6,\r\n /** Isometric: view towards origin from (-1,-1,1) */\r\n Iso = 7, //\r\n /** Right isometric: view towards origin from (1,-1,1) */\r\n RightIso = 8,\r\n}\r\n/**\r\n * Enumeration among choice for how a coordinate transformation should incorporate scaling.\r\n * @public\r\n */\r\nexport enum AxisScaleSelect {\r\n /** All axes of unit length. */\r\n Unit = 0,\r\n /** On each axis, the vector length matches the longest side of the range of the data. */\r\n LongestRangeDirection = 1,\r\n /** On each axis, the vector length matches he length of the corresponding edge of the range. */\r\n NonUniformRangeContainment = 2,\r\n}\r\n/**\r\n * Object with a radians value and its associated cosine and sine values.\r\n * @public\r\n */\r\nexport interface TrigValues {\r\n /** The cosine value */\r\n c: number;\r\n /** The sine value */\r\n s: number;\r\n /** The radians value */\r\n radians: number;\r\n}\r\n\r\n/**\r\n * Plane Evaluation methods.\r\n * * These provide the necessary queries to implement clipping operations without knowing if the plane in use\r\n * is a [[ClipPlane]], [[Plane3dByOriginAndUnitNormal]], [[Plane3dByOriginAndVectors]], [[Point4d]].\r\n * * The Plane3d class declares obligation to implement these methods, and\r\n * passes the obligation on to concrete implementations by declaring them as abstract members which the particular classes can implement.\r\n * * It is intended that this interface be deprecated because its implementation by [[Plane3d]] provides all of its functionality and allows more to be added.\r\n * @public\r\n */\r\nexport interface PlaneAltitudeEvaluator {\r\n /**\r\n * Return the altitude of the `point` from the plane.\r\n * @param point the point for evaluation\r\n */\r\n altitude(point: Point3d): number;\r\n /**\r\n * Return the altitude of the `point` from the plane, with the point supplied as simple x,y,z\r\n * @param x x coordinate of the point\r\n * @param y y coordinate of the point\r\n * @param z z coordinate of the point\r\n */\r\n altitudeXYZ(x: number, y: number, z: number): number;\r\n /**\r\n * Return the derivative of altitude with respect to motion along a `vector`.\r\n * @param vector the vector\r\n */\r\n velocity(vector: Vector3d): number;\r\n /**\r\n * Return the derivative of altitude with respect to motion along a `vector` given by components.\r\n * @param x x coordinate of the vector\r\n * @param y y coordinate of the vector\r\n * @param z z coordinate of the vector\r\n */\r\n velocityXYZ(x: number, y: number, z: number): number;\r\n /**\r\n * Return the weighted altitude\r\n * @param point xyzw data.\r\n */\r\n weightedAltitude(point: Point4d): number;\r\n /** x part of normal vector */\r\n normalX(): number;\r\n /** x part of normal vector */\r\n normalY(): number;\r\n /** x part of normal vector */\r\n normalZ(): number;\r\n}\r\n/**\r\n * Enumeration of possible locations of a point in the plane of a polygon.\r\n * @public\r\n */\r\nexport enum PolygonLocation {\r\n /** No location specified. */\r\n Unknown = 0,\r\n /** Point is at a vertex. */\r\n OnPolygonVertex = 1,\r\n /** Point is on an edge (but not a vertex). */\r\n OnPolygonEdgeInterior = 2,\r\n /** Point is strictly inside the polygon with unknown projection. */\r\n InsidePolygon = 3,\r\n /** Point is strictly inside the polygon and projects to a vertex. */\r\n InsidePolygonProjectsToVertex = 4,\r\n /** Point is strictly inside the polygon and projects to an edge (but not a vertex). */\r\n InsidePolygonProjectsToEdgeInterior = 5,\r\n /** Point is strictly outside the polygon with unknown projection. */\r\n OutsidePolygon = 6,\r\n /** Point is strictly outside the polygon and projects to a vertex. */\r\n OutsidePolygonProjectsToVertex = 7,\r\n /** Point is strictly outside the polygon and projects to an edge (but not a vertex). */\r\n OutsidePolygonProjectsToEdgeInterior = 8,\r\n}\r\n/**\r\n * Interface for `toJSON` and `setFromJSON` methods\r\n * @public\r\n */\r\nexport interface BeJSONFunctions {\r\n /**\r\n * Set content from a JSON object.\r\n * If the json object is undefined or unrecognized, always set a default value.\r\n */\r\n setFromJSON(json: any): void;\r\n /** Return a json object with this object's contents. */\r\n toJSON(): any;\r\n}\r\n/**\r\n * The properties for a JSON representation of an `Angle`.\r\n * * If AngleProps data is a number, it is in **degrees**.\r\n * * If AngleProps data is an object, it can have either degrees or radians.\r\n * @public\r\n */\r\nexport type AngleProps =\r\n { degrees: number } |\r\n { radians: number } |\r\n { _radians: number } |\r\n { _degrees: number } |\r\n number;\r\n/**\r\n * The properties for a JSON representation of an `AngleSweep`.\r\n * * The json data is always *start* and *end* angles as a pair in an array.\r\n * * If AngleSweepProps data is an array of two numbers, those are both angles in `degrees`.\r\n * * If AngleSweepProps data is an object with key `degrees`, then the corresponding value must be an array of\r\n * two numbers, the start and end angles in degrees.\r\n * * If the AngleSweepProps is an object with key `radians`, then the corresponding value must be an array of\r\n * two numbers, the start and end angles in radians.\r\n * @public\r\n */\r\nexport type AngleSweepProps =\r\n AngleSweep |\r\n { degrees: [number, number] } |\r\n { radians: [number, number] } |\r\n [number, number];\r\n/**\r\n* Interface for method with a clone operation.\r\n* @public\r\n*/\r\nexport interface Cloneable<T> {\r\n /** Required method to return a deep clone. */\r\n clone(): T | undefined;\r\n}\r\n/** Options used for methods like [[Vector2d.isPerpendicularTo]] and [[Vector3d.isParallelTo]].\r\n * @public\r\n */\r\nexport interface PerpParallelOptions {\r\n /**\r\n * Squared radian tolerance for comparing the angle between two vectors.\r\n * Default: [[Geometry.smallAngleRadiansSquared]].\r\n */\r\n radianSquaredTol?: number;\r\n /**\r\n * Squared distance tolerance for detecting a zero-length vector.\r\n * Default: [[Geometry.smallMetricDistanceSquared]].\r\n */\r\n distanceSquaredTol?: number;\r\n}\r\n\r\n/**\r\n * Class containing static methods for typical numeric operations.\r\n * * Experimentally, methods like Geometry.hypotenuse are observed to be faster than the system intrinsics.\r\n * * This is probably due to\r\n * * Fixed length arg lists\r\n * * strongly typed parameters\r\n * @public\r\n */\r\nexport class Geometry {\r\n /** Tolerance for small distances in metric coordinates. */\r\n public static readonly smallMetricDistance = 1.0e-6;\r\n /** Square of `smallMetricDistance`. */\r\n public static readonly smallMetricDistanceSquared = 1.0e-12;\r\n /** Tolerance for small angle measured in radians. */\r\n public static readonly smallAngleRadians = 1.0e-12;\r\n /** Square of `smallAngleRadians`. */\r\n public static readonly smallAngleRadiansSquared = 1.0e-24;\r\n /** Tolerance for small angle measured in degrees. */\r\n public static readonly smallAngleDegrees = 5.7e-11;\r\n /** Tolerance for small angle measured in arc-seconds. */\r\n public static readonly smallAngleSeconds = 2e-7;\r\n /** Numeric value that may be considered zero for fractions between 0 and 1. */\r\n public static readonly smallFraction = 1.0e-10;\r\n /** Radians value for full circle 2PI radians minus `smallAngleRadians`. */\r\n public static readonly fullCircleRadiansMinusSmallAngle = 2.0 * Math.PI - Geometry.smallAngleRadians;\r\n /**\r\n * Numeric value that may be considered large for a ratio of numbers.\r\n * * Note that the allowed result value is vastly larger than 1.\r\n */\r\n public static readonly largeFractionResult = 1.0e10;\r\n /**\r\n * Numeric value that may considered large for numbers expected to be coordinates.\r\n * * This allows larger results than `largeFractionResult`.\r\n */\r\n public static readonly largeCoordinateResult = 1.0e13;\r\n /**\r\n * Numeric value that may considered infinite for metric coordinates.\r\n * @deprecated in 4.x. Use `largeCoordinateResult`.\r\n * * This coordinate should be used only as a placeholder indicating \"at infinity\" -- computing actual\r\n * points at this coordinate invites numerical problems.\r\n */\r\n public static readonly hugeCoordinate = 1.0e12;\r\n /** Test if absolute value of x is large (larger than `Geometry.largeCoordinateResult`) */\r\n public static isLargeCoordinateResult(x: number): boolean {\r\n return x > this.largeCoordinateResult || x < - this.largeCoordinateResult;\r\n }\r\n /**\r\n * Test if absolute value of x is large (larger than `Geometry.largeCoordinateResult`).\r\n * @deprecated in 4.x. Use `isLargeCoordinateResult`.\r\n */\r\n public static isHugeCoordinate(x: number): boolean {\r\n return Geometry.isLargeCoordinateResult(x);\r\n }\r\n /** Test if a number is odd */\r\n public static isOdd(x: number): boolean {\r\n return (x & (0x01)) === 1; // bitwise operation\r\n }\r\n /**\r\n * Correct distance to zero.\r\n * * If `distance` magnitude is `undefined` or smaller than `smallMetricDistance`, then return `replacement`\r\n * (or 0 if replacement is not passed). Otherwise return `distance`.\r\n */\r\n public static correctSmallMetricDistance(distance: number | undefined, replacement: number = 0.0): number {\r\n if (distance === undefined || Math.abs(distance) < Geometry.smallMetricDistance) {\r\n return replacement;\r\n }\r\n return distance;\r\n }\r\n /**\r\n * Correct `fraction` to `replacement` if `fraction` is undefined or too small.\r\n * @param fraction number to test\r\n * @param replacement value to return if `fraction` is too small\r\n * @returns `fraction` if its absolute value is at least `Geometry.smallFraction`; otherwise returns `replacement`\r\n */\r\n public static correctSmallFraction(fraction: number | undefined, replacement: number = 0.0): number {\r\n if (fraction === undefined || Math.abs(fraction) < Geometry.smallFraction) {\r\n return replacement;\r\n }\r\n return fraction;\r\n }\r\n /**\r\n * Return the inverse of `distance`.\r\n * * If `distance` magnitude is smaller than `smallMetricDistance` (i.e. distance is large enough for safe division),\r\n * then return `1/distance`. Otherwise return `undefined`.\r\n */\r\n public static inverseMetricDistance(distance: number): number | undefined {\r\n return (Math.abs(distance) <= Geometry.smallMetricDistance) ? undefined : 1.0 / distance;\r\n }\r\n /**\r\n * Return the inverse of `distanceSquared`.\r\n * * If `distanceSquared ` magnitude is smaller than `smallMetricDistanceSquared` (i.e. distanceSquared is large\r\n * enough for safe division), then return `1/distanceSquared `. Otherwise return `undefined`.\r\n */\r\n public static inverseMetricDistanceSquared(distanceSquared: number): number | undefined {\r\n return (Math.abs(distanceSquared) <= Geometry.smallMetricDistanceSquared) ? undefined : 1.0 / distanceSquared;\r\n }\r\n /**\r\n * Boolean test for metric coordinate near-equality (i.e., if `x` and `y` are almost equal) using `tolerance`.\r\n * * `Geometry.smallMetricDistance` is used if tolerance is `undefined`.\r\n */\r\n public static isSameCoordinate(x: number, y: number, tolerance: number = Geometry.smallMetricDistance): boolean {\r\n let d = x - y;\r\n if (d < 0)\r\n d = -d;\r\n return d <= tolerance;\r\n }\r\n /**\r\n * Boolean test for metric coordinate near-equality (i.e., if `x` and `y` are almost equal) using\r\n * `tolerance = toleranceFactor * smallMetricDistance`\r\n * */\r\n public static isSameCoordinateWithToleranceFactor(x: number, y: number, toleranceFactor: number): boolean {\r\n return Geometry.isSameCoordinate(x, y, toleranceFactor * Geometry.smallMetricDistance);\r\n }\r\n /**\r\n * Boolean test for metric coordinate pair near-equality (i.e., if `x0` and `x1` are almost equal\r\n * and `y0` and `y1` are almost equal) using `tolerance`.\r\n * * `Geometry.smallMetricDistance` is used if tolerance is `undefined`.\r\n */\r\n public static isSameCoordinateXY(\r\n x0: number, y0: number, x1: number, y1: number, tolerance: number = Geometry.smallMetricDistance\r\n ): boolean {\r\n let d = x1 - x0;\r\n if (d < 0)\r\n d = -d;\r\n if (d > tolerance)\r\n return false;\r\n d = y1 - y0;\r\n if (d < 0)\r\n d = -d;\r\n return d <= tolerance;\r\n }\r\n /**\r\n * Boolean test for squared metric coordinate near-equality (i.e., if `sqrt(x)` and `sqrt(y)` are\r\n * almost equal) using `tolerance`.\r\n * * `Geometry.smallMetricDistance` is used if tolerance is `undefined`.\r\n */\r\n public static isSameCoordinateSquared(\r\n x: number, y: number, tolerance: number = Geometry.smallMetricDistance\r\n ): boolean {\r\n return Math.abs(Math.sqrt(x) - Math.sqrt(y)) <= tolerance;\r\n }\r\n /**\r\n * Boolean test for small `dataA.distance(dataB)` within `tolerance`.\r\n * * `Geometry.smallMetricDistance` is used if tolerance is `undefined`.\r\n */\r\n public static isSamePoint3d(\r\n dataA: Point3d, dataB: Point3d, tolerance: number = Geometry.smallMetricDistance\r\n ): boolean {\r\n return dataA.distance(dataB) <= tolerance;\r\n }\r\n /**\r\n * Boolean test for small xyz-distance within `tolerance`.\r\n * * `Geometry.smallMetricDistance` is used if tolerance is `undefined`.\r\n * * Note that Point3d and Vector3d are both derived from XYZ, so this method tolerates mixed types.\r\n */\r\n public static isSameXYZ(\r\n dataA: XYZ, dataB: XYZ, tolerance: number = Geometry.smallMetricDistance\r\n ): boolean {\r\n return dataA.distance(dataB) <= tolerance;\r\n }\r\n /**\r\n * Boolean test for small xy-distance (ignoring z) within `tolerance`.\r\n * * `Geometry.smallMetricDistance` is used if tolerance is `undefined`.\r\n */\r\n public static isSamePoint3dXY(\r\n dataA: Point3d, dataB: Point3d, tolerance: number = Geometry.smallMetricDistance\r\n ): boolean {\r\n return dataA.distanceXY(dataB) <= tolerance;\r\n }\r\n /**\r\n * Boolean test for small xyz-distance within `tolerance`.\r\n * * `Geometry.smallMetricDistance` is used if tolerance is `undefined`.\r\n */\r\n public static isSameVector3d(\r\n dataA: Vector3d, dataB: Vector3d, tolerance: number = Geometry.smallMetricDistance\r\n ): boolean {\r\n return dataA.distance(dataB) <= tolerance;\r\n }\r\n /**\r\n * Boolean test for small xy-distance within `tolerance`.\r\n * * `Geometry.smallMetricDistance` is used if tolerance is `undefined`.\r\n */\r\n public static isSamePoint2d(\r\n dataA: Point2d, dataB: Point2d, tolerance: number = Geometry.smallMetricDistance\r\n ): boolean {\r\n return dataA.distance(dataB) <= tolerance;\r\n }\r\n /**\r\n * Boolean test for small xy-distance within `tolerance`.\r\n * * `Geometry.smallMetricDistance` is used if tolerance is `undefined`.\r\n */\r\n public static isSameVector2d(\r\n dataA: Vector2d, dataB: Vector2d, tolerance: number = Geometry.smallMetricDistance\r\n ): boolean {\r\n return dataA.distance(dataB) <= tolerance;\r\n }\r\n /**\r\n * Lexical comparison of (a.x, a.y) and (b.x, b.y) with x as first test and y as second (z is ignored).\r\n * * This is appropriate for a horizontal sweep in the plane.\r\n */\r\n public static lexicalXYLessThan(a: XY | XYZ, b: XY | XYZ): -1 | 0 | 1 {\r\n if (a.x < b.x)\r\n return -1;\r\n else if (a.x > b.x)\r\n return 1;\r\n if (a.y < b.y)\r\n return -1;\r\n else if (a.y > b.y)\r\n return 1;\r\n return 0;\r\n }\r\n /**\r\n * Lexical comparison of (a.x, a.y) and (b.x, b.y) with y as first test and x as second (z is ignored).\r\n * * This is appropriate for a vertical sweep in the plane.\r\n */\r\n public static lexicalYXLessThan(a: XY | XYZ, b: XY | XYZ): -1 | 0 | 1 {\r\n if (a.y < b.y)\r\n return -1;\r\n else if (a.y > b.y)\r\n return 1;\r\n if (a.x < b.x)\r\n return -1;\r\n else if (a.x > b.x)\r\n return 1;\r\n return 0;\r\n }\r\n /** Lexical comparison of (a.x, a.y, a.z) and (b.x, b.y, b.z) with x as first test, y as second, and z as third. */\r\n public static lexicalXYZLessThan(a: XYZ, b: XYZ): -1 | 0 | 1 {\r\n if (a.x < b.x)\r\n return -1;\r\n else if (a.x > b.x)\r\n return 1;\r\n if (a.y < b.y)\r\n return -1;\r\n else if (a.y > b.y)\r\n return 1;\r\n if (a.z < b.z)\r\n return -1;\r\n else if (a.z > b.z)\r\n return 1;\r\n return 0;\r\n }\r\n /**\r\n * Test if `value` is small compared to `smallFraction`.\r\n * * This is appropriate if `value` is know to be a typical 0..1 fraction.\r\n */\r\n public static isSmallRelative(value: number): boolean {\r\n return Math.abs(value) < Geometry.smallFraction;\r\n }\r\n /** Test if `value` is small compared to `smallAngleRadians` */\r\n public static isSmallAngleRadians(value: number): boolean {\r\n return Math.abs(value) < Geometry.smallAngleRadians;\r\n }\r\n /**\r\n * Returns `true` if both values are `undefined` or if both are defined and almost equal within tolerance.\r\n * If one is `undefined` and the other is not, then `false` is returned.\r\n */\r\n public static isAlmostEqualOptional(a: number | undefined, b: number | undefined, tolerance: number): boolean {\r\n if (a !== undefined && b !== undefined) {\r\n if (Math.abs(a - b) > tolerance)\r\n return false;\r\n } else {\r\n if (a !== undefined || b !== undefined)\r\n return false;\r\n }\r\n return true;\r\n }\r\n /**\r\n * Toleranced equality test using tolerance `tolerance * ( 1 + abs(a) + abs(b) )`.\r\n * * `Geometry.smallAngleRadians` is used if tolerance is `undefined`.\r\n */\r\n public static isAlmostEqualNumber(a: number, b: number, tolerance: number = Geometry.smallAngleRadians): boolean {\r\n const sumAbs = 1.0 + Math.abs(a) + Math.abs(b);\r\n return Math.abs(a - b) <= tolerance * sumAbs;\r\n }\r\n /**\r\n * Toleranced equality test using tolerance `tolerance * ( 1 + abs(a.x) + abs(a.y) + abs(b.x) + abs(b.y) )`.\r\n * * `Geometry.smallAngleRadians` is used if tolerance is `undefined`.\r\n */\r\n public static isAlmostEqualXAndY(a: XAndY, b: XAndY, tolerance: number = Geometry.smallAngleRadians): boolean {\r\n const tol = tolerance * (1.0 + Math.abs(a.x) + Math.abs(b.x) + Math.abs(a.y) + Math.abs(b.y));\r\n return (Math.abs(a.x - b.x) <= tol) && (Math.abs(a.y - b.y) <= tol);\r\n }\r\n /**\r\n * Toleranced equality test using caller-supplied `tolerance`.\r\n * * `Geometry.smallMetricDistance` is used if tolerance is `undefined`.\r\n */\r\n public static isDistanceWithinTol(distance: number, tolerance: number = Geometry.smallMetricDistance): boolean {\r\n return Math.abs(distance) <= tolerance;\r\n }\r\n /** Toleranced equality test using `smallMetricDistance` tolerance. */\r\n public static isSmallMetricDistance(distance: number): boolean {\r\n return Math.abs(distance) <= Geometry.smallMetricDistance;\r\n }\r\n /** Toleranced equality test using `smallMetricDistanceSquared` tolerance. */\r\n public static isSmallMetricDistanceSquared(distanceSquared: number): boolean {\r\n return Math.abs(distanceSquared) <= Geometry.smallMetricDistanceSquared;\r\n }\r\n /**\r\n * Return `axis modulo 3` with proper handling of negative indices\r\n * ..., -3:x, -2:y, -1:z, 0:x, 1:y, 2:z, 3:x, 4:y, 5:z, 6:x, 7:y, 8:z, ...\r\n */\r\n public static cyclic3dAxis(axis: number): number {\r\n /* Direct test for the most common cases to avoid more expensive modulo operation */\r\n if (axis >= 0) {\r\n if (axis < 3)\r\n return axis;\r\n if (axis < 6)\r\n return axis - 3;\r\n return axis % 3;\r\n }\r\n const j = axis + 3;\r\n if (j >= 0)\r\n return j;\r\n return 2 - ((-axis - 1) % 3);\r\n }\r\n /**\r\n * Return the `AxisOrder` for which `axisIndex` is the first named axis.\r\n * * `axisIndex === 0` returns `AxisOrder.XYZ`\r\n * * `axisIndex === 1` returns `AxisOrder.YZX`\r\n * * `axisIndex === 2` returns `AxisOrder.ZXY`\r\n */\r\n public static axisIndexToRightHandedAxisOrder(axisIndex: AxisIndex): AxisOrder {\r\n if (axisIndex === 0)\r\n return AxisOrder.XYZ;\r\n if (axisIndex === 1)\r\n return AxisOrder.YZX;\r\n if (axisIndex === 2)\r\n return AxisOrder.ZXY;\r\n return Geometry.axisIndexToRightHandedAxisOrder(Geometry.cyclic3dAxis(axisIndex));\r\n }\r\n /** Return the largest signed value among `a`, `b`, and `c` */\r\n public static maxXYZ(a: number, b: number, c: number): number {\r\n let max = a;\r\n if (b > max)\r\n max = b;\r\n if (c > max)\r\n max = c;\r\n return max;\r\n }\r\n /** Return the smallest signed value among `a`, `b`, and `c` */\r\n public static minXYZ(a: number, b: number, c: number): number {\r\n let min = a;\r\n if (b < min)\r\n min = b;\r\n if (c < min)\r\n min = c;\r\n return min;\r\n }\r\n /** Return the largest signed value among `a` and `b` */\r\n public static maxXY(a: number, b: number): number {\r\n let max = a;\r\n if (b > max)\r\n max = b;\r\n return max;\r\n }\r\n /** Return the smallest signed value among `a` and `b` */\r\n public static minXY(a: number, b: number): number {\r\n let min = a;\r\n if (b < min)\r\n min = b;\r\n return min;\r\n }\r\n /** Return the largest absolute value among `x`, `y`, and `z` */\r\n public static maxAbsXYZ(x: number, y: number, z: number): number {\r\n return Geometry.maxXYZ(Math.abs(x), Math.abs(y), Math.abs(z));\r\n }\r\n /** Return the largest absolute value among `x` and `y` */\r\n public static maxAbsXY(x: number, y: number): number {\r\n return Geometry.maxXY(Math.abs(x), Math.abs(y));\r\n }\r\n /** Return the largest absolute distance from `a` to either of `b0` or `b1` */\r\n public static maxAbsDiff(a: number, b0: number, b1: number): number {\r\n return Math.max(Math.abs(a - b0), Math.abs(a - b1));\r\n }\r\n /**\r\n * Examine the sign of `x`.\r\n * * If `x` is negative, return `outNegative`\r\n * * If `x` is true zero, return `outZero`\r\n * * If `x` is positive, return `outPositive`\r\n */\r\n public static split3WaySign(x: number, outNegative: number, outZero: number, outPositive: number): number {\r\n if (x < 0)\r\n return outNegative;\r\n if (x > 0.0)\r\n return outPositive;\r\n return outZero;\r\n }\r\n /**\r\n * Examine the value (particularly sign) of x.\r\n * * If x is negative, return -1\r\n * * If x is true zero, return 0\r\n * * If x is positive, return 1\r\n */\r\n public static split3Way01(x: number, tolerance: number = Geometry.smallMetricDistance): -1 | 0 | 1 {\r\n if (x > tolerance)\r\n return 1;\r\n if (x < -tolerance)\r\n return -1;\r\n return 0;\r\n }\r\n /** Return the square of x */\r\n public static square(x: number): number {\r\n return x * x;\r\n }\r\n /**\r\n * Return the hypotenuse (i.e., `sqrt(x*x + y*y)`).\r\n * * This is much faster than `Math.hypot(x,y)`.\r\n */\r\n public static hypotenuseXY(x: number, y: number): number {\r\n return Math.sqrt(x * x + y * y);\r\n }\r\n /** Return the squared hypotenuse (i.e., `x*x + y*y`). */\r\n public static hypotenuseSquaredXY(x: number, y: number): number {\r\n return x * x + y * y;\r\n }\r\n /**\r\n * Return the hypotenuse (i.e., `sqrt(x*x + y*y + z*z)`).\r\n * * This is much faster than `Math.hypot(x,y,z)`.\r\n */\r\n public static hypotenuseXYZ(x: number, y: number, z: number): number {\r\n return Math.sqrt(x * x + y * y + z * z);\r\n }\r\n /** Return the squared hypotenuse (i.e., `x*x + y*y + z*z`). */\r\n public static hypotenuseSquaredXYZ(x: number, y: number, z: number): number {\r\n return x * x + y * y + z * z;\r\n }\r\n /**\r\n * Return the full 4d hypotenuse (i.e., `sqrt(x*x + y*y + z*z + w*w)`).\r\n * * This is much faster than `Math.hypot(x,y,z,w)`.\r\n */\r\n public static hypotenuseXYZW(x: number, y: number, z: number, w: number): number {\r\n return Math.sqrt(x * x + y * y + z * z + w * w);\r\n }\r\n /** Return the squared hypotenuse (i.e., `x*x + y*y + z*z + w*w`). */\r\n public static hypotenuseSquaredXYZW(x: number, y: number, z: number, w: number): number {\r\n return x * x + y * y + z * z + w * w;\r\n }\r\n /**\r\n * Return the distance between xy points given as numbers.\r\n * @param x0 x coordinate of point 0\r\n * @param y0 y coordinate of point 0\r\n * @param x1 x coordinate of point 1\r\n * @param y1 y coordinate of point 1\r\n */\r\n public static distanceXYXY(x0: number, y0: number, x1: number, y1: number): number {\r\n return Geometry.hypotenuseXY(x1 - x0, y1 - y0);\r\n }\r\n /**\r\n * Return the distance between xyz points given as numbers.\r\n * @param x0 x coordinate of point 0\r\n * @param y0 y coordinate of point 0\r\n * @param z0 z coordinate of point 0\r\n * @param x1 x coordinate of point 1\r\n * @param y1 y coordinate of point 1\r\n * @param z1 z coordinate of point 1\r\n */\r\n public static distanceXYZXYZ(x0: number, y0: number, z0: number, x1: number, y1: number, z1: number): number {\r\n return Geometry.hypotenuseXYZ(x1 - x0, y1 - y0, z1 - z0);\r\n }\r\n /**\r\n * Returns the triple product of 3 vectors provided as x,y,z number sequences.\r\n * * The triple product is the determinant of the 3x3 matrix with the 9 numbers (3 vectors placed in 3 rows).\r\n * * The triple product is positive if the 3 vectors form a right handed coordinate system.\r\n * * The triple product is negative if the 3 vectors form a left handed coordinate system.\r\n * * Treating the 9 numbers as 3 vectors U, V, W, any of these formulas gives the same result:\r\n * * U dot (V cross W)\r\n * * V dot (W cross U)\r\n * * W dot (U cross V)\r\n * * -U dot (W cross V)\r\n * * -V dot (U cross W)\r\n * * -W dot (V cross U)\r\n * * Note the negative in the last 3 formulas. Reversing cross product order changes the sign.\r\n * * The triple product is 6 times the (signed) volume of the tetrahedron with the three vectors as edges from a\r\n * common vertex.\r\n */\r\n public static tripleProduct(\r\n ux: number, uy: number, uz: number,\r\n vx: number, vy: number, vz: number,\r\n wx: number, wy: number, wz: number\r\n ): number {\r\n return ux * (vy * wz - vz * wy)\r\n + uy * (vz * wx - vx * wz)\r\n + uz * (vx * wy - vy * wx);\r\n }\r\n /** Returns the determinant of the 4x4 matrix unrolled as the 16 parameters */\r\n public static determinant4x4(\r\n xx: number, xy: number, xz: number, xw: number,\r\n yx: number, yy: number, yz: number, yw: number,\r\n zx: number, zy: number, zz: number, zw: number,\r\n wx: number, wy: number, wz: number, ww: number\r\n ): number {\r\n return xx * this.tripleProduct(yy, yz, yw, zy, zz, zw, wy, wz, ww)\r\n - yx * this.tripleProduct(xy, xz, xw, zy, zz, zw, wy, wz, ww)\r\n + zx * this.tripleProduct(xy, xz, xw, yy, yz, yw, wy, wz, ww)\r\n - wx * this.tripleProduct(xy, xz, xw, yy, yz, yw, zy, zz, zw);\r\n }\r\n /**\r\n * Returns the determinant of 3x3 matrix with first and second rows created from the 3 xy points and the third\r\n * row created from the 3 numbers:\r\n * [columnA.x columnB.x columnC.x]\r\n * [columnA.y columnB.y columnC.y]\r\n * [ weightA weightB weightC ]\r\n */\r\n public static tripleProductXYW(\r\n columnA: XAndY, weightA: number,\r\n columnB: XAndY, weightB: number,\r\n columnC: XAndY, weightC: number\r\n ): number {\r\n return Geometry.tripleProduct(\r\n columnA.x, columnB.x, columnC.x,\r\n columnA.y, columnB.y, columnC.y,\r\n weightA, weightB, weightC\r\n );\r\n }\r\n /**\r\n * Returns the determinant of 3x3 matrix columns created by the given `Point4d` ignoring the z part:\r\n * [columnA.x columnB.x columnC.x]\r\n * [columnA.y columnB.y columnC.y]\r\n * [columnA.w columnB.w columnC.w]\r\n */\r\n public static tripleProductPoint4dXYW(columnA: Point4d, columnB: Point4d, columnC: Point4d): number {\r\n return Geometry.tripleProduct(\r\n columnA.x, columnB.x, columnC.x,\r\n columnA.y, columnB.y, columnC.y,\r\n columnA.w, columnB.w, columnC.w\r\n );\r\n }\r\n /** 2D cross product of vectors with the vectors presented as numbers. */\r\n public static crossProductXYXY(ux: number, uy: number, vx: number, vy: number): number {\r\n return ux * vy - uy * vx;\r\n }\r\n /** 3D cross product of vectors with the vectors presented as numbers. */\r\n public static crossProductXYZXYZ(\r\n ux: number, uy: number, uz: number, vx: number, vy: number, vz: number, result?: Vector3d\r\n ): Vector3d {\r\n return Vector3d.create(\r\n uy * vz - uz * vy,\r\n uz * vx - ux * vz,\r\n ux * vy - uy * vx,\r\n result\r\n );\r\n }\r\n /** Magnitude of 3D cross product of vectors with the vectors presented as numbers. */\r\n public static crossProductMagnitude(\r\n ux: number, uy: number, uz: number, vx: number, vy: number, vz: number\r\n ): number {\r\n return Geometry.hypotenuseXYZ(\r\n uy * vz - uz * vy,\r\n uz * vx - ux * vz,\r\n ux * vy - uy * vx\r\n );\r\n }\r\n /** 2D dot product of vectors with the vectors presented as numbers. */\r\n public static dotProductXYXY(ux: number, uy: number, vx: number, vy: number): number {\r\n return ux * vx + uy * vy;\r\n }\r\n /** 3D dot product of vectors with the vectors presented as numbers. */\r\n public static dotProductXYZXYZ(ux: number, uy: number, uz: number, vx: number, vy: number, vz: number): number {\r\n return ux * vx + uy * vy + uz * vz;\r\n }\r\n /**\r\n * Return the mean curvature for two radii.\r\n * * Curvature is the reciprocal of radius.\r\n * * 0 radius implies 0 curvature.\r\n * @param r0 first radius\r\n * @param r1 second radius\r\n */\r\n public static meanCurvatureOfRadii(r0: number, r1: number): number {\r\n return 0.5 * (this.safeDivideFraction(1, r0, 0) + this.safeDivideFraction(1, r1, 0));\r\n }\r\n /**\r\n * Returns curvature from the first and second derivative vectors.\r\n * * If U is the first derivative and V is the second derivative, the curvature is defined as:\r\n * * `|| U x V || / || U ||^3`.\r\n * * Math details can be found at https://en.wikipedia.org/wiki/Curvature#General_expressions\r\n * @param ux first derivative x component\r\n * @param uy first derivative y component\r\n * @param uz first derivative z component\r\n * @param vx second derivative x component\r\n * @param vy second derivative y component\r\n * @param vz second derivative z component\r\n */\r\n public static curvatureMagnitude(\r\n ux: number, uy: number, uz: number,\r\n vx: number, vy: number, vz: number\r\n ): number {\r\n let q = uy * vz - uz * vy;\r\n let sum = q * q;\r\n q = uz * vx - ux * vz;\r\n sum += q * q;\r\n q = ux * vy - uy * vx;\r\n sum += q * q;\r\n const magUxV = Math.sqrt(sum);\r\n const magU = Math.sqrt(ux * ux + uy * uy + uz * uz);\r\n const magUCubed = magU * magU * magU;\r\n if (magUCubed > Geometry.smallAngleRadians * magUxV)\r\n return magUxV / magUCubed;\r\n return 0;\r\n }\r\n /**\r\n * Clamp to (min(a,b), max(a,b)).\r\n * * Always returns a number between `a` and `b`.\r\n * @param value value to clamp\r\n * @param a smallest allowed output if `a < b` or largest allowed output if `a > b`\r\n * @param b largest allowed output if `a < b` or smallest allowed output if `a > b`\r\n */\r\n public static clampToStartEnd(value: number, a: number, b: number): number {\r\n if (a > b)\r\n return Geometry.clampToStartEnd(value, b, a);\r\n if (value < a)\r\n return a;\r\n if (b < value)\r\n return b;\r\n return value;\r\n }\r\n /**\r\n * Clamp value to (min, max) with no test for order of (min, max).\r\n * * Always returns a number between `min` and `max`.\r\n * @param value value to clamp\r\n * @param min smallest allowed output\r\n * @param max largest allowed output\r\n */\r\n public static clamp(value: number, min: number, max: number): number {\r\n return Math.max(min, Math.min(max, value));\r\n }\r\n /** If given a `value`, return it. If given `undefined`, return `defaultValue`. */\r\n public static resolveNumber(value: number | undefined, defaultValue: number = 0): number {\r\n return value !== undefined ? value : defaultValue;\r\n }\r\n /** If given a `value`, return it. If given `undefined`, return `defaultValue`. */\r\n public static resolveValue<T>(value: T | undefined, defaultValue: T): T {\r\n return value !== undefined ? value : defaultValue;\r\n }\r\n /** If given `value` matches the `targetValue`, return `undefined`. Otherwise return the `value`. */\r\n public static resolveToUndefined<T>(value: T | undefined, targetValue: T): T | undefined {\r\n return value === targetValue ? undefined : value;\r\n }\r\n /**\r\n * Simple interpolation between values `a` and `b` with fraction `f`.\r\n * * If `f = 0`, then `a` is returned and if `f = 1`, then `b` is returned.\r\n * * For maximum accuracy, we choose `a` or `b` as starting point based on fraction `f`.\r\n */\r\n public static interpolate(a: number, f: number, b: number): number {\r\n return f <= 0.5 ? a + f * (b - a) : b - (1.0 - f) * (b - a);\r\n }\r\n /**\r\n * Given an `axisOrder` (e.g. XYZ, YZX, etc) and an `index`, return the `axis` at the given index.\r\n * * For example, if `axisOrder = XYZ`, then for index 0 return `X` (or axis 0), for index 1 return\r\n * `Y` (or axis 1), and for index 2 return `Z` (or axis 2).\r\n * * Another example: if `axisOrder = ZXY`, then for index 0 return `Z` (or axis 2), for index 1 return\r\n * `X` (or axis 0), and for index 2 return `Y` (or axis 1).\r\n * * For indexes greater than 2 or smaller than 0, it return cyclic axis. See [[Geometry.cyclic3dAxis]]\r\n * for more info.\r\n */\r\n public static axisOrderToAxis(order: AxisOrder, index: number): number {\r\n const axis = order <= AxisOrder.ZXY ? order + index : (order - AxisOrder.XZY) - index;\r\n return Geometry.cyclic3dAxis(axis);\r\n }\r\n /**\r\n * Return `a` modulo `period`.\r\n * * Both `a` and `period` can be negative.\r\n * * This function can be faster than the `%` operator for the common case when `p > 0` and `-p < a < 2p`.\r\n */\r\n public static modulo(a: number, period: number): number {\r\n // period is negative\r\n if (period <= 0) {\r\n if (period === 0)\r\n return a;\r\n return -Geometry.modulo(-a, -period);\r\n }\r\n // period is positive\r\n if (a >= 0) {\r\n if (a < period) // \"0 < a < period\"\r\n return a;\r\n if (a < 2 * period) // \"0 < period < a < 2*period\"\r\n return a - period;\r\n } else { // \"-period < a < 0\"\r\n a += period;\r\n if (a > 0)\r\n return a;\r\n }\r\n // \"0 < 2*period < a\" or \"a < -period < 0\"\r\n const m = Math.floor(a / period);\r\n return a - m * period;\r\n }\r\n /** Return 0 if the value is `undefined` and 1 if the value is defined. */\r\n public static defined01(value: any): number {\r\n return value === undefined ? 0 : 1;\r\n }\r\n /**\r\n * Return `numerator` divided by `denominator`.\r\n * @param numerator the numerator\r\n * @param denominator the denominator\r\n * @returns return `numerator/denominator` but if the ratio exceeds `Geometry.largeFractionResult`,\r\n * return `undefined`.\r\n */\r\n public static conditionalDivideFraction(numerator: number, denominator: number): number | undefined {\r\n if (Math.abs(denominator) * Geometry.largeFractionResult > Math.abs(numerator))\r\n return numerator / denominator;\r\n return undefined;\r\n }\r\n /**\r\n * Return `numerator` divided by `denominator`.\r\n * @param numerator the numerator\r\n * @param denominator the denominator\r\n * @returns return `numerator/denominator` but if the ratio exceeds `Geometry.largeFractionResult`,\r\n * return `defaultResult`.\r\n */\r\n public static safeDivideFraction(numerator: number, denominator: number, defaultResult: number): number {\r\n const ratio = Geometry.conditionalDivideFraction(numerator, denominator);\r\n if (ratio !== undefined)\r\n return ratio;\r\n return defaultResult;\r\n }\r\n /**\r\n * Return `numerator` divided by `denominator` (with a given `largestResult`).\r\n * @param numerator the numerator\r\n * @param denominator the denominator\r\n * @param largestResult the ratio threshold\r\n * @returns return `numerator/denominator` but if the ratio exceeds `largestResult`, return `undefined`.\r\n */\r\n public static conditionalDivideCoordinate(\r\n numerator: number, denominator: number, largestResult: number = Geometry.largeCoordinateResult\r\n ): number | undefined {\r\n if (Math.abs(denominator * largestResult) > Math.abs(numerator))\r\n return numerator / denominator;\r\n return undefined;\r\n }\r\n /**\r\n * Return solution(s) of equation `constCoff + cosCoff*c + sinCoff*s = 0` for `c` and `s` with the\r\n * constraint `c*c + s*s = 1`.\r\n * * There could be 0, 1, or 2 solutions. Return `undefined` if there is no solution.\r\n */\r\n public static solveTrigForm(constCoff: number, cosCoff: number, sinCoff: number): Vector2d[] | undefined {\r\n /**\r\n * Solutions can be found by finding the intersection of line \"ax + by + d = 0\" and unit circle \"x^2 + y^2 = 1\".\r\n * From the line equation we have \"y = (-ax - d) / b\". By replacing this into the circle equation we get\r\n * \"x^2 + (ax+d)^2/b^2 = 1\". If we solve this by quadratic formula we get\r\n * x = (-ad +- b*sqrt(a^2+b^2-d^2)) / (a^2+b^2)\r\n * y = (-ad -+ a*sqrt(a^2+b^2-d^2)) / (a^2+b^2)\r\n *\r\n * If \"a^2+b^2-d^2 > 0\" then there are two solutions (above).\r\n * If \"a^2+b^2-d^2 = 0\" then there is one solution which is (-ad/(a^2+b^2), -bd/(a^2+b^2)).\r\n * If \"a^2+b^2-d^2 < 0\" then there is no solution.\r\n *\r\n * Below in the code we have \"a = cosCoff\", \"b = sinCoff\", and \"d = constCoff\". Also equivalent criterion\r\n * is used in the code. For example, \"a^2+b^2-d^2 > 0\" is equivalent of \"1 - d^2/(a^2+b^2) > 0\".\r\n */\r\n const a2b2 = cosCoff * cosCoff + sinCoff * sinCoff; // a^2+b^2\r\n const d2 = constCoff * constCoff; // d^2\r\n let result;\r\n if (a2b2 > 0.0) {\r\n const a2b2r = 1.0 / a2b2; // 1/(a^2+b^2)\r\n const d2a2b2 = d2 * a2b2r; // d^2/(a^2+b^2)\r\n const criteria = 1.0 - d2a2b2; // 1 - d^2/(a^2+b^2); the criteria to specify how many solutions we got\r\n if (criteria < -Geometry.smallMetricDistanceSquared) // nSolution = 0\r\n return result;\r\n const da2b2 = -constCoff * a2b2r; // -d/(a^2+b^2)\r\n const c0 = da2b2 * cosCoff; // -ad/(a^2+b^2)\r\n const s0 = da2b2 * sinCoff; // -bd/(a^2+b^2)\r\n if (criteria <= 0.0) { // nSolution = 1 (observed criteria = -2.22e-16 in rotated system)\r\n result = [Vector2d.create(c0, s0)];\r\n } else if (criteria > 0.0) { // nSolution = 2\r\n const s = Math.sqrt(criteria * a2b2r); // sqrt(a^2+b^2-d^2)) / (a^2+b^2)\r\n result = [\r\n Vector2d.create(c0 - s * sinCoff, s0 + s * cosCoff),\r\n Vector2d.create(c0 + s * sinCoff, s0 - s * cosCoff),\r\n ];\r\n }\r\n }\r\n return result;\r\n }\r\n /**\r\n * For a line `f(x)` where `f(x0) = f0` and `f(x1) = f1`, return the `x` value at which `f(x) = fTarget`\r\n * Return `defaultResult` if `(fTarget - f0) / (f1 - f0)` exceeds `Geometry.largeFractionResult`\r\n */\r\n public static inverseInterpolate(\r\n x0: number, f0: number, x1: number, f1: number, fTarget: number = 0, defaultResult?: number\r\n ): number | undefined {\r\n /**\r\n * Line equation is \"fTarget-f0 = (f1-f0)/(x1-x0) * (x-x0)\" or \"(fTarget-f0)/(f1-f0) = (x-x0)/(x1-x0)\".\r\n * The left hand side is known so if we call it \"fr\" (short for \"fraction\") we get \"fr = (x-x0)/(x1-x0)\".\r\n * Therefore, \"x = x0*(1-fr) + x1*fr\". This is same as interpolation between \"x0\" and \"x1\" with fraction \"fr\".\r\n */\r\n const fr = Geometry.conditionalDivideFraction(fTarget - f0, f1 - f0); // (fTarget-f0)/(f1-f0)\r\n if (fr !== undefined)\r\n return Geometry.interpolate(x0, fr, x1); // x = x0*(1-fr) + x1*fr\r\n return defaultResult;\r\n }\r\n /**\r\n * For a line `f(x)` where `f(0) = f0` and `f(1) = f1`, return the `x` value at which `f(x) = fTarget`\r\n * Return `undefined` if `(fTarget - f0) / (f1 - f0)` exceeds `Geometry.largeFractionResult`\r\n */\r\n public static inverseInterpolate01(f0: number, f1: number, fTarget: number = 0): number | undefined {\r\n /**\r\n * Line equation is \"fTarget-f0 = (f1-f0)*x\" so \"x = (fTarget-f0)/(f1-f0)\"\r\n */\r\n return Geometry.conditionalDivideFraction(fTarget - f0, f1 - f0); // x = (fTarget-f0)/(f1-f0)\r\n }\r\n /**\r\n * Return `true` if `json` is an array with at least `minEntries` entries and all entries are numbers (including\r\n * those beyond minEntries).\r\n */\r\n public static isNumberArray(json: any, minEntries: number = 0): boolean {\r\n if (Array.isArray(json) && json.length >= minEntries) {\r\n let entry;\r\n for (entry of json) {\r\n if (!Number.isFinite(entry))\r\n return false;\r\n }\r\n return true;\r\n }\r\n return false;\r\n }\r\n /**\r\n * Return `true` if `json` is an array of at least `minArrays` arrays with at least `minEntries` entries in\r\n * each array and all entries are numbers (including those beyond minEntries).\r\n */\r\n public static isArrayOfNumberArray(json: any, minArrays: number, minEntries: number = 0): boolean {\r\n if (Array.isArray(json) && json.length >= minArrays) {\r\n let entry;\r\n for (entry of json)\r\n if (!Geometry.isNumberArray(entry, minEntries))\r\n return false;\r\n return true;\r\n }\r\n return false;\r\n }\r\n /**\r\n * Return the number of steps to take so that `numSteps * stepSize >= total`.\r\n * * `minCount` is returned in the following 3 cases:\r\n * * (a) `stepSize <= 0`\r\n * * (b) `stepSize >= total`\r\n * * (b) `numSteps < minCount`\r\n * * `maxCount` is returned if `numSteps > maxCount`.\r\n */\r\n public static stepCount(stepSize: number, total: number, minCount = 1, maxCount = 101): number {\r\n if (stepSize <= 0)\r\n return minCount;\r\n total = Math.abs(total);\r\n if (stepSize >= total)\r\n return minCount;\r\n /**\r\n * 0.999999 is multiplied so we return the same \"numSteps\" if\r\n * stepSize*(numSteps-1) < total <= stepSize*numSteps.\r\n * For example, if \"stepSize = 2\" then we return \"numSteps = 5\" if 8 < total <= 10.\r\n */\r\n const numSteps = Math.floor((total + 0.999999 * stepSize) / stepSize);\r\n if (numSteps < minCount)\r\n return minCount;\r\n if (numSteps > maxCount)\r\n return maxCount;\r\n return numSteps;\r\n }\r\n /**\r\n * Test if `x` is in the interval [0,1] (but skip the test if `apply01 = false`).\r\n * * This odd behavior is very convenient for code that sometimes does not do the filtering.\r\n * @param x value to test.\r\n * @param apply01 if false, return `true` for all values of `x`.\r\n */\r\n public static isIn01(x: number, apply01: boolean = true): boolean {\r\n return apply01 ? x >= 0.0 && x <= 1.0 : true;\r\n }\r\n /**\r\n * Test if `x` is in the interval [0,1] for a given positive `tolerance`.\r\n * * Make sure to pass a positive `tolerance` because there is no check for that in the code.\r\n * @param x value to test.\r\n * @param tolerance the tolerance.\r\n */\r\n public static isIn01WithTolerance(x: number, tolerance: number): boolean {\r\n return x + tolerance >= 0.0 && x - tolerance <= 1.0;\r\n }\r\n /**\r\n * Restrict x so it is in the interval `[a,b]` (allowing `a` and `b` to be in either order).\r\n * @param x value to restrict\r\n * @param a (usually the lower) interval limit\r\n * @param b (usually the upper) interval limit\r\n */\r\n public static restrictToInterval(x: number, a: number, b: number): number {\r\n if (a <= b) {\r\n if (x < a)\r\n return a;\r\n if (x > b)\r\n return b;\r\n return x;\r\n }\r\n // reversed interval\r\n if (x < b)\r\n return b;\r\n if (x > a)\r\n return a;\r\n return x;\r\n }\r\n /**\r\n * Case-insensitive string comparison.\r\n * * Return `true` if the `toUpperCase` values of `string1` and `string2` match.\r\n */\r\n public static equalStringNoCase(string1: string, string2: string): boolean {\r\n return string1.toUpperCase() === string2.toUpperCase();\r\n }\r\n /**\r\n * Test for exact match of two number arrays.\r\n * Returns `true` if both arrays have the same length and entries, or if both arrays are empty or `undefined`.\r\n */\r\n public static exactEqualNumberArrays(a: number[] | undefined, b: number[] | undefined): boolean {\r\n if (Array.isArray(a) && a.length === 0)\r\n a = undefined;\r\n if (Array.isArray(b) && b.length === 0)\r\n b = undefined;\r\n if (a === undefined && b === undefined)\r\n return true;\r\n if (Array.isArray(a) && Array.isArray(b)) {\r\n if (a.length !== b.length)\r\n return false;\r\n for (let i = 0; i < a.length; i++)\r\n if (a[i] !== b[i])\r\n return false;\r\n return true;\r\n }\r\n return false;\r\n }\r\n /**\r\n * Test for match of two arrays of type `T`.\r\n * Returns `true` if both arrays have the same length and have the same entries (or both are empty arrays).\r\n */\r\n public static almostEqualArrays<T>(\r\n a: T[] | undefined, b: T[] | undefined, testFunction: (p: T, q: T) => boolean\r\n ): boolean {\r\n if (Array.isArray(a) && a.length === 0)\r\n a = undefined;\r\n if (Array.isArray(b) && b.length === 0)\r\n b = undefined;\r\n if (a === undefined && b === undefined)\r\n return true;\r\n if (Array.isArray(a) && Array.isArray(b)) {\r\n if (a.length !== b.length)\r\n return false;\r\n for (let i = 0; i < a.length; i++) {\r\n if (!testFunction(a[i], b[i]))\r\n return false;\r\n }\r\n return true;\r\n }\r\n return false;\r\n }\r\n /**\r\n * Test for match of two arrays of type number or Float64Array.\r\n * Returns `true` if both arrays have the same length and have the same entries (or both are empty arrays).\r\n */\r\n public static almostEqualNumberArrays(\r\n a: number[] | Float64Array | undefined, b: number[] | Float64Array | undefined,\r\n testFunction: (p: number, q: number) => boolean\r\n ): boolean {\r\n if (Array.isArray(a) && a.length === 0)\r\n a = undefined;\r\n if (Array.isArray(b) && b.length === 0)\r\n b = undefined;\r\n if (a === undefined && b === undefined)\r\n return true;\r\n if (Array.isArray(a) && Array.isArray(b)) {\r\n if (a.length !== b.length)\r\n return false;\r\n for (let i = 0; i < a.length; i++) {\r\n if (!testFunction(a[i], b[i]))\r\n return false;\r\n }\r\n return true;\r\n }\r\n return false;\r\n }\r\n /**\r\n * Test for match of two values of type `T`.\r\n * @param a first value\r\n * @param b second value\r\n * @param resultIfBothUndefined returned value when both are `undefined`\r\n * @returns `true` if both values are defined and equal (with ===) and `false` if both values are defined\r\n * but not equal or if one is defined and the other undefined.\r\n */\r\n public static areEqualAllowUndefined<T>(\r\n a: T | undefined, b: T | undefined, resultIfBothUndefined: boolean = true\r\n ): boolean {\r\n if (a === undefined && b === undefined)\r\n return resultIfBothUndefined;\r\n if (a !== undefined && b !== undefined)\r\n return a === b;\r\n return false;\r\n }\r\n /**\r\n * Clone an array whose members have type `T`, which implements the clone method.\r\n * * If the clone method returns `undefined`, then `undefined` is forced into the cloned array.\r\n */\r\n public static cloneMembers<T extends Cloneable<T>>(array: T[] | undefined): T[] | undefined {\r\n if (array === undefined)\r\n return undefined;\r\n const clonedArray: T[] = [];\r\n for (const element of array) {\r\n clonedArray.push(element.clone()!);\r\n }\r\n return clonedArray;\r\n }\r\n}\r\n"]}
|
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { Arc3d } from "../curve/Arc3d";
|
|
5
5
|
import { AnnounceNumberNumber, AnnounceNumberNumberCurvePrimitive } from "../curve/CurvePrimitive";
|
|
6
|
-
import { Plane3dByOriginAndUnitNormal } from "../geometry3d/Plane3dByOriginAndUnitNormal";
|
|
7
6
|
import { Angle } from "../geometry3d/Angle";
|
|
8
7
|
import { GrowableXYZArray } from "../geometry3d/GrowableXYZArray";
|
|
8
|
+
import { Plane3dByOriginAndUnitNormal } from "../geometry3d/Plane3dByOriginAndUnitNormal";
|
|
9
9
|
import { Point3d, Vector3d } from "../geometry3d/Point3dVector3d";
|
|
10
10
|
import { Range1d, Range3d } from "../geometry3d/Range";
|
|
11
11
|
import { Ray3d } from "../geometry3d/Ray3d";
|
|
12
12
|
import { GrowableXYZArrayCache } from "../geometry3d/ReusableObjectCache";
|
|
13
13
|
import { Transform } from "../geometry3d/Transform";
|
|
14
14
|
import { Matrix4d } from "../geometry4d/Matrix4d";
|
|
15
|
+
import { Polyface, PolyfaceVisitor } from "../polyface/Polyface";
|
|
15
16
|
import { ClipPlane, ClipPlaneProps } from "./ClipPlane";
|
|
16
17
|
import { Clipper, ClipPlaneContainment, PolygonClipper } from "./ClipUtils";
|
|
17
|
-
import { Polyface, PolyfaceVisitor } from "../polyface/Polyface";
|
|
18
18
|
/** Wire format describing a [[ConvexClipPlaneSet]].
|
|
19
19
|
* @public
|
|
20
20
|
*/
|
|
@@ -90,9 +90,11 @@ export declare class ConvexClipPlaneSet implements Clipper, PolygonClipper {
|
|
|
90
90
|
clone(result?: ConvexClipPlaneSet): ConvexClipPlaneSet;
|
|
91
91
|
/** Return the (reference to the) array of `ClipPlane` */
|
|
92
92
|
get planes(): ClipPlane[];
|
|
93
|
-
/**
|
|
93
|
+
/**
|
|
94
|
+
* Test if there is any intersection with a ray defined by origin and direction.
|
|
94
95
|
* * Optionally record the range (null or otherwise) in caller-allocated result.
|
|
95
|
-
* * If the ray is unbounded inside the clip, result can contain positive or negative
|
|
96
|
+
* * If the ray is unbounded inside the clip, result can contain positive or negative
|
|
97
|
+
* "Geometry.largeCoordinateResult" values
|
|
96
98
|
* * If no result is provide, there are no object allocations.
|
|
97
99
|
* @param result optional Range1d to receive parameters along the ray.
|
|
98
100
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConvexClipPlaneSet.d.ts","sourceRoot":"","sources":["../../../src/clipping/ConvexClipPlaneSet.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,kCAAkC,EAAE,MAAM,yBAAyB,CAAC;AAEnG,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ConvexClipPlaneSet.d.ts","sourceRoot":"","sources":["../../../src/clipping/ConvexClipPlaneSet.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,kCAAkC,EAAE,MAAM,yBAAyB,CAAC;AAEnG,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAC1F,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,+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
|
-
const Plane3dByOriginAndUnitNormal_1 = require("../geometry3d/Plane3dByOriginAndUnitNormal");
|
|
10
9
|
const GrowableFloat64Array_1 = require("../geometry3d/GrowableFloat64Array");
|
|
11
10
|
const GrowableXYZArray_1 = require("../geometry3d/GrowableXYZArray");
|
|
12
11
|
const Matrix3d_1 = require("../geometry3d/Matrix3d");
|
|
12
|
+
const Plane3dByOriginAndUnitNormal_1 = require("../geometry3d/Plane3dByOriginAndUnitNormal");
|
|
13
13
|
const Point3dVector3d_1 = require("../geometry3d/Point3dVector3d");
|
|
14
14
|
const PolygonOps_1 = require("../geometry3d/PolygonOps");
|
|
15
15
|
const Range_1 = require("../geometry3d/Range");
|
|
16
|
-
const ClipPlane_1 = require("./ClipPlane");
|
|
17
|
-
const ClipUtils_1 = require("./ClipUtils");
|
|
18
16
|
const Polyface_1 = require("../polyface/Polyface");
|
|
19
17
|
const PolyfaceQuery_1 = require("../polyface/PolyfaceQuery");
|
|
18
|
+
const ClipPlane_1 = require("./ClipPlane");
|
|
19
|
+
const ClipUtils_1 = require("./ClipUtils");
|
|
20
20
|
/**
|
|
21
21
|
* A ConvexClipPlaneSet is a collection of ClipPlanes, often used for bounding regions of space.
|
|
22
22
|
* @public
|
|
@@ -225,17 +225,19 @@ class ConvexClipPlaneSet {
|
|
|
225
225
|
get planes() {
|
|
226
226
|
return this._planes;
|
|
227
227
|
}
|
|
228
|
-
/**
|
|
228
|
+
/**
|
|
229
|
+
* Test if there is any intersection with a ray defined by origin and direction.
|
|
229
230
|
* * Optionally record the range (null or otherwise) in caller-allocated result.
|
|
230
|
-
* * If the ray is unbounded inside the clip, result can contain positive or negative
|
|
231
|
+
* * If the ray is unbounded inside the clip, result can contain positive or negative
|
|
232
|
+
* "Geometry.largeCoordinateResult" values
|
|
231
233
|
* * If no result is provide, there are no object allocations.
|
|
232
234
|
* @param result optional Range1d to receive parameters along the ray.
|
|
233
235
|
*/
|
|
234
236
|
hasIntersectionWithRay(ray, result, tolerance = Geometry_1.Geometry.smallMetricDistance) {
|
|
235
237
|
// form low and high values in locals that do not require allocation.
|
|
236
238
|
// transfer to caller-supplied result at end
|
|
237
|
-
let t0 = -Geometry_1.Geometry.
|
|
238
|
-
let t1 = Geometry_1.Geometry.
|
|
239
|
+
let t0 = -Geometry_1.Geometry.largeCoordinateResult;
|
|
240
|
+
let t1 = Geometry_1.Geometry.largeCoordinateResult;
|
|
239
241
|
if (result)
|
|
240
242
|
result.setNull();
|
|
241
243
|
const velocityTolerance = 1.0e-13;
|