@itwin/core-geometry 5.14.0-dev.4 → 5.14.0-dev.7
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/CHANGELOG.md +9 -1
- package/lib/cjs/curve/CurveCollection.d.ts +6 -0
- package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCollection.js +15 -0
- package/lib/cjs/curve/CurveCollection.js.map +1 -1
- package/lib/cjs/curve/CurveOps.d.ts.map +1 -1
- package/lib/cjs/curve/CurveOps.js.map +1 -1
- package/lib/cjs/curve/GeometryQuery.d.ts +41 -0
- package/lib/cjs/curve/GeometryQuery.d.ts.map +1 -1
- package/lib/cjs/curve/GeometryQuery.js +52 -0
- package/lib/cjs/curve/GeometryQuery.js.map +1 -1
- package/lib/cjs/curve/Query/PlanarSubdivision.d.ts +36 -35
- package/lib/cjs/curve/Query/PlanarSubdivision.d.ts.map +1 -1
- package/lib/cjs/curve/Query/PlanarSubdivision.js +4 -4
- package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
- package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
- package/lib/cjs/curve/RegionOps.js +3 -1
- package/lib/cjs/curve/RegionOps.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts +2 -0
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js +4 -0
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/Range.d.ts +2 -0
- package/lib/cjs/geometry3d/Range.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Range.js +6 -0
- package/lib/cjs/geometry3d/Range.js.map +1 -1
- package/lib/cjs/topology/Merging.d.ts +4 -2
- package/lib/cjs/topology/Merging.d.ts.map +1 -1
- package/lib/cjs/topology/Merging.js +23 -20
- package/lib/cjs/topology/Merging.js.map +1 -1
- package/lib/esm/curve/CurveCollection.d.ts +6 -0
- package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
- package/lib/esm/curve/CurveCollection.js +15 -0
- package/lib/esm/curve/CurveCollection.js.map +1 -1
- package/lib/esm/curve/CurveOps.d.ts.map +1 -1
- package/lib/esm/curve/CurveOps.js.map +1 -1
- package/lib/esm/curve/GeometryQuery.d.ts +41 -0
- package/lib/esm/curve/GeometryQuery.d.ts.map +1 -1
- package/lib/esm/curve/GeometryQuery.js +52 -0
- package/lib/esm/curve/GeometryQuery.js.map +1 -1
- package/lib/esm/curve/Query/PlanarSubdivision.d.ts +36 -35
- package/lib/esm/curve/Query/PlanarSubdivision.d.ts.map +1 -1
- package/lib/esm/curve/Query/PlanarSubdivision.js +4 -4
- package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
- package/lib/esm/curve/RegionOps.d.ts.map +1 -1
- package/lib/esm/curve/RegionOps.js +3 -1
- package/lib/esm/curve/RegionOps.js.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.d.ts +2 -0
- package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.js +4 -0
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/Range.d.ts +2 -0
- package/lib/esm/geometry3d/Range.d.ts.map +1 -1
- package/lib/esm/geometry3d/Range.js +6 -0
- package/lib/esm/geometry3d/Range.js.map +1 -1
- package/lib/esm/topology/Merging.d.ts +4 -2
- package/lib/esm/topology/Merging.d.ts.map +1 -1
- package/lib/esm/topology/Merging.js +23 -20
- package/lib/esm/topology/Merging.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
# Change Log - @itwin/core-geometry
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Thu, 03 Sep 2026 18:51:17 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 5.13.0
|
|
6
|
+
Thu, 03 Sep 2026 18:49:56 GMT
|
|
7
|
+
|
|
8
|
+
### Updates
|
|
9
|
+
|
|
10
|
+
- more RegionOps tolerance improvements
|
|
11
|
+
- Improved dihedralAngleSummary docs
|
|
4
12
|
|
|
5
13
|
## 5.12.5
|
|
6
14
|
Tue, 25 Aug 2026 21:22:08 GMT
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { GeometryHandler } from "../geometry3d/GeometryHandler";
|
|
2
2
|
import { GrowableXYZArray } from "../geometry3d/GrowableXYZArray";
|
|
3
|
+
import { Plane3dByOriginAndUnitNormal } from "../geometry3d/Plane3dByOriginAndUnitNormal";
|
|
3
4
|
import { Point3d, Vector3d } from "../geometry3d/Point3dVector3d";
|
|
4
5
|
import { Range1d, Range3d } from "../geometry3d/Range";
|
|
5
6
|
import { Ray3d } from "../geometry3d/Ray3d";
|
|
@@ -211,6 +212,11 @@ export declare abstract class CurveCollection extends GeometryQuery {
|
|
|
211
212
|
projectedParameterRange(ray: Vector3d | Ray3d, lowHigh?: Range1d): Range1d | undefined;
|
|
212
213
|
/** Return the immediate parent of the input curve in the instance, or undefined if it is not a descendant. */
|
|
213
214
|
findParentOfDescendant(descendant: AnyCurve): CurveCollection | undefined;
|
|
215
|
+
/**
|
|
216
|
+
* Ask if the curves of the collection are within tolerance of the input plane.
|
|
217
|
+
* @returns whether the collection is nonempty and its curves lie within tolerance of the plane.
|
|
218
|
+
*/
|
|
219
|
+
isInPlane(plane: Plane3dByOriginAndUnitNormal): boolean;
|
|
214
220
|
}
|
|
215
221
|
/**
|
|
216
222
|
* Shared base class for use by both open and closed paths.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurveCollection.d.ts","sourceRoot":"","sources":["../../../src/curve/CurveCollection.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,OAA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/**
|
|
328
|
+
* Ask if the curves of the collection are within tolerance of the input plane.
|
|
329
|
+
* @returns whether the collection is nonempty and its curves lie within tolerance of the plane.
|
|
330
|
+
*/
|
|
331
|
+
isInPlane(plane) {
|
|
332
|
+
if (0 === this.children.length)
|
|
333
|
+
return false; // punt on empty parent...
|
|
334
|
+
for (const child of this.children) {
|
|
335
|
+
if (child instanceof CurveCollection && 0 === child.children.length)
|
|
336
|
+
continue; // ...but ignore an empty child
|
|
337
|
+
if (!child.isInPlane(plane))
|
|
338
|
+
return false;
|
|
339
|
+
}
|
|
340
|
+
return true;
|
|
341
|
+
}
|
|
327
342
|
}
|
|
328
343
|
exports.CurveCollection = CurveCollection;
|
|
329
344
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurveCollection.js","sourceRoot":"","sources":["../../../src/curve/CurveCollection.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,sDAA6C;AAC7C,0CAAuC;AAGvC,qDAAkD;AAKlD,uDAAqG;AACrG,+DAA4D;AAC5D,qDAAkE;AAGlE,mDAAgD;AAChD,kGAA+F;AAC/F,8EAA2E;AAC3E,kGAA+F;AAC/F,oGAAiG;AACjG,0EAAuE;AACvE,4FAAyF;AACzF,4EAAyE;AACzE,wFAAqF;AACrF,iDAA8C;AAC9C,6CAA0C;AAoB1C;;;;;;;;;;;;GAYG;AACH,MAAsB,eAAgB,SAAQ,6BAAa;IACzD,wCAAwC;IACxB,gBAAgB,GAAG,iBAAiB,CAAC;IAGrD,uDAAuD;IAChD,OAAO,GAAY,KAAK,CAAC;IAGhC,6DAA6D;IACtD,UAAU;QACf,OAAO,qCAAiB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IAC5C,CAAC;IACO,mBAAmB,CACzB,UAAmB,EAAE,SAAsC,KAAK,EAAE,MAA4B,EAAE,SAAkB,KAAK;QAEvH,IAAI,OAAwC,CAAC;QAC7C,MAAM,OAAO,GAAG,IAAI,y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AC3B,CAAC;IACD,mBAAmB;IACZ,WAAW,CAAC,KAA2B;QAC5C,IAAI,KAAK;YACP,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,2BAA2B;IACpB,QAAQ,CAAC,CAAS;QACvB,IAAI,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM;YAC3B,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QAC3B,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,8EAA8E;IACvE,yBAAyB,CAAC,OAAwB;QACvD,OAAO,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;CACF;AA3ED,kCA2EC","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 Curve\r\n */\r\n\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { Geometry } from \"../Geometry\";\r\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\r\nimport { Matrix3d } from \"../geometry3d/Matrix3d\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Range1d, Range3d } from \"../geometry3d/Range\";\r\nimport { Ray3d } from \"../geometry3d/Ray3d\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { CurveExtendMode, CurveExtendOptions, VariantCurveExtendParameter } from \"./CurveExtendMode\";\r\nimport { CurveLocationDetail } from \"./CurveLocationDetail\";\r\nimport { CurvePrimitive, TangentOptions } from \"./CurvePrimitive\";\r\nimport { RecursiveCurveProcessor } from \"./CurveProcessor\";\r\nimport { AnyCurve, type AnyRegion } from \"./CurveTypes\";\r\nimport { GeometryQuery } from \"./GeometryQuery\";\r\nimport { AnnounceTangentStrokeHandler } from \"./internalContexts/AnnounceTangentStrokeHandler\";\r\nimport { CloneCurvesContext } from \"./internalContexts/CloneCurvesContext\";\r\nimport { CloneWithExpandedLineStrings } from \"./internalContexts/CloneWithExpandedLineStrings\";\r\nimport { CountLinearPartsSearchContext } from \"./internalContexts/CountLinearPartsSearchContext\";\r\nimport { GapSearchContext } from \"./internalContexts/GapSearchContext\";\r\nimport { PlaneAltitudeRangeContext } from \"./internalContexts/PlaneAltitudeRangeContext\";\r\nimport { SumLengthsContext } from \"./internalContexts/SumLengthsContext\";\r\nimport { TransformInPlaceContext } from \"./internalContexts/TransformInPlaceContext\";\r\nimport { LineString3d } from \"./LineString3d\";\r\nimport { ProxyCurve } from \"./ProxyCurve\";\r\nimport { StrokeOptions } from \"./StrokeOptions\";\r\n\r\nimport type { Path } from \"./Path\";\r\nimport type { Loop } from \"./Loop\";\r\n\r\n/** Note: CurveChain and BagOfCurves classes are located in this file to prevent circular dependency. */\r\n\r\n/**\r\n * Describes the concrete type of a [[CurveCollection]]. Each type name maps to a specific subclass and can be\r\n * used in conditional statements for type-switching.\r\n * - \"loop\" => [[Loop]]\r\n * - \"path\" => [[Path]]\r\n * - \"unionRegion\" => [[UnionRegion]]\r\n * - \"parityRegion\" => [[ParityRegion]]\r\n * - \"bagOfCurves\" => [[BagOfCurves]]\r\n * @public\r\n */\r\nexport type CurveCollectionType = \"loop\" | \"path\" | \"unionRegion\" | \"parityRegion\" | \"bagOfCurves\";\r\n\r\n/**\r\n * A `CurveCollection` is an abstract (non-instantiable) class for various sets of curves with particular structures:\r\n * - [[CurveChain]] - a non-instantiable intermediate class for a sequence of [[CurvePrimitive]] joining head-to-tail.\r\n * The two instantiable forms of `CurveChain` are:\r\n * - [[Path]] - a chain of curves. Does not have to be closed or planar. A closed `Path` is not treated as bounding a surface.\r\n * - [[Loop]] - a closed and planar chain of curves. A `Loop` is treated as bounding a planar area.\r\n * - [[ParityRegion]] - a collection of coplanar `Loop`, with \"in/out\" classification by parity rules.\r\n * - [[UnionRegion]] - a collection of coplanar `Loop` and/or `ParityRegion`, with \"in/out\" classification by union rules.\r\n * - [[BagOfCurves]] - a collection of [[AnyCurve]] with no implied structure.\r\n *\r\n * @see [Curve Collections]($docs/learning/geometry/CurveCollection.md) learning article.\r\n * @public\r\n */\r\nexport abstract class CurveCollection extends GeometryQuery {\r\n /** String name for schema properties */\r\n public readonly geometryCategory = \"curveCollection\";\r\n /** Type discriminator. */\r\n public abstract readonly curveCollectionType: CurveCollectionType;\r\n /** Flag for inner loop status. Only used by `Loop`. */\r\n public isInner: boolean = false;\r\n /** Return the curve children. */\r\n public abstract override get children(): AnyCurve[];\r\n /** Return the sum of the lengths of all contained curves. */\r\n public sumLengths(): number {\r\n return SumLengthsContext.sumLengths(this);\r\n }\r\n private computeClosestPoint(\r\n spacePoint: Point3d, extend: VariantCurveExtendParameter = false, result?: CurveLocationDetail, xyOnly: boolean = false,\r\n ): CurveLocationDetail | undefined {\r\n let detailA: CurveLocationDetail | undefined;\r\n const detailB = new CurveLocationDetail();\r\n let ext = this.isAnyRegion() ? false : extend;\r\n for (let i = 0; i < this.children.length; i++) {\r\n const child = this.children[i];\r\n if (this.isPath()) {\r\n // head only extends at start; tail only at end. NOTE: child may be both head and tail!\r\n const mode0 = (i === 0) ? CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extend, 0) : CurveExtendMode.None;\r\n const mode1 = (i === this.children.length - 1) ? CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extend, 1) : CurveExtendMode.None;\r\n ext = [mode0, mode1];\r\n }\r\n const cp = xyOnly ? child.closestPointXY(spacePoint, ext, detailB) : child.closestPoint(spacePoint, ext, detailB);\r\n if (cp) {\r\n const smaller = CurveLocationDetail.chooseSmallerA(detailA, detailB);\r\n assert(undefined !== smaller, \"expect defined because detailB is always defined\");\r\n detailA = result = smaller.clone(result);\r\n }\r\n }\r\n return detailA;\r\n }\r\n /**\r\n * Return the closest point on the contained curves.\r\n * @param spacePoint point in space.\r\n * @param extend extend applicable only to [[Path]] and [[BagOfCurves]]. Default value `false`.\r\n * @param result (optional) pre-allocated detail to populate and return.\r\n * @returns details of the closest point.\r\n */\r\n public closestPoint(\r\n spacePoint: Point3d, extend: VariantCurveExtendParameter = false, result?: CurveLocationDetail,\r\n ): CurveLocationDetail | undefined {\r\n return this.computeClosestPoint(spacePoint, extend, result);\r\n }\r\n /**\r\n * Return the closest point on the contained curves as viewed in the xy-plane (ignoring z).\r\n * @param spacePoint point in space.\r\n * @param extend (optional) extend applicable only to [[Path]] and [[BagOfCurves]]. Default value `false`.\r\n * @param result (optional) pre-allocated detail to populate and return.\r\n * @returns details of the closest point.\r\n */\r\n public closestPointXY(\r\n spacePoint: Point3d, extend: VariantCurveExtendParameter = false, result?: CurveLocationDetail,\r\n ): CurveLocationDetail | undefined {\r\n return this.computeClosestPoint(spacePoint, extend, result, true);\r\n }\r\n /**\r\n * Announce all points `P` on the contained curves such that the line containing `spacePoint` and `P` is tangent to\r\n * the contained curves in the view defined by `options.vectorToEye`.\r\n * * Strictly speaking, each tangent line lies in the plane through `P` whose normal is the cross product of the curve\r\n * tangent at `P` and `options.vectorToEye`. This is equivalent to tangency as seen in a view plane perpendicular to\r\n * `options.vectorToEye`.\r\n * @param spacePoint point in space.\r\n * @param announceTangent callback to announce each computed tangent. The received [[CurveLocationDetail]] is reused\r\n * internally, so it should be cloned in the callback if it needs to be saved.\r\n * @param options (optional) options for computing tangents. See [[TangentOptions]] for defaults.\r\n */\r\n public emitTangents(\r\n spacePoint: Point3d, announceTangent: (tangent: CurveLocationDetail) => any, options?: TangentOptions,\r\n ): void {\r\n const strokeHandler = new AnnounceTangentStrokeHandler(spacePoint, announceTangent, options);\r\n if (this.children !== undefined) {\r\n for (const child of this.children) {\r\n if (child instanceof CurvePrimitive)\r\n child.emitStrokableParts(strokeHandler, options?.strokeOptions);\r\n else if (child instanceof CurveCollection)\r\n child.emitTangents(spacePoint, announceTangent, options);\r\n }\r\n }\r\n }\r\n /**\r\n * Return all points `P` on the contained curves such that the line containing `spacePoint` and `P` is tangent to the\r\n * contained curves in the view defined by `options.vectorToEye`.\r\n * * See [[emitTangents]] for the definition of tangency employed.\r\n * @param spacePoint point in space.\r\n * @param options (optional) options for computing tangents. See [[TangentOptions]] for defaults.\r\n * @returns an array of details of all tangent points or undefined if no tangent was found.\r\n */\r\n public allTangents(spacePoint: Point3d, options?: TangentOptions): CurveLocationDetail[] | undefined {\r\n const tangents: CurveLocationDetail[] = [];\r\n this.emitTangents(spacePoint, (t: CurveLocationDetail) => tangents.push(t.clone()), options);\r\n return (tangents.length === 0) ? undefined : tangents;\r\n }\r\n /**\r\n * Return the point `P` on the contained curves such that the line containing `spacePoint` and `P` is tangent to the\r\n * contained curves in the view defined by `options.vectorToEye`, and `P` is closest to `options.hintPoint` in this view.\r\n * * See [[emitTangents]] for the definition of tangency employed.\r\n * @param spacePoint point in space.\r\n * @param options (optional) options for computing tangents. See [[TangentOptions]] for defaults.\r\n * @returns the detail of the closest tangent point or undefined if no tangent was found.\r\n */\r\n public closestTangent(spacePoint: Point3d, options?: TangentOptions): CurveLocationDetail | undefined {\r\n const hint = options?.hintPoint ?? spacePoint;\r\n let toLocal: Matrix3d | undefined;\r\n if (options?.vectorToEye && !options.vectorToEye.isExactEqual({ x: 0, y: 0, z: 1 }))\r\n toLocal = Matrix3d.createRigidViewAxesZTowardsEye(options.vectorToEye.x, options.vectorToEye.y, options.vectorToEye.z);\r\n const measureHintDist2 = (pt: Point3d): number => { // measure distance to hint in view plane coordinates\r\n return toLocal?.multiplyTransposeXYZ(hint.x - pt.x, hint.y - pt.y, hint.z - pt.z).magnitudeSquaredXY() ?? pt.distanceSquaredXY(hint);\r\n };\r\n let closestTangent: CurveLocationDetail | undefined;\r\n let closestDist2 = Geometry.largeCoordinateResult;\r\n const collectClosestTangent = (tangent: CurveLocationDetail) => {\r\n const dist2 = measureHintDist2(tangent.point);\r\n if (!closestTangent || dist2 < closestDist2) {\r\n closestTangent = tangent.clone(closestTangent);\r\n closestDist2 = dist2;\r\n }\r\n };\r\n this.emitTangents(spacePoint, collectClosestTangent, options);\r\n return closestTangent;\r\n }\r\n /** Reverse the collection's data so that each child curve's fractional stroking moves in the opposite direction. */\r\n public reverseInPlace(): void {\r\n for (const curve of this.children)\r\n curve.reverseInPlace();\r\n }\r\n /** Call [[reverseInPlace]] and return the instance. */\r\n public reverse(): this {\r\n this.reverseInPlace();\r\n return this;\r\n }\r\n /**\r\n * Return the max gap between adjacent primitives in Path and Loop collections.\r\n * * In a Path, gaps are computed between consecutive primitives.\r\n * * In a Loop, gaps are computed between consecutive primitives and between last and first.\r\n * * Gaps are NOT computed between consecutive CurvePrimitives in \"unstructured\" collections. The type is\r\n * \"unstructured\" so gaps should not be semantically meaningful.\r\n */\r\n public maxGap(): number {\r\n return GapSearchContext.maxGap(this);\r\n }\r\n /** Return true if the curve collection has any primitives other than LineSegment3d and LineString3d */\r\n public checkForNonLinearPrimitives(): boolean {\r\n return CountLinearPartsSearchContext.hasNonLinearPrimitives(this);\r\n }\r\n /** Apply transform recursively to children */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n return TransformInPlaceContext.tryTransformInPlace(this, transform);\r\n }\r\n /** Return a deep copy. */\r\n public override clone(): CurveCollection {\r\n return CloneCurvesContext.clone(this) as CurveCollection;\r\n }\r\n /** Create a deep copy of transformed curves. */\r\n public override cloneTransformed(transform: Transform): CurveCollection | undefined {\r\n return CloneCurvesContext.clone(this, transform);\r\n }\r\n /** Create a deep copy with all linestrings broken down into multiple LineSegment3d. */\r\n public cloneWithExpandedLineStrings(): CurveCollection {\r\n return CloneWithExpandedLineStrings.clone(this);\r\n }\r\n /**\r\n * Push all CurvePrimitives contained in the instance onto the `results` array.\r\n * * This method is recursive. For example, if the CurveCollection contains a Loop, all CurvePrimitives\r\n * of the Loop are pushed onto `results`.\r\n */\r\n private collectCurvePrimitivesGo(\r\n results: CurvePrimitive[], smallestPossiblePrimitives: boolean, explodeLinestrings: boolean = false,\r\n ): void {\r\n if (this.children) {\r\n for (const child of this.children) {\r\n if (child instanceof CurvePrimitive)\r\n child.collectCurvePrimitivesGo(results, smallestPossiblePrimitives, explodeLinestrings);\r\n else if (child instanceof CurveCollection)\r\n child.collectCurvePrimitivesGo(results, smallestPossiblePrimitives, explodeLinestrings);\r\n }\r\n }\r\n }\r\n /**\r\n * Return an array containing all CurvePrimitives in the instance.\r\n * * This method is recursive. For example, if the CurveCollection contains a Loop, all CurvePrimitives of\r\n * the Loop are pushed onto the returned array.\r\n * @param collectorArray optional array to receive primitives. If present, new primitives are ADDED (without\r\n * clearing the array).\r\n * @param smallestPossiblePrimitives if false, CurvePrimitiveWithDistanceIndex returns only itself. If true,\r\n * it recurses to its (otherwise hidden) children.\r\n */\r\n public collectCurvePrimitives(\r\n collectorArray?: CurvePrimitive[], smallestPossiblePrimitives: boolean = false, explodeLineStrings: boolean = false,\r\n ): CurvePrimitive[] {\r\n const results: CurvePrimitive[] = collectorArray === undefined ? [] : collectorArray;\r\n this.collectCurvePrimitivesGo(results, smallestPossiblePrimitives, explodeLineStrings);\r\n return results;\r\n }\r\n /**\r\n * Return true for planar region types:\r\n * * `Loop`\r\n * * `ParityRegion`\r\n * * `UnionRegion`\r\n * @see isAnyRegion\r\n */\r\n public get isAnyRegionType(): boolean {\r\n return this.dgnBoundaryType() === 2 || this.dgnBoundaryType() === 4 || this.dgnBoundaryType() === 5;\r\n }\r\n /** Type guard for AnyRegion */\r\n public isAnyRegion(): this is AnyRegion {\r\n return this.isAnyRegionType;\r\n }\r\n /**\r\n * Return true for a `Path`, i.e. a chain of curves joined head-to-tail.\r\n * * This is NOT a test for (lack of) physical closure.\r\n * @see [[isPath]], [[CurveChain.isPhysicallyClosedCurve]]\r\n */\r\n public get isOpenPath(): boolean {\r\n return this.dgnBoundaryType() === 1;\r\n }\r\n /**\r\n * Type guard for Path.\r\n * * This is NOT a test for (lack of) physical closure.\r\n * @see [[CurveChain.isPhysicallyClosedCurve]]\r\n */\r\n public isPath(): this is Path {\r\n return this.isOpenPath;\r\n }\r\n /**\r\n * Return true for a single-loop planar region type, i.e. `Loop`.\r\n * * This is NOT a test for physical closure.\r\n * @see [[isLoop]], [[CurveChain.isPhysicallyClosedCurve]]\r\n */\r\n public get isClosedPath(): boolean {\r\n return this.dgnBoundaryType() === 2;\r\n }\r\n /**\r\n * Type guard for Loop.\r\n * * This is NOT a test for physical closure.\r\n * @see [[CurveChain.isPhysicallyClosedCurve]]\r\n */\r\n public isLoop(): this is Loop {\r\n return this.isClosedPath;\r\n }\r\n\r\n /** Return a CurveCollection with the same structure but all curves replaced by strokes. */\r\n public abstract cloneStroked(options?: StrokeOptions): CurveCollection;\r\n /** Support method for ICurvePrimitive ... one line call to specific announce method . . */\r\n public abstract announceToCurveProcessor(processor: RecursiveCurveProcessor): void;\r\n /** Clone an empty collection. */\r\n public abstract cloneEmptyPeer(): CurveCollection;\r\n /**\r\n * Return the boundary type of a corresponding MicroStation CurveVector.\r\n * * Derived class must implement.\r\n */\r\n public abstract dgnBoundaryType(): number;\r\n /**\r\n * Try to add a child.\r\n * @param child child to add.\r\n * @return true if child is an acceptable type for this collection.\r\n */\r\n public abstract tryAddChild(child: AnyCurve | undefined): boolean;\r\n /** Return a child identified by by index */\r\n public abstract getChild(i: number): AnyCurve | undefined;\r\n /**\r\n * Extend (increase) the given range as needed to encompass all curves in the curve collection.\r\n * @param rangeToExtend the given range.\r\n * @param transform if supplied, the range is extended with transformed curves.\r\n */\r\n public extendRange(rangeToExtend: Range3d, transform?: Transform): void {\r\n const children = this.children;\r\n if (children) {\r\n for (const c of children) {\r\n c.extendRange(rangeToExtend, transform);\r\n }\r\n }\r\n }\r\n /**\r\n * Find any CurvePrimitive in the source and evaluate it at the given fraction.\r\n * * The first CurvePrimitive found is evaluated. Any other CurvePrimitives are ignored.\r\n * @param source containing `CurvePrimitive` or `CurveCollection`\r\n * @param fraction fraction to use in `curve.fractionToPoint(fraction)`\r\n */\r\n public static createCurveLocationDetailOnAnyCurvePrimitive(\r\n source: GeometryQuery | undefined, fraction: number = 0.5,\r\n ): CurveLocationDetail | undefined {\r\n if (!source)\r\n return undefined;\r\n if (source instanceof CurvePrimitive) {\r\n return CurveLocationDetail.createCurveEvaluatedFraction(source, fraction);\r\n } else if (source instanceof CurveCollection && source.children !== undefined)\r\n for (const child of source.children) {\r\n const detail = this.createCurveLocationDetailOnAnyCurvePrimitive(child, fraction);\r\n if (detail)\r\n return detail;\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Project instance geometry (via dispatch) onto the given ray, and return the extreme fractional parameters\r\n * of projection.\r\n * @param ray ray onto which the instance is projected. A `Vector3d` is treated as a `Ray3d` with zero origin.\r\n * @param lowHigh optional receiver for output\r\n * @returns range of fractional projection parameters onto the ray, where 0.0 is start of the ray and 1.0 is the\r\n * end of the ray.\r\n */\r\n public projectedParameterRange(ray: Vector3d | Ray3d, lowHigh?: Range1d): Range1d | undefined {\r\n return PlaneAltitudeRangeContext.findExtremeFractionsAlongDirection(this, ray, lowHigh);\r\n }\r\n /** Return the immediate parent of the input curve in the instance, or undefined if it is not a descendant. */\r\n public findParentOfDescendant(descendant: AnyCurve): CurveCollection | undefined {\r\n for (const child of this.children) {\r\n if (child === descendant)\r\n return this;\r\n if (child instanceof CurveCollection) {\r\n const parent = child.findParentOfDescendant(descendant);\r\n if (parent)\r\n return parent;\r\n }\r\n }\r\n return undefined;\r\n };\r\n}\r\n\r\n/**\r\n * Shared base class for use by both open and closed paths.\r\n * * A `CurveChain` contains only CurvePrimitives. No other paths, loops, or regions allowed.\r\n * * The specific derived classes are `Path` and `Loop`.\r\n * * `CurveChain` is an intermediate class. It is not instantiable on its own.\r\n * * The related class `CurveChainWithDistanceIndex` is a `CurvePrimitive` whose API presents well-defined mappings\r\n * from fraction to xyz over the entire chain, but in fact does all the calculations over multiple primitives.\r\n * @see [Curve Collections]($docs/learning/geometry/CurveCollection.md) learning article.\r\n * @public\r\n */\r\nexport abstract class CurveChain extends CurveCollection {\r\n /** The curve primitives in the chain. */\r\n protected _curves: CurvePrimitive[];\r\n /** Constructor */\r\n protected constructor() {\r\n super();\r\n this._curves = [];\r\n }\r\n /** Return the array of `CurvePrimitive` */\r\n public override get children(): CurvePrimitive[] {\r\n return this._curves;\r\n }\r\n /** Return the start point of the curve chain (start point of the first child). */\r\n public startPoint(result?: Point3d): Point3d | undefined {\r\n const firstChild = this.getChild(0);\r\n if (firstChild)\r\n return firstChild.fractionToPoint(0.0, result);\r\n else\r\n return undefined;\r\n }\r\n /** Return the end point of the curve chain (end point of the last child). */\r\n public endPoint(result?: Point3d): Point3d | undefined {\r\n const lastChild = this.getChild(this._curves.length - 1);\r\n if (lastChild)\r\n return lastChild.fractionToPoint(1.0, result);\r\n else\r\n return undefined;\r\n }\r\n /**\r\n * Whether the chain start and end points are defined and within tolerance.\r\n * * Does not check for planarity or degeneracy.\r\n * @param tolerance optional distance tolerance (default is [[Geometry.smallMetricDistance]])\r\n * @param xyOnly if true, ignore z coordinate (default is `false`)\r\n */\r\n public isPhysicallyClosedCurve(tolerance: number = Geometry.smallMetricDistance, xyOnly: boolean = false): boolean {\r\n const p0 = this.startPoint();\r\n const p1 = this.endPoint();\r\n return p0 !== undefined && p1 !== undefined && (xyOnly ? p0.isAlmostEqualXY(p1, tolerance) : p0.isAlmostEqual(p1, tolerance));\r\n }\r\n /**\r\n * Return the start point and derivative of the first child of the curve chain.\r\n * * For queries interior to the chain, use [[CurveChainWithDistanceIndex.fractionToPointAndDerivative]].\r\n */\r\n public startPointAndDerivative(result?: Ray3d): Ray3d | undefined {\r\n const firstChild = this.getChild(0);\r\n if (firstChild)\r\n return firstChild.fractionToPointAndDerivative(0.0, result);\r\n else\r\n return undefined;\r\n }\r\n /**\r\n * Return the end point and derivative of the last child of the curve chain.\r\n * * For queries interior to the chain, use [[CurveChainWithDistanceIndex.fractionToPointAndDerivative]].\r\n */\r\n public endPointAndDerivative(result?: Ray3d): Ray3d | undefined {\r\n const lastChild = this.getChild(this._curves.length - 1);\r\n if (lastChild)\r\n return lastChild.fractionToPointAndDerivative(1.0, result);\r\n else\r\n return undefined;\r\n }\r\n /**\r\n * Return the curve primitive at the given `index`, optionally using `modulo` to map `index` to the cyclic indexing.\r\n * * In particular, `-1` is the final curve.\r\n * @param index cyclic index\r\n * @param cyclic whether to employ modulo operator for wrap-around indexing. Default is `true`.\r\n */\r\n public cyclicCurvePrimitive(index: number, cyclic: boolean = true): CurvePrimitive | undefined {\r\n const n = this.children.length;\r\n if (n === 0)\r\n return undefined;\r\n if (index >= 0 && index < n) // try simplest non-cyclic access first\r\n return this.children[index];\r\n if (cyclic) {\r\n const index2 = Geometry.modulo(index, n);\r\n return this.children[index2];\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Stroke the chain into a simple xyz array.\r\n * @param options tolerance parameters controlling the stroking.\r\n */\r\n public getPackedStrokes(options?: StrokeOptions): GrowableXYZArray | undefined {\r\n /**\r\n * The object returned by \"cloneStroked\" has the same type (Loop or Path) but instead of a chain of\r\n * CurvePrimitives as children, it has a single LineString3d child. \"getPackedStrokes\" just returns\r\n * the points of that LineString3d using \"packedPoints\".\r\n */\r\n const tree = this.cloneStroked(options);\r\n if (tree instanceof CurveChain) {\r\n const children = tree.children;\r\n if (children.length === 1) {\r\n const ls = children[0];\r\n if (ls instanceof LineString3d)\r\n return ls.packedPoints;\r\n }\r\n }\r\n return undefined;\r\n }\r\n /** Return a structural clone, with CurvePrimitive objects stroked. */\r\n public abstract override cloneStroked(options?: StrokeOptions): CurveChain;\r\n /**\r\n * Add a child curve.\r\n * @param child curve to add to the chain. The curve is captured by this instance.\r\n * @return whether the child was added\r\n */\r\n public tryAddChild(child: AnyCurve | undefined): boolean {\r\n if (child && child instanceof CurvePrimitive) {\r\n this._curves.push(child);\r\n return true;\r\n }\r\n return false;\r\n }\r\n /** Return a child by index */\r\n public getChild(i: number): CurvePrimitive | undefined {\r\n if (i < this._curves.length) return this._curves[i];\r\n return undefined;\r\n }\r\n /** Invoke `curve.extendRange(range, transform)` for each child */\r\n public override extendRange(range: Range3d, transform?: Transform): void {\r\n for (const curve of this._curves)\r\n curve.extendRange(range, transform);\r\n }\r\n /**\r\n * Reverse each child curve (in place).\r\n * Reverse the order of the children array.\r\n */\r\n public reverseChildrenInPlace(): void {\r\n for (const curve of this._curves)\r\n curve.reverseInPlace();\r\n this._curves.reverse();\r\n }\r\n /** Same as [[reverseChildrenInPlace]]. */\r\n public override reverseInPlace(): void {\r\n this.reverseChildrenInPlace();\r\n }\r\n /**\r\n * Return the index where target is found in the array of children.\r\n * @param alsoSearchProxies whether to also check proxy curves of the children\r\n */\r\n public childIndex(target: CurvePrimitive | undefined, alsoSearchProxies?: boolean): number | undefined {\r\n for (let i = 0; i < this._curves.length; i++) {\r\n if (this._curves[i] === target)\r\n return i;\r\n }\r\n if (alsoSearchProxies ?? false) {\r\n for (let i = 0; i < this._curves.length; i++) {\r\n const childCurve = this._curves[i];\r\n if (childCurve instanceof ProxyCurve) {\r\n if (childCurve.proxyCurve === target)\r\n return i;\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n /** Evaluate an indexed curve at a fraction. Return as a CurveLocationDetail that indicates the primitive. */\r\n public primitiveIndexAndFractionToCurveLocationDetailPointAndDerivative(\r\n index: number, fraction: number, cyclic: boolean = false, result?: CurveLocationDetail,\r\n ): CurveLocationDetail | undefined {\r\n const primitive = this.cyclicCurvePrimitive(index, cyclic);\r\n if (primitive) {\r\n return CurveLocationDetail.createCurveEvaluatedFractionPointAndDerivative(primitive, fraction, result);\r\n }\r\n return undefined;\r\n }\r\n}\r\n\r\n/**\r\n * * A `BagOfCurves` object is a collection of `AnyCurve` objects.\r\n * * A `BagOfCurves` has no implied properties such as being planar.\r\n * @public\r\n */\r\nexport class BagOfCurves extends CurveCollection {\r\n /** String name for schema properties */\r\n public readonly curveCollectionType = \"bagOfCurves\";\r\n /** Test if `other` is an instance of `BagOfCurves` */\r\n public isSameGeometryClass(other: GeometryQuery): boolean {\r\n return other instanceof BagOfCurves;\r\n }\r\n /**\r\n * Array of children.\r\n * * No restrictions on type.\r\n */\r\n protected _children: AnyCurve[];\r\n /** Construct an empty `BagOfCurves` */\r\n public constructor() {\r\n super();\r\n this._children = [];\r\n }\r\n /** Return the (reference to) array of children */\r\n public override get children(): AnyCurve[] {\r\n return this._children;\r\n }\r\n /** Create with given curves. */\r\n public static create(...data: AnyCurve[]): BagOfCurves {\r\n const result = new BagOfCurves();\r\n for (const child of data) {\r\n result.tryAddChild(child);\r\n }\r\n return result;\r\n }\r\n /** Return the boundary type (0) of a corresponding MicroStation CurveVector */\r\n public dgnBoundaryType(): number {\r\n return 0;\r\n }\r\n /** Invoke `processor.announceBagOfCurves(this, indexInParent);` */\r\n public announceToCurveProcessor(processor: RecursiveCurveProcessor, indexInParent: number = -1): void {\r\n return processor.announceBagOfCurves(this, indexInParent);\r\n }\r\n /** Clone all children in stroked form. */\r\n public cloneStroked(options?: StrokeOptions): BagOfCurves {\r\n const clone = new BagOfCurves();\r\n let child;\r\n for (child of this.children) {\r\n if (child instanceof CurvePrimitive) {\r\n const ls = LineString3d.create();\r\n child.emitStrokes(ls, options);\r\n if (ls)\r\n clone.children.push(ls);\r\n } else if (child instanceof CurveCollection) {\r\n const childStrokes = child.cloneStroked(options);\r\n if (childStrokes)\r\n clone.children.push(childStrokes);\r\n }\r\n }\r\n return clone;\r\n }\r\n /** Return an empty `BagOfCurves` */\r\n public cloneEmptyPeer(): BagOfCurves {\r\n return new BagOfCurves();\r\n }\r\n /** Add a child */\r\n public tryAddChild(child: AnyCurve | undefined): boolean {\r\n if (child)\r\n this._children.push(child);\r\n return true;\r\n }\r\n /** Get a child by index */\r\n public getChild(i: number): AnyCurve | undefined {\r\n if (i < this._children.length)\r\n return this._children[i];\r\n return undefined;\r\n }\r\n /** Second step of double dispatch: call `handler.handleBagOfCurves(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleBagOfCurves(this);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"CurveCollection.js","sourceRoot":"","sources":["../../../src/curve/CurveCollection.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,sDAA6C;AAC7C,0CAAuC;AAGvC,qDAAkD;AAMlD,uDAAqG;AACrG,+DAA4D;AAC5D,qDAAkE;AAGlE,mDAAgD;AAChD,kGAA+F;AAC/F,8EAA2E;AAC3E,kGAA+F;AAC/F,oGAAiG;AACjG,0EAAuE;AACvE,4FAAyF;AACzF,4EAAyE;AACzE,wFAAqF;AACrF,iDAA8C;AAC9C,6CAA0C;AAoB1C;;;;;;;;;;;;GAYG;AACH,MAAsB,eAAgB,SAAQ,6BAAa;IACzD,wCAAwC;IACxB,gBAAgB,GAAG,iBAAiB,CAAC;IAGrD,uDAAuD;IAChD,OAAO,GAAY,KAAK,CAAC;IAGhC,6DAA6D;IACtD,UAAU;QACf,OAAO,qCAAiB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IAC5C,CAAC;IACO,mBAAmB,CACzB,UAAmB,EAAE,SAAsC,KAAK,EAAE,MAA4B,EAAE,SAAkB,KAAK;QAEvH,IAAI,OAAwC,CAAC;QAC7C,MAAM,OAAO,GAAG,IAAI,yCAAmB,EAAE,CAAC;QAC1C,IAAI,GAAG,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;QAC9C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC9C,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;YAC/B,IAAI,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;gBAClB,uFAAuF;gBACvF,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,C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AC;IAC3B,CAAC;IACD,mBAAmB;IACZ,WAAW,CAAC,KAA2B;QAC5C,IAAI,KAAK;YACP,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,2BAA2B;IACpB,QAAQ,CAAC,CAAS;QACvB,IAAI,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM;YAC3B,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QAC3B,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,8EAA8E;IACvE,yBAAyB,CAAC,OAAwB;QACvD,OAAO,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;CACF;AA3ED,kCA2EC","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 Curve\r\n */\r\n\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { Geometry } from \"../Geometry\";\r\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\r\nimport { Matrix3d } from \"../geometry3d/Matrix3d\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"../geometry3d/Plane3dByOriginAndUnitNormal\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Range1d, Range3d } from \"../geometry3d/Range\";\r\nimport { Ray3d } from \"../geometry3d/Ray3d\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { CurveExtendMode, CurveExtendOptions, VariantCurveExtendParameter } from \"./CurveExtendMode\";\r\nimport { CurveLocationDetail } from \"./CurveLocationDetail\";\r\nimport { CurvePrimitive, TangentOptions } from \"./CurvePrimitive\";\r\nimport { RecursiveCurveProcessor } from \"./CurveProcessor\";\r\nimport { AnyCurve, type AnyRegion } from \"./CurveTypes\";\r\nimport { GeometryQuery } from \"./GeometryQuery\";\r\nimport { AnnounceTangentStrokeHandler } from \"./internalContexts/AnnounceTangentStrokeHandler\";\r\nimport { CloneCurvesContext } from \"./internalContexts/CloneCurvesContext\";\r\nimport { CloneWithExpandedLineStrings } from \"./internalContexts/CloneWithExpandedLineStrings\";\r\nimport { CountLinearPartsSearchContext } from \"./internalContexts/CountLinearPartsSearchContext\";\r\nimport { GapSearchContext } from \"./internalContexts/GapSearchContext\";\r\nimport { PlaneAltitudeRangeContext } from \"./internalContexts/PlaneAltitudeRangeContext\";\r\nimport { SumLengthsContext } from \"./internalContexts/SumLengthsContext\";\r\nimport { TransformInPlaceContext } from \"./internalContexts/TransformInPlaceContext\";\r\nimport { LineString3d } from \"./LineString3d\";\r\nimport { ProxyCurve } from \"./ProxyCurve\";\r\nimport { StrokeOptions } from \"./StrokeOptions\";\r\n\r\nimport type { Path } from \"./Path\";\r\nimport type { Loop } from \"./Loop\";\r\n\r\n/** Note: CurveChain and BagOfCurves classes are located in this file to prevent circular dependency. */\r\n\r\n/**\r\n * Describes the concrete type of a [[CurveCollection]]. Each type name maps to a specific subclass and can be\r\n * used in conditional statements for type-switching.\r\n * - \"loop\" => [[Loop]]\r\n * - \"path\" => [[Path]]\r\n * - \"unionRegion\" => [[UnionRegion]]\r\n * - \"parityRegion\" => [[ParityRegion]]\r\n * - \"bagOfCurves\" => [[BagOfCurves]]\r\n * @public\r\n */\r\nexport type CurveCollectionType = \"loop\" | \"path\" | \"unionRegion\" | \"parityRegion\" | \"bagOfCurves\";\r\n\r\n/**\r\n * A `CurveCollection` is an abstract (non-instantiable) class for various sets of curves with particular structures:\r\n * - [[CurveChain]] - a non-instantiable intermediate class for a sequence of [[CurvePrimitive]] joining head-to-tail.\r\n * The two instantiable forms of `CurveChain` are:\r\n * - [[Path]] - a chain of curves. Does not have to be closed or planar. A closed `Path` is not treated as bounding a surface.\r\n * - [[Loop]] - a closed and planar chain of curves. A `Loop` is treated as bounding a planar area.\r\n * - [[ParityRegion]] - a collection of coplanar `Loop`, with \"in/out\" classification by parity rules.\r\n * - [[UnionRegion]] - a collection of coplanar `Loop` and/or `ParityRegion`, with \"in/out\" classification by union rules.\r\n * - [[BagOfCurves]] - a collection of [[AnyCurve]] with no implied structure.\r\n *\r\n * @see [Curve Collections]($docs/learning/geometry/CurveCollection.md) learning article.\r\n * @public\r\n */\r\nexport abstract class CurveCollection extends GeometryQuery {\r\n /** String name for schema properties */\r\n public readonly geometryCategory = \"curveCollection\";\r\n /** Type discriminator. */\r\n public abstract readonly curveCollectionType: CurveCollectionType;\r\n /** Flag for inner loop status. Only used by `Loop`. */\r\n public isInner: boolean = false;\r\n /** Return the curve children. */\r\n public abstract override get children(): AnyCurve[];\r\n /** Return the sum of the lengths of all contained curves. */\r\n public sumLengths(): number {\r\n return SumLengthsContext.sumLengths(this);\r\n }\r\n private computeClosestPoint(\r\n spacePoint: Point3d, extend: VariantCurveExtendParameter = false, result?: CurveLocationDetail, xyOnly: boolean = false,\r\n ): CurveLocationDetail | undefined {\r\n let detailA: CurveLocationDetail | undefined;\r\n const detailB = new CurveLocationDetail();\r\n let ext = this.isAnyRegion() ? false : extend;\r\n for (let i = 0; i < this.children.length; i++) {\r\n const child = this.children[i];\r\n if (this.isPath()) {\r\n // head only extends at start; tail only at end. NOTE: child may be both head and tail!\r\n const mode0 = (i === 0) ? CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extend, 0) : CurveExtendMode.None;\r\n const mode1 = (i === this.children.length - 1) ? CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extend, 1) : CurveExtendMode.None;\r\n ext = [mode0, mode1];\r\n }\r\n const cp = xyOnly ? child.closestPointXY(spacePoint, ext, detailB) : child.closestPoint(spacePoint, ext, detailB);\r\n if (cp) {\r\n const smaller = CurveLocationDetail.chooseSmallerA(detailA, detailB);\r\n assert(undefined !== smaller, \"expect defined because detailB is always defined\");\r\n detailA = result = smaller.clone(result);\r\n }\r\n }\r\n return detailA;\r\n }\r\n /**\r\n * Return the closest point on the contained curves.\r\n * @param spacePoint point in space.\r\n * @param extend extend applicable only to [[Path]] and [[BagOfCurves]]. Default value `false`.\r\n * @param result (optional) pre-allocated detail to populate and return.\r\n * @returns details of the closest point.\r\n */\r\n public closestPoint(\r\n spacePoint: Point3d, extend: VariantCurveExtendParameter = false, result?: CurveLocationDetail,\r\n ): CurveLocationDetail | undefined {\r\n return this.computeClosestPoint(spacePoint, extend, result);\r\n }\r\n /**\r\n * Return the closest point on the contained curves as viewed in the xy-plane (ignoring z).\r\n * @param spacePoint point in space.\r\n * @param extend (optional) extend applicable only to [[Path]] and [[BagOfCurves]]. Default value `false`.\r\n * @param result (optional) pre-allocated detail to populate and return.\r\n * @returns details of the closest point.\r\n */\r\n public closestPointXY(\r\n spacePoint: Point3d, extend: VariantCurveExtendParameter = false, result?: CurveLocationDetail,\r\n ): CurveLocationDetail | undefined {\r\n return this.computeClosestPoint(spacePoint, extend, result, true);\r\n }\r\n /**\r\n * Announce all points `P` on the contained curves such that the line containing `spacePoint` and `P` is tangent to\r\n * the contained curves in the view defined by `options.vectorToEye`.\r\n * * Strictly speaking, each tangent line lies in the plane through `P` whose normal is the cross product of the curve\r\n * tangent at `P` and `options.vectorToEye`. This is equivalent to tangency as seen in a view plane perpendicular to\r\n * `options.vectorToEye`.\r\n * @param spacePoint point in space.\r\n * @param announceTangent callback to announce each computed tangent. The received [[CurveLocationDetail]] is reused\r\n * internally, so it should be cloned in the callback if it needs to be saved.\r\n * @param options (optional) options for computing tangents. See [[TangentOptions]] for defaults.\r\n */\r\n public emitTangents(\r\n spacePoint: Point3d, announceTangent: (tangent: CurveLocationDetail) => any, options?: TangentOptions,\r\n ): void {\r\n const strokeHandler = new AnnounceTangentStrokeHandler(spacePoint, announceTangent, options);\r\n if (this.children !== undefined) {\r\n for (const child of this.children) {\r\n if (child instanceof CurvePrimitive)\r\n child.emitStrokableParts(strokeHandler, options?.strokeOptions);\r\n else if (child instanceof CurveCollection)\r\n child.emitTangents(spacePoint, announceTangent, options);\r\n }\r\n }\r\n }\r\n /**\r\n * Return all points `P` on the contained curves such that the line containing `spacePoint` and `P` is tangent to the\r\n * contained curves in the view defined by `options.vectorToEye`.\r\n * * See [[emitTangents]] for the definition of tangency employed.\r\n * @param spacePoint point in space.\r\n * @param options (optional) options for computing tangents. See [[TangentOptions]] for defaults.\r\n * @returns an array of details of all tangent points or undefined if no tangent was found.\r\n */\r\n public allTangents(spacePoint: Point3d, options?: TangentOptions): CurveLocationDetail[] | undefined {\r\n const tangents: CurveLocationDetail[] = [];\r\n this.emitTangents(spacePoint, (t: CurveLocationDetail) => tangents.push(t.clone()), options);\r\n return (tangents.length === 0) ? undefined : tangents;\r\n }\r\n /**\r\n * Return the point `P` on the contained curves such that the line containing `spacePoint` and `P` is tangent to the\r\n * contained curves in the view defined by `options.vectorToEye`, and `P` is closest to `options.hintPoint` in this view.\r\n * * See [[emitTangents]] for the definition of tangency employed.\r\n * @param spacePoint point in space.\r\n * @param options (optional) options for computing tangents. See [[TangentOptions]] for defaults.\r\n * @returns the detail of the closest tangent point or undefined if no tangent was found.\r\n */\r\n public closestTangent(spacePoint: Point3d, options?: TangentOptions): CurveLocationDetail | undefined {\r\n const hint = options?.hintPoint ?? spacePoint;\r\n let toLocal: Matrix3d | undefined;\r\n if (options?.vectorToEye && !options.vectorToEye.isExactEqual({ x: 0, y: 0, z: 1 }))\r\n toLocal = Matrix3d.createRigidViewAxesZTowardsEye(options.vectorToEye.x, options.vectorToEye.y, options.vectorToEye.z);\r\n const measureHintDist2 = (pt: Point3d): number => { // measure distance to hint in view plane coordinates\r\n return toLocal?.multiplyTransposeXYZ(hint.x - pt.x, hint.y - pt.y, hint.z - pt.z).magnitudeSquaredXY() ?? pt.distanceSquaredXY(hint);\r\n };\r\n let closestTangent: CurveLocationDetail | undefined;\r\n let closestDist2 = Geometry.largeCoordinateResult;\r\n const collectClosestTangent = (tangent: CurveLocationDetail) => {\r\n const dist2 = measureHintDist2(tangent.point);\r\n if (!closestTangent || dist2 < closestDist2) {\r\n closestTangent = tangent.clone(closestTangent);\r\n closestDist2 = dist2;\r\n }\r\n };\r\n this.emitTangents(spacePoint, collectClosestTangent, options);\r\n return closestTangent;\r\n }\r\n /** Reverse the collection's data so that each child curve's fractional stroking moves in the opposite direction. */\r\n public reverseInPlace(): void {\r\n for (const curve of this.children)\r\n curve.reverseInPlace();\r\n }\r\n /** Call [[reverseInPlace]] and return the instance. */\r\n public reverse(): this {\r\n this.reverseInPlace();\r\n return this;\r\n }\r\n /**\r\n * Return the max gap between adjacent primitives in Path and Loop collections.\r\n * * In a Path, gaps are computed between consecutive primitives.\r\n * * In a Loop, gaps are computed between consecutive primitives and between last and first.\r\n * * Gaps are NOT computed between consecutive CurvePrimitives in \"unstructured\" collections. The type is\r\n * \"unstructured\" so gaps should not be semantically meaningful.\r\n */\r\n public maxGap(): number {\r\n return GapSearchContext.maxGap(this);\r\n }\r\n /** Return true if the curve collection has any primitives other than LineSegment3d and LineString3d */\r\n public checkForNonLinearPrimitives(): boolean {\r\n return CountLinearPartsSearchContext.hasNonLinearPrimitives(this);\r\n }\r\n /** Apply transform recursively to children */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n return TransformInPlaceContext.tryTransformInPlace(this, transform);\r\n }\r\n /** Return a deep copy. */\r\n public override clone(): CurveCollection {\r\n return CloneCurvesContext.clone(this) as CurveCollection;\r\n }\r\n /** Create a deep copy of transformed curves. */\r\n public override cloneTransformed(transform: Transform): CurveCollection | undefined {\r\n return CloneCurvesContext.clone(this, transform);\r\n }\r\n /** Create a deep copy with all linestrings broken down into multiple LineSegment3d. */\r\n public cloneWithExpandedLineStrings(): CurveCollection {\r\n return CloneWithExpandedLineStrings.clone(this);\r\n }\r\n /**\r\n * Push all CurvePrimitives contained in the instance onto the `results` array.\r\n * * This method is recursive. For example, if the CurveCollection contains a Loop, all CurvePrimitives\r\n * of the Loop are pushed onto `results`.\r\n */\r\n private collectCurvePrimitivesGo(\r\n results: CurvePrimitive[], smallestPossiblePrimitives: boolean, explodeLinestrings: boolean = false,\r\n ): void {\r\n if (this.children) {\r\n for (const child of this.children) {\r\n if (child instanceof CurvePrimitive)\r\n child.collectCurvePrimitivesGo(results, smallestPossiblePrimitives, explodeLinestrings);\r\n else if (child instanceof CurveCollection)\r\n child.collectCurvePrimitivesGo(results, smallestPossiblePrimitives, explodeLinestrings);\r\n }\r\n }\r\n }\r\n /**\r\n * Return an array containing all CurvePrimitives in the instance.\r\n * * This method is recursive. For example, if the CurveCollection contains a Loop, all CurvePrimitives of\r\n * the Loop are pushed onto the returned array.\r\n * @param collectorArray optional array to receive primitives. If present, new primitives are ADDED (without\r\n * clearing the array).\r\n * @param smallestPossiblePrimitives if false, CurvePrimitiveWithDistanceIndex returns only itself. If true,\r\n * it recurses to its (otherwise hidden) children.\r\n */\r\n public collectCurvePrimitives(\r\n collectorArray?: CurvePrimitive[], smallestPossiblePrimitives: boolean = false, explodeLineStrings: boolean = false,\r\n ): CurvePrimitive[] {\r\n const results: CurvePrimitive[] = collectorArray === undefined ? [] : collectorArray;\r\n this.collectCurvePrimitivesGo(results, smallestPossiblePrimitives, explodeLineStrings);\r\n return results;\r\n }\r\n /**\r\n * Return true for planar region types:\r\n * * `Loop`\r\n * * `ParityRegion`\r\n * * `UnionRegion`\r\n * @see isAnyRegion\r\n */\r\n public get isAnyRegionType(): boolean {\r\n return this.dgnBoundaryType() === 2 || this.dgnBoundaryType() === 4 || this.dgnBoundaryType() === 5;\r\n }\r\n /** Type guard for AnyRegion */\r\n public isAnyRegion(): this is AnyRegion {\r\n return this.isAnyRegionType;\r\n }\r\n /**\r\n * Return true for a `Path`, i.e. a chain of curves joined head-to-tail.\r\n * * This is NOT a test for (lack of) physical closure.\r\n * @see [[isPath]], [[CurveChain.isPhysicallyClosedCurve]]\r\n */\r\n public get isOpenPath(): boolean {\r\n return this.dgnBoundaryType() === 1;\r\n }\r\n /**\r\n * Type guard for Path.\r\n * * This is NOT a test for (lack of) physical closure.\r\n * @see [[CurveChain.isPhysicallyClosedCurve]]\r\n */\r\n public isPath(): this is Path {\r\n return this.isOpenPath;\r\n }\r\n /**\r\n * Return true for a single-loop planar region type, i.e. `Loop`.\r\n * * This is NOT a test for physical closure.\r\n * @see [[isLoop]], [[CurveChain.isPhysicallyClosedCurve]]\r\n */\r\n public get isClosedPath(): boolean {\r\n return this.dgnBoundaryType() === 2;\r\n }\r\n /**\r\n * Type guard for Loop.\r\n * * This is NOT a test for physical closure.\r\n * @see [[CurveChain.isPhysicallyClosedCurve]]\r\n */\r\n public isLoop(): this is Loop {\r\n return this.isClosedPath;\r\n }\r\n\r\n /** Return a CurveCollection with the same structure but all curves replaced by strokes. */\r\n public abstract cloneStroked(options?: StrokeOptions): CurveCollection;\r\n /** Support method for ICurvePrimitive ... one line call to specific announce method . . */\r\n public abstract announceToCurveProcessor(processor: RecursiveCurveProcessor): void;\r\n /** Clone an empty collection. */\r\n public abstract cloneEmptyPeer(): CurveCollection;\r\n /**\r\n * Return the boundary type of a corresponding MicroStation CurveVector.\r\n * * Derived class must implement.\r\n */\r\n public abstract dgnBoundaryType(): number;\r\n /**\r\n * Try to add a child.\r\n * @param child child to add.\r\n * @return true if child is an acceptable type for this collection.\r\n */\r\n public abstract tryAddChild(child: AnyCurve | undefined): boolean;\r\n /** Return a child identified by by index */\r\n public abstract getChild(i: number): AnyCurve | undefined;\r\n /**\r\n * Extend (increase) the given range as needed to encompass all curves in the curve collection.\r\n * @param rangeToExtend the given range.\r\n * @param transform if supplied, the range is extended with transformed curves.\r\n */\r\n public extendRange(rangeToExtend: Range3d, transform?: Transform): void {\r\n const children = this.children;\r\n if (children) {\r\n for (const c of children) {\r\n c.extendRange(rangeToExtend, transform);\r\n }\r\n }\r\n }\r\n /**\r\n * Find any CurvePrimitive in the source and evaluate it at the given fraction.\r\n * * The first CurvePrimitive found is evaluated. Any other CurvePrimitives are ignored.\r\n * @param source containing `CurvePrimitive` or `CurveCollection`\r\n * @param fraction fraction to use in `curve.fractionToPoint(fraction)`\r\n */\r\n public static createCurveLocationDetailOnAnyCurvePrimitive(\r\n source: GeometryQuery | undefined, fraction: number = 0.5,\r\n ): CurveLocationDetail | undefined {\r\n if (!source)\r\n return undefined;\r\n if (source instanceof CurvePrimitive) {\r\n return CurveLocationDetail.createCurveEvaluatedFraction(source, fraction);\r\n } else if (source instanceof CurveCollection && source.children !== undefined)\r\n for (const child of source.children) {\r\n const detail = this.createCurveLocationDetailOnAnyCurvePrimitive(child, fraction);\r\n if (detail)\r\n return detail;\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Project instance geometry (via dispatch) onto the given ray, and return the extreme fractional parameters\r\n * of projection.\r\n * @param ray ray onto which the instance is projected. A `Vector3d` is treated as a `Ray3d` with zero origin.\r\n * @param lowHigh optional receiver for output\r\n * @returns range of fractional projection parameters onto the ray, where 0.0 is start of the ray and 1.0 is the\r\n * end of the ray.\r\n */\r\n public projectedParameterRange(ray: Vector3d | Ray3d, lowHigh?: Range1d): Range1d | undefined {\r\n return PlaneAltitudeRangeContext.findExtremeFractionsAlongDirection(this, ray, lowHigh);\r\n }\r\n /** Return the immediate parent of the input curve in the instance, or undefined if it is not a descendant. */\r\n public findParentOfDescendant(descendant: AnyCurve): CurveCollection | undefined {\r\n for (const child of this.children) {\r\n if (child === descendant)\r\n return this;\r\n if (child instanceof CurveCollection) {\r\n const parent = child.findParentOfDescendant(descendant);\r\n if (parent)\r\n return parent;\r\n }\r\n }\r\n return undefined;\r\n };\r\n /**\r\n * Ask if the curves of the collection are within tolerance of the input plane.\r\n * @returns whether the collection is nonempty and its curves lie within tolerance of the plane.\r\n */\r\n public isInPlane(plane: Plane3dByOriginAndUnitNormal): boolean {\r\n if (0 === this.children.length)\r\n return false; // punt on empty parent...\r\n for (const child of this.children) {\r\n if (child instanceof CurveCollection && 0 === child.children.length)\r\n continue; // ...but ignore an empty child\r\n if (!child.isInPlane(plane))\r\n return false;\r\n }\r\n return true;\r\n }\r\n}\r\n\r\n/**\r\n * Shared base class for use by both open and closed paths.\r\n * * A `CurveChain` contains only CurvePrimitives. No other paths, loops, or regions allowed.\r\n * * The specific derived classes are `Path` and `Loop`.\r\n * * `CurveChain` is an intermediate class. It is not instantiable on its own.\r\n * * The related class `CurveChainWithDistanceIndex` is a `CurvePrimitive` whose API presents well-defined mappings\r\n * from fraction to xyz over the entire chain, but in fact does all the calculations over multiple primitives.\r\n * @see [Curve Collections]($docs/learning/geometry/CurveCollection.md) learning article.\r\n * @public\r\n */\r\nexport abstract class CurveChain extends CurveCollection {\r\n /** The curve primitives in the chain. */\r\n protected _curves: CurvePrimitive[];\r\n /** Constructor */\r\n protected constructor() {\r\n super();\r\n this._curves = [];\r\n }\r\n /** Return the array of `CurvePrimitive` */\r\n public override get children(): CurvePrimitive[] {\r\n return this._curves;\r\n }\r\n /** Return the start point of the curve chain (start point of the first child). */\r\n public startPoint(result?: Point3d): Point3d | undefined {\r\n const firstChild = this.getChild(0);\r\n if (firstChild)\r\n return firstChild.fractionToPoint(0.0, result);\r\n else\r\n return undefined;\r\n }\r\n /** Return the end point of the curve chain (end point of the last child). */\r\n public endPoint(result?: Point3d): Point3d | undefined {\r\n const lastChild = this.getChild(this._curves.length - 1);\r\n if (lastChild)\r\n return lastChild.fractionToPoint(1.0, result);\r\n else\r\n return undefined;\r\n }\r\n /**\r\n * Whether the chain start and end points are defined and within tolerance.\r\n * * Does not check for planarity or degeneracy.\r\n * @param tolerance optional distance tolerance (default is [[Geometry.smallMetricDistance]])\r\n * @param xyOnly if true, ignore z coordinate (default is `false`)\r\n */\r\n public isPhysicallyClosedCurve(tolerance: number = Geometry.smallMetricDistance, xyOnly: boolean = false): boolean {\r\n const p0 = this.startPoint();\r\n const p1 = this.endPoint();\r\n return p0 !== undefined && p1 !== undefined && (xyOnly ? p0.isAlmostEqualXY(p1, tolerance) : p0.isAlmostEqual(p1, tolerance));\r\n }\r\n /**\r\n * Return the start point and derivative of the first child of the curve chain.\r\n * * For queries interior to the chain, use [[CurveChainWithDistanceIndex.fractionToPointAndDerivative]].\r\n */\r\n public startPointAndDerivative(result?: Ray3d): Ray3d | undefined {\r\n const firstChild = this.getChild(0);\r\n if (firstChild)\r\n return firstChild.fractionToPointAndDerivative(0.0, result);\r\n else\r\n return undefined;\r\n }\r\n /**\r\n * Return the end point and derivative of the last child of the curve chain.\r\n * * For queries interior to the chain, use [[CurveChainWithDistanceIndex.fractionToPointAndDerivative]].\r\n */\r\n public endPointAndDerivative(result?: Ray3d): Ray3d | undefined {\r\n const lastChild = this.getChild(this._curves.length - 1);\r\n if (lastChild)\r\n return lastChild.fractionToPointAndDerivative(1.0, result);\r\n else\r\n return undefined;\r\n }\r\n /**\r\n * Return the curve primitive at the given `index`, optionally using `modulo` to map `index` to the cyclic indexing.\r\n * * In particular, `-1` is the final curve.\r\n * @param index cyclic index\r\n * @param cyclic whether to employ modulo operator for wrap-around indexing. Default is `true`.\r\n */\r\n public cyclicCurvePrimitive(index: number, cyclic: boolean = true): CurvePrimitive | undefined {\r\n const n = this.children.length;\r\n if (n === 0)\r\n return undefined;\r\n if (index >= 0 && index < n) // try simplest non-cyclic access first\r\n return this.children[index];\r\n if (cyclic) {\r\n const index2 = Geometry.modulo(index, n);\r\n return this.children[index2];\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Stroke the chain into a simple xyz array.\r\n * @param options tolerance parameters controlling the stroking.\r\n */\r\n public getPackedStrokes(options?: StrokeOptions): GrowableXYZArray | undefined {\r\n /**\r\n * The object returned by \"cloneStroked\" has the same type (Loop or Path) but instead of a chain of\r\n * CurvePrimitives as children, it has a single LineString3d child. \"getPackedStrokes\" just returns\r\n * the points of that LineString3d using \"packedPoints\".\r\n */\r\n const tree = this.cloneStroked(options);\r\n if (tree instanceof CurveChain) {\r\n const children = tree.children;\r\n if (children.length === 1) {\r\n const ls = children[0];\r\n if (ls instanceof LineString3d)\r\n return ls.packedPoints;\r\n }\r\n }\r\n return undefined;\r\n }\r\n /** Return a structural clone, with CurvePrimitive objects stroked. */\r\n public abstract override cloneStroked(options?: StrokeOptions): CurveChain;\r\n /**\r\n * Add a child curve.\r\n * @param child curve to add to the chain. The curve is captured by this instance.\r\n * @return whether the child was added\r\n */\r\n public tryAddChild(child: AnyCurve | undefined): boolean {\r\n if (child && child instanceof CurvePrimitive) {\r\n this._curves.push(child);\r\n return true;\r\n }\r\n return false;\r\n }\r\n /** Return a child by index */\r\n public getChild(i: number): CurvePrimitive | undefined {\r\n if (i < this._curves.length) return this._curves[i];\r\n return undefined;\r\n }\r\n /** Invoke `curve.extendRange(range, transform)` for each child */\r\n public override extendRange(range: Range3d, transform?: Transform): void {\r\n for (const curve of this._curves)\r\n curve.extendRange(range, transform);\r\n }\r\n /**\r\n * Reverse each child curve (in place).\r\n * Reverse the order of the children array.\r\n */\r\n public reverseChildrenInPlace(): void {\r\n for (const curve of this._curves)\r\n curve.reverseInPlace();\r\n this._curves.reverse();\r\n }\r\n /** Same as [[reverseChildrenInPlace]]. */\r\n public override reverseInPlace(): void {\r\n this.reverseChildrenInPlace();\r\n }\r\n /**\r\n * Return the index where target is found in the array of children.\r\n * @param alsoSearchProxies whether to also check proxy curves of the children\r\n */\r\n public childIndex(target: CurvePrimitive | undefined, alsoSearchProxies?: boolean): number | undefined {\r\n for (let i = 0; i < this._curves.length; i++) {\r\n if (this._curves[i] === target)\r\n return i;\r\n }\r\n if (alsoSearchProxies ?? false) {\r\n for (let i = 0; i < this._curves.length; i++) {\r\n const childCurve = this._curves[i];\r\n if (childCurve instanceof ProxyCurve) {\r\n if (childCurve.proxyCurve === target)\r\n return i;\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n /** Evaluate an indexed curve at a fraction. Return as a CurveLocationDetail that indicates the primitive. */\r\n public primitiveIndexAndFractionToCurveLocationDetailPointAndDerivative(\r\n index: number, fraction: number, cyclic: boolean = false, result?: CurveLocationDetail,\r\n ): CurveLocationDetail | undefined {\r\n const primitive = this.cyclicCurvePrimitive(index, cyclic);\r\n if (primitive) {\r\n return CurveLocationDetail.createCurveEvaluatedFractionPointAndDerivative(primitive, fraction, result);\r\n }\r\n return undefined;\r\n }\r\n}\r\n\r\n/**\r\n * * A `BagOfCurves` object is a collection of `AnyCurve` objects.\r\n * * A `BagOfCurves` has no implied properties such as being planar.\r\n * @public\r\n */\r\nexport class BagOfCurves extends CurveCollection {\r\n /** String name for schema properties */\r\n public readonly curveCollectionType = \"bagOfCurves\";\r\n /** Test if `other` is an instance of `BagOfCurves` */\r\n public isSameGeometryClass(other: GeometryQuery): boolean {\r\n return other instanceof BagOfCurves;\r\n }\r\n /**\r\n * Array of children.\r\n * * No restrictions on type.\r\n */\r\n protected _children: AnyCurve[];\r\n /** Construct an empty `BagOfCurves` */\r\n public constructor() {\r\n super();\r\n this._children = [];\r\n }\r\n /** Return the (reference to) array of children */\r\n public override get children(): AnyCurve[] {\r\n return this._children;\r\n }\r\n /** Create with given curves. */\r\n public static create(...data: AnyCurve[]): BagOfCurves {\r\n const result = new BagOfCurves();\r\n for (const child of data) {\r\n result.tryAddChild(child);\r\n }\r\n return result;\r\n }\r\n /** Return the boundary type (0) of a corresponding MicroStation CurveVector */\r\n public dgnBoundaryType(): number {\r\n return 0;\r\n }\r\n /** Invoke `processor.announceBagOfCurves(this, indexInParent);` */\r\n public announceToCurveProcessor(processor: RecursiveCurveProcessor, indexInParent: number = -1): void {\r\n return processor.announceBagOfCurves(this, indexInParent);\r\n }\r\n /** Clone all children in stroked form. */\r\n public cloneStroked(options?: StrokeOptions): BagOfCurves {\r\n const clone = new BagOfCurves();\r\n let child;\r\n for (child of this.children) {\r\n if (child instanceof CurvePrimitive) {\r\n const ls = LineString3d.create();\r\n child.emitStrokes(ls, options);\r\n if (ls)\r\n clone.children.push(ls);\r\n } else if (child instanceof CurveCollection) {\r\n const childStrokes = child.cloneStroked(options);\r\n if (childStrokes)\r\n clone.children.push(childStrokes);\r\n }\r\n }\r\n return clone;\r\n }\r\n /** Return an empty `BagOfCurves` */\r\n public cloneEmptyPeer(): BagOfCurves {\r\n return new BagOfCurves();\r\n }\r\n /** Add a child */\r\n public tryAddChild(child: AnyCurve | undefined): boolean {\r\n if (child)\r\n this._children.push(child);\r\n return true;\r\n }\r\n /** Get a child by index */\r\n public getChild(i: number): AnyCurve | undefined {\r\n if (i < this._children.length)\r\n return this._children[i];\r\n return undefined;\r\n }\r\n /** Second step of double dispatch: call `handler.handleBagOfCurves(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleBagOfCurves(this);\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurveOps.d.ts","sourceRoot":"","sources":["../../../src/curve/CurveOps.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAEhF,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAe,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAIlD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"CurveOps.d.ts","sourceRoot":"","sources":["../../../src/curve/CurveOps.ts"],"names":[],"mappings":"AAW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CAAC,kBAAkB;QAEtC,IAAI,OAAO,GAAG,OAAO;YACnB,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;;YAE3C,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAC7C,GAAG,CAAC,SAAS,CAAC,CAAC,GAAG,GAAG,CAAC;QACtB,OAAO,GAAG,CAAC,CAAC,kCAAkC;IAChD,CAAC;CACF;AA1ND,4BA0NC","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 Curve\r\n */\r\n\r\nimport { AxisIndex, Geometry } from \"../Geometry\";\r\nimport { FrameBuilder } from \"../geometry3d/FrameBuilder\";\r\nimport { MultiLineStringDataVariant } from \"../geometry3d/IndexedXYZCollection\";\r\nimport { Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Range3d } from \"../geometry3d/Range\";\r\nimport { Ray3d } from \"../geometry3d/Ray3d\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { BagOfCurves, CurveCollection } from \"./CurveCollection\";\r\nimport { CurvePrimitive } from \"./CurvePrimitive\";\r\nimport { AnyChain, AnyCurve } from \"./CurveTypes\";\r\nimport { GeometryQuery } from \"./GeometryQuery\";\r\nimport { MultiChainCollector } from \"./internalContexts/MultiChainCollector\";\r\nimport { CurveChainWireOffsetContext } from \"./internalContexts/PolygonOffsetContext\";\r\nimport { LineString3d } from \"./LineString3d\";\r\nimport { Loop } from \"./Loop\";\r\nimport { OffsetOptions } from \"./OffsetOptions\";\r\nimport { Path } from \"./Path\";\r\nimport { StrokeOptions } from \"./StrokeOptions\";\r\n\r\n /**\r\n * Options bundle for use in [[CurveOps.isPlanar]] and [[CurveOps.isColinear]].\r\n * @public\r\n */\r\n export interface PlanarColinearOptions {\r\n /** Maximum allowable distance that geometry can deviate from planarity/colinearity. Default is [[Geometry.smallMetricDistance]]. */\r\n maxDeviation?: number;\r\n /** Whether colinearity test ignores z-coordinates. Default is `false`. */\r\n xyColinear?: boolean;\r\n /** Radian tolerance for xy-colinearity, measuring maximum angular deviation from a vertical plane. Default is [[Geometry.smallAngleRadians]]. */\r\n radianTolerance?: number;\r\n /** Pre-allocated object to populate with the computed plane-to-world transformation and return when planarity test succeeds. */\r\n localToWorld?: Transform;\r\n /** Pre-allocated object to populate with the computed line and return when colinear test succeeds. */\r\n colinearRay?: Ray3d;\r\n }\r\n\r\n/**\r\n * Static methods for miscellaneous curve operations.\r\n * @public\r\n */\r\nexport class CurveOps {\r\n /** Recursively sum curve lengths, allowing CurvePrimitive, CurveCollection, or array of such at any level. */\r\n public static sumLengths(curves: AnyCurve | AnyCurve[]): number {\r\n let mySum = 0;\r\n if (curves instanceof CurvePrimitive) {\r\n mySum += curves.curveLength();\r\n } else if (curves instanceof CurveCollection) {\r\n mySum += curves.sumLengths();\r\n } else if (Array.isArray(curves)) {\r\n for (const data1 of curves)\r\n mySum += this.sumLengths(data1);\r\n }\r\n return mySum;\r\n }\r\n /** Recursively extend the range by each curve's range, allowing CurvePrimitive, CurveCollection, or array of such at any level. */\r\n public static extendRange(range: Range3d, curves: AnyCurve | AnyCurve[], transform?: Transform): Range3d {\r\n if (Array.isArray(curves)) {\r\n for (const data1 of curves)\r\n this.extendRange(range, data1, transform);\r\n } else {\r\n curves.extendRange(range, transform);\r\n }\r\n return range;\r\n }\r\n /**\r\n * Construct a separate xy-offset for each input curve.\r\n * * For best offset results, the inputs should be parallel to the xy-plane.\r\n * @param curves input curve(s), z-coordinates ignored. Only curves of type [[AnyChain]] are handled.\r\n * @param offset offset distance (positive to left of curve, negative to right)\r\n * @param result array to collect offset curves\r\n * @returns summed length of offset curves\r\n */\r\n public static appendXYOffsets(curves: AnyCurve | AnyCurve[] | undefined, offset: number, result: AnyCurve[]): number {\r\n let summedLengths = 0;\r\n if (curves instanceof CurvePrimitive) {\r\n const resultA = CurveChainWireOffsetContext.constructCurveXYOffset(Path.create(curves), offset);\r\n if (resultA) {\r\n summedLengths += this.sumLengths(resultA);\r\n result.push(resultA);\r\n }\r\n } else if (curves instanceof Loop || curves instanceof Path) {\r\n const resultA = CurveChainWireOffsetContext.constructCurveXYOffset(curves, offset);\r\n if (resultA) {\r\n summedLengths += this.sumLengths(resultA);\r\n result.push(resultA);\r\n }\r\n } else if (curves instanceof BagOfCurves) {\r\n for (const q of curves.children)\r\n summedLengths += this.appendXYOffsets(q, offset, result);\r\n } else if (Array.isArray(curves)) {\r\n for (const q of curves)\r\n summedLengths += this.appendXYOffsets(q, offset, result);\r\n }\r\n return summedLengths;\r\n }\r\n /**\r\n * Restructure curve fragments as Paths and Loops, and construct xy-offsets of the chains.\r\n * * If the inputs do not form Loop(s), the classification of offsets is suspect.\r\n * * For best offset results, the inputs should be parallel to the xy-plane.\r\n * * Chain formation is dependent upon input fragment order, as a greedy algorithm is employed.\r\n * @param fragments fragments to be chained and offset\r\n * @param offsetDistance offset distance, applied to both sides of each fragment to produce inside and outside xy-offset curves.\r\n * @param gapTolerance distance to be treated as \"effectively zero\" when joining head-to-tail\r\n * @returns object with named chains, insideOffsets, outsideOffsets\r\n */\r\n public static collectInsideAndOutsideXYOffsets(fragments: AnyCurve[], offsetDistance: number, gapTolerance: number): { insideOffsets: AnyCurve[], outsideOffsets: AnyCurve[], chains?: AnyChain } {\r\n const collector = new MultiChainCollector(gapTolerance, gapTolerance);\r\n for (const s of fragments) {\r\n collector.captureCurve(s);\r\n }\r\n const chains = collector.grabResult(true);\r\n const myOffsetA: CurveCollection[] = [];\r\n const myOffsetB: CurveCollection[] = [];\r\n const offsetLengthA = CurveOps.appendXYOffsets(chains, offsetDistance, myOffsetA);\r\n const offsetLengthB = CurveOps.appendXYOffsets(chains, -offsetDistance, myOffsetB);\r\n if (offsetLengthA > offsetLengthB) {\r\n return { outsideOffsets: myOffsetA, insideOffsets: myOffsetB, chains };\r\n } else {\r\n return { insideOffsets: myOffsetA, outsideOffsets: myOffsetB, chains };\r\n }\r\n }\r\n /**\r\n * Construct curves that are offset from a Path or Loop as viewed in xy-plane (ignoring z).\r\n * * The construction will remove \"some\" local effects of features smaller than the offset distance, but will not detect self intersection among widely separated edges.\r\n * @param curves base curves.\r\n * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or options object.\r\n */\r\n public static constructCurveXYOffset(curves: Path | Loop, offsetDistanceOrOptions: number | OffsetOptions): CurveCollection | undefined {\r\n return CurveChainWireOffsetContext.constructCurveXYOffset(curves, offsetDistanceOrOptions);\r\n }\r\n /**\r\n * Create the offset of a single curve primitive as viewed in the xy-plane (ignoring z).\r\n * @param curve primitive to offset\r\n * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or options object\r\n */\r\n public static createSingleOffsetPrimitiveXY(curve: CurvePrimitive, offsetDistanceOrOptions: number | OffsetOptions): CurvePrimitive | CurvePrimitive[] | undefined {\r\n return CurveChainWireOffsetContext.createSingleOffsetPrimitiveXY(curve, offsetDistanceOrOptions);\r\n }\r\n /**\r\n * Restructure curve fragments as Paths and Loops.\r\n * * Chain formation is dependent upon input fragment order, as a greedy algorithm is employed.\r\n * @param fragments fragments to be chained\r\n * @param gapTolerance distance to be treated as \"effectively zero\" when assembling fragments head-to-tail\r\n * @param planeTolerance tolerance for considering a closed chain to be planar. If undefined, only create Path. If defined, create Loops for closed chains within tolerance of a plane.\r\n * @returns chains, possibly wrapped in a [[BagOfCurves]].\r\n */\r\n public static collectChains(fragments: AnyCurve[], gapTolerance: number = Geometry.smallMetricDistance, planeTolerance?: number): AnyChain | undefined {\r\n const collector = new MultiChainCollector(gapTolerance, planeTolerance);\r\n for (const s of fragments) {\r\n collector.captureCurve(s);\r\n }\r\n return collector.grabResult(true);\r\n }\r\n /**\r\n * Restructure curve fragments, to be stroked and passed into the callback.\r\n * * Chain formation is dependent upon input fragment order, as a greedy algorithm is employed.\r\n * @param fragments fragments to be chained and stroked\r\n * @param announceChain callback to process each stroked Path and Loop\r\n * @param strokeOptions options for stroking the chains\r\n * @param gapTolerance distance to be treated as \"effectively zero\" when assembling fragments head-to-tail. Also used for removing duplicate points in the stroked chains.\r\n * @param _planeTolerance unused, pass undefined\r\n */\r\n public static collectChainsAsLineString3d(fragments: AnyCurve[], announceChain: (chainPoints: LineString3d) => void, strokeOptions?: StrokeOptions, gapTolerance: number = Geometry.smallMetricDistance, _planeTolerance?: number) {\r\n const collector = new MultiChainCollector(gapTolerance); // no planarity tolerance needed\r\n for (const s of fragments) {\r\n collector.captureCurve(s);\r\n }\r\n collector.announceChainsAsLineString3d(announceChain, strokeOptions);\r\n }\r\n /**\r\n * Compute the range of the curves in the local coordinates of a constructed localToWorld frame.\r\n * @param curves input geometry: curves or points.\r\n * @param localRange pre-allocated object to populate with the computed local range.\r\n * @param localToWorld optional pre-allocated object to populate with the computed frame.\r\n * @returns whether the frame was successfully computed.\r\n */\r\n public static computeLocalRange(curves: AnyCurve | MultiLineStringDataVariant, localRange: Range3d, localToWorld?: Transform): boolean {\r\n const builderData: any[] = [curves];\r\n if (localToWorld)\r\n builderData.push(localToWorld);\r\n localToWorld = FrameBuilder.createRightHandedFrame(Vector3d.unitZ(), ...builderData);\r\n if (!localToWorld)\r\n return false;\r\n const worldToLocal = localToWorld.inverse();\r\n localRange.setNull();\r\n if (Array.isArray(curves) || !(curves instanceof GeometryQuery))\r\n Range3d.createFromVariantData(curves, worldToLocal, localRange);\r\n else\r\n this.extendRange(localRange, curves, worldToLocal);\r\n return true;\r\n }\r\n /**\r\n * Check whether or not the curves are planar, and if so, return a localToWorld frame.\r\n * @param curves input geometry: curves or points.\r\n * @param options bundle of options.\r\n * @returns localToWorld frame `T` for coplanar curves, or undefined if they are not coplanar.\r\n * `T` satisfies:\r\n * * `T.origin` is in the plane.\r\n * * `T.matrix.columnZ()` is the plane unit normal (or its negative).\r\n * * `T.matrix.isRigid()` returns true.\r\n * * `T.inverse()` is worldToLocal; apply to input geometry to rotate it into the xy-plane.\r\n */\r\n public static isPlanar(curves: AnyCurve | MultiLineStringDataVariant, options?: PlanarColinearOptions): Transform | undefined {\r\n const localRange = Range3d.create();\r\n const localToWorld = options?.localToWorld ?? Transform.createIdentity();\r\n if (!this.computeLocalRange(curves, localRange, localToWorld))\r\n return undefined;\r\n const maxAltitude = options?.maxDeviation ?? Geometry.smallMetricDistance;\r\n return (localRange.zLength() <= Math.abs(maxAltitude)) ? localToWorld : undefined;\r\n }\r\n /**\r\n * Check whether or not the curves lie in a straight line, and if so, return a colinear ray.\r\n * * This test does not take curve traversal or point order into account.\r\n * @param curves input geometry: curves or points.\r\n * @param options bundle of options.\r\n * @returns ray colinear with input, or undefined if input is not colinear.\r\n */\r\n public static isColinear(curves: AnyCurve | MultiLineStringDataVariant, options?: PlanarColinearOptions): Ray3d | undefined {\r\n const localRange = Range3d.create();\r\n const localToWorld = options?.localToWorld ?? Transform.createIdentity();\r\n if (!this.computeLocalRange(curves, localRange, localToWorld))\r\n return undefined;\r\n const maxAltitude = Math.abs(options?.maxDeviation ?? Geometry.smallMetricDistance);\r\n if (localRange.zLength() > maxAltitude)\r\n return undefined; // non-planar\r\n\r\n const ray = options?.colinearRay ?? Ray3d.createZero();\r\n ray.origin.setFrom(localToWorld.origin);\r\n\r\n const xLength = localRange.xLength();\r\n const yLength = localRange.yLength();\r\n if (xLength <= maxAltitude && yLength <= maxAltitude) {\r\n ray.direction.setZero();\r\n return ray; // the input is essentially a point\r\n }\r\n if (yLength <= maxAltitude) {\r\n localToWorld.matrix.columnX(ray.direction);\r\n return ray; // the input lies along local x-axis\r\n }\r\n if (xLength <= maxAltitude) {\r\n localToWorld.matrix.columnY(ray.direction);\r\n return ray; // the input lies along local y-axis\r\n }\r\n if (!options?.xyColinear)\r\n return undefined; // non-colinear\r\n\r\n const angleTolerance = Math.abs(options?.radianTolerance ?? Geometry.smallAngleRadians);\r\n const verticalPlaneDeviation = Math.abs(localToWorld.matrix.columnDotXYZ(AxisIndex.Z, 0, 0, 1));\r\n if (verticalPlaneDeviation > angleTolerance) // cos(t + pi/2) = -sin(t) ~ -t for small t\r\n return undefined; // non-xy-colinear\r\n\r\n if (xLength > yLength)\r\n localToWorld.matrix.columnX(ray.direction);\r\n else\r\n localToWorld.matrix.columnY(ray.direction);\r\n ray.direction.z = 0.0;\r\n return ray; // xy-colinear (plane is vertical)\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"CurveOps.js","sourceRoot":"","sources":["../../../src/curve/CurveOps.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,0CAAkD;AAClD,6DAA0D;AAE1D,mEAAyD;AACzD,+CAA8C;AAC9C,+CAA4C;AAC5C,uDAAoD;AACpD,uDAAiE;AACjE,qDAAkD;AAElD,mDAAgD;AAChD,gFAA6E;AAC7E,kFAAsF;AAEtF,iCAA8B;AAE9B,iCAA8B;AAoB9B;;;GAGG;AACH,MAAa,QAAQ;IACnB,8GAA8G;IACvG,MAAM,CAAC,UAAU,CAAC,MAA6B;QACpD,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,IAAI,MAAM,YAAY,+BAAc,EAAE,CAAC;YACrC,KAAK,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;QAChC,CAAC;aAAM,IAAI,MAAM,YAAY,iCAAe,EAAE,CAAC;YAC7C,KAAK,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;QAC/B,CAAC;aAAM,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YACjC,KAAK,MAAM,KAAK,IAAI,MAAM;gBACxB,KAAK,IAAI,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACpC,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,mIAAmI;IAC5H,MAAM,CAAC,WAAW,CAAC,KAAc,EAAE,MAA6B,EAAE,SAAqB;QAC5F,IAAI,K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,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAChG,IAAI,sBAAsB,GAAG,cAAc,EAAE,2CAA2C;YACtF,OAAO,SAAS,CAAC,CAAC,kBAAkB;QAEtC,IAAI,OAAO,GAAG,OAAO;YACnB,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;;YAE3C,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAC7C,GAAG,CAAC,SAAS,CAAC,CAAC,GAAG,GAAG,CAAC;QACtB,OAAO,GAAG,CAAC,CAAC,kCAAkC;IAChD,CAAC;CACF;AA1ND,4BA0NC","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 Curve\r\n */\r\n\r\nimport { AxisIndex, Geometry } from \"../Geometry\";\r\nimport { FrameBuilder } from \"../geometry3d/FrameBuilder\";\r\nimport { MultiLineStringDataVariant } from \"../geometry3d/IndexedXYZCollection\";\r\nimport { Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Range3d } from \"../geometry3d/Range\";\r\nimport { Ray3d } from \"../geometry3d/Ray3d\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { BagOfCurves, CurveCollection } from \"./CurveCollection\";\r\nimport { CurvePrimitive } from \"./CurvePrimitive\";\r\nimport { AnyChain, AnyCurve } from \"./CurveTypes\";\r\nimport { GeometryQuery } from \"./GeometryQuery\";\r\nimport { MultiChainCollector } from \"./internalContexts/MultiChainCollector\";\r\nimport { CurveChainWireOffsetContext } from \"./internalContexts/PolygonOffsetContext\";\r\nimport { LineString3d } from \"./LineString3d\";\r\nimport { Loop } from \"./Loop\";\r\nimport { OffsetOptions } from \"./OffsetOptions\";\r\nimport { Path } from \"./Path\";\r\nimport { StrokeOptions } from \"./StrokeOptions\";\r\n\r\n/**\r\n * Options bundle for use in [[CurveOps.isPlanar]] and [[CurveOps.isColinear]].\r\n * @public\r\n */\r\nexport interface PlanarColinearOptions {\r\n /** Maximum allowable distance that geometry can deviate from planarity/colinearity. Default is [[Geometry.smallMetricDistance]]. */\r\n maxDeviation?: number;\r\n /** Whether colinearity test ignores z-coordinates. Default is `false`. */\r\n xyColinear?: boolean;\r\n /** Radian tolerance for xy-colinearity, measuring maximum angular deviation from a vertical plane. Default is [[Geometry.smallAngleRadians]]. */\r\n radianTolerance?: number;\r\n /** Pre-allocated object to populate with the computed plane-to-world transformation and return when planarity test succeeds. */\r\n localToWorld?: Transform;\r\n /** Pre-allocated object to populate with the computed line and return when colinear test succeeds. */\r\n colinearRay?: Ray3d;\r\n}\r\n\r\n/**\r\n * Static methods for miscellaneous curve operations.\r\n * @public\r\n */\r\nexport class CurveOps {\r\n /** Recursively sum curve lengths, allowing CurvePrimitive, CurveCollection, or array of such at any level. */\r\n public static sumLengths(curves: AnyCurve | AnyCurve[]): number {\r\n let mySum = 0;\r\n if (curves instanceof CurvePrimitive) {\r\n mySum += curves.curveLength();\r\n } else if (curves instanceof CurveCollection) {\r\n mySum += curves.sumLengths();\r\n } else if (Array.isArray(curves)) {\r\n for (const data1 of curves)\r\n mySum += this.sumLengths(data1);\r\n }\r\n return mySum;\r\n }\r\n /** Recursively extend the range by each curve's range, allowing CurvePrimitive, CurveCollection, or array of such at any level. */\r\n public static extendRange(range: Range3d, curves: AnyCurve | AnyCurve[], transform?: Transform): Range3d {\r\n if (Array.isArray(curves)) {\r\n for (const data1 of curves)\r\n this.extendRange(range, data1, transform);\r\n } else {\r\n curves.extendRange(range, transform);\r\n }\r\n return range;\r\n }\r\n /**\r\n * Construct a separate xy-offset for each input curve.\r\n * * For best offset results, the inputs should be parallel to the xy-plane.\r\n * @param curves input curve(s), z-coordinates ignored. Only curves of type [[AnyChain]] are handled.\r\n * @param offset offset distance (positive to left of curve, negative to right)\r\n * @param result array to collect offset curves\r\n * @returns summed length of offset curves\r\n */\r\n public static appendXYOffsets(curves: AnyCurve | AnyCurve[] | undefined, offset: number, result: AnyCurve[]): number {\r\n let summedLengths = 0;\r\n if (curves instanceof CurvePrimitive) {\r\n const resultA = CurveChainWireOffsetContext.constructCurveXYOffset(Path.create(curves), offset);\r\n if (resultA) {\r\n summedLengths += this.sumLengths(resultA);\r\n result.push(resultA);\r\n }\r\n } else if (curves instanceof Loop || curves instanceof Path) {\r\n const resultA = CurveChainWireOffsetContext.constructCurveXYOffset(curves, offset);\r\n if (resultA) {\r\n summedLengths += this.sumLengths(resultA);\r\n result.push(resultA);\r\n }\r\n } else if (curves instanceof BagOfCurves) {\r\n for (const q of curves.children)\r\n summedLengths += this.appendXYOffsets(q, offset, result);\r\n } else if (Array.isArray(curves)) {\r\n for (const q of curves)\r\n summedLengths += this.appendXYOffsets(q, offset, result);\r\n }\r\n return summedLengths;\r\n }\r\n /**\r\n * Restructure curve fragments as Paths and Loops, and construct xy-offsets of the chains.\r\n * * If the inputs do not form Loop(s), the classification of offsets is suspect.\r\n * * For best offset results, the inputs should be parallel to the xy-plane.\r\n * * Chain formation is dependent upon input fragment order, as a greedy algorithm is employed.\r\n * @param fragments fragments to be chained and offset\r\n * @param offsetDistance offset distance, applied to both sides of each fragment to produce inside and outside xy-offset curves.\r\n * @param gapTolerance distance to be treated as \"effectively zero\" when joining head-to-tail\r\n * @returns object with named chains, insideOffsets, outsideOffsets\r\n */\r\n public static collectInsideAndOutsideXYOffsets(fragments: AnyCurve[], offsetDistance: number, gapTolerance: number): { insideOffsets: AnyCurve[], outsideOffsets: AnyCurve[], chains?: AnyChain } {\r\n const collector = new MultiChainCollector(gapTolerance, gapTolerance);\r\n for (const s of fragments) {\r\n collector.captureCurve(s);\r\n }\r\n const chains = collector.grabResult(true);\r\n const myOffsetA: CurveCollection[] = [];\r\n const myOffsetB: CurveCollection[] = [];\r\n const offsetLengthA = CurveOps.appendXYOffsets(chains, offsetDistance, myOffsetA);\r\n const offsetLengthB = CurveOps.appendXYOffsets(chains, -offsetDistance, myOffsetB);\r\n if (offsetLengthA > offsetLengthB) {\r\n return { outsideOffsets: myOffsetA, insideOffsets: myOffsetB, chains };\r\n } else {\r\n return { insideOffsets: myOffsetA, outsideOffsets: myOffsetB, chains };\r\n }\r\n }\r\n /**\r\n * Construct curves that are offset from a Path or Loop as viewed in xy-plane (ignoring z).\r\n * * The construction will remove \"some\" local effects of features smaller than the offset distance, but will not detect self intersection among widely separated edges.\r\n * @param curves base curves.\r\n * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or options object.\r\n */\r\n public static constructCurveXYOffset(curves: Path | Loop, offsetDistanceOrOptions: number | OffsetOptions): CurveCollection | undefined {\r\n return CurveChainWireOffsetContext.constructCurveXYOffset(curves, offsetDistanceOrOptions);\r\n }\r\n /**\r\n * Create the offset of a single curve primitive as viewed in the xy-plane (ignoring z).\r\n * @param curve primitive to offset\r\n * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or options object\r\n */\r\n public static createSingleOffsetPrimitiveXY(curve: CurvePrimitive, offsetDistanceOrOptions: number | OffsetOptions): CurvePrimitive | CurvePrimitive[] | undefined {\r\n return CurveChainWireOffsetContext.createSingleOffsetPrimitiveXY(curve, offsetDistanceOrOptions);\r\n }\r\n /**\r\n * Restructure curve fragments as Paths and Loops.\r\n * * Chain formation is dependent upon input fragment order, as a greedy algorithm is employed.\r\n * @param fragments fragments to be chained\r\n * @param gapTolerance distance to be treated as \"effectively zero\" when assembling fragments head-to-tail\r\n * @param planeTolerance tolerance for considering a closed chain to be planar. If undefined, only create Path. If defined, create Loops for closed chains within tolerance of a plane.\r\n * @returns chains, possibly wrapped in a [[BagOfCurves]].\r\n */\r\n public static collectChains(fragments: AnyCurve[], gapTolerance: number = Geometry.smallMetricDistance, planeTolerance?: number): AnyChain | undefined {\r\n const collector = new MultiChainCollector(gapTolerance, planeTolerance);\r\n for (const s of fragments) {\r\n collector.captureCurve(s);\r\n }\r\n return collector.grabResult(true);\r\n }\r\n /**\r\n * Restructure curve fragments, to be stroked and passed into the callback.\r\n * * Chain formation is dependent upon input fragment order, as a greedy algorithm is employed.\r\n * @param fragments fragments to be chained and stroked\r\n * @param announceChain callback to process each stroked Path and Loop\r\n * @param strokeOptions options for stroking the chains\r\n * @param gapTolerance distance to be treated as \"effectively zero\" when assembling fragments head-to-tail. Also used for removing duplicate points in the stroked chains.\r\n * @param _planeTolerance unused, pass undefined\r\n */\r\n public static collectChainsAsLineString3d(fragments: AnyCurve[], announceChain: (chainPoints: LineString3d) => void, strokeOptions?: StrokeOptions, gapTolerance: number = Geometry.smallMetricDistance, _planeTolerance?: number) {\r\n const collector = new MultiChainCollector(gapTolerance); // no planarity tolerance needed\r\n for (const s of fragments) {\r\n collector.captureCurve(s);\r\n }\r\n collector.announceChainsAsLineString3d(announceChain, strokeOptions);\r\n }\r\n /**\r\n * Compute the range of the curves in the local coordinates of a constructed localToWorld frame.\r\n * @param curves input geometry: curves or points.\r\n * @param localRange pre-allocated object to populate with the computed local range.\r\n * @param localToWorld optional pre-allocated object to populate with the computed frame.\r\n * @returns whether the frame was successfully computed.\r\n */\r\n public static computeLocalRange(curves: AnyCurve | MultiLineStringDataVariant, localRange: Range3d, localToWorld?: Transform): boolean {\r\n const builderData: any[] = [curves];\r\n if (localToWorld)\r\n builderData.push(localToWorld);\r\n localToWorld = FrameBuilder.createRightHandedFrame(Vector3d.unitZ(), ...builderData);\r\n if (!localToWorld)\r\n return false;\r\n const worldToLocal = localToWorld.inverse();\r\n localRange.setNull();\r\n if (Array.isArray(curves) || !(curves instanceof GeometryQuery))\r\n Range3d.createFromVariantData(curves, worldToLocal, localRange);\r\n else\r\n this.extendRange(localRange, curves, worldToLocal);\r\n return true;\r\n }\r\n /**\r\n * Check whether or not the curves are planar, and if so, return a localToWorld frame.\r\n * @param curves input geometry: curves or points.\r\n * @param options bundle of options.\r\n * @returns localToWorld frame `T` for coplanar curves, or undefined if they are not coplanar.\r\n * `T` satisfies:\r\n * * `T.origin` is in the plane.\r\n * * `T.matrix.columnZ()` is the plane unit normal (or its negative).\r\n * * `T.matrix.isRigid()` returns true.\r\n * * `T.inverse()` is worldToLocal; apply to input geometry to rotate it into the xy-plane.\r\n */\r\n public static isPlanar(curves: AnyCurve | MultiLineStringDataVariant, options?: PlanarColinearOptions): Transform | undefined {\r\n const localRange = Range3d.create();\r\n const localToWorld = options?.localToWorld ?? Transform.createIdentity();\r\n if (!this.computeLocalRange(curves, localRange, localToWorld))\r\n return undefined;\r\n const maxAltitude = options?.maxDeviation ?? Geometry.smallMetricDistance;\r\n return (localRange.zLength() <= Math.abs(maxAltitude)) ? localToWorld : undefined;\r\n }\r\n /**\r\n * Check whether or not the curves lie in a straight line, and if so, return a colinear ray.\r\n * * This test does not take curve traversal or point order into account.\r\n * @param curves input geometry: curves or points.\r\n * @param options bundle of options.\r\n * @returns ray colinear with input, or undefined if input is not colinear.\r\n */\r\n public static isColinear(curves: AnyCurve | MultiLineStringDataVariant, options?: PlanarColinearOptions): Ray3d | undefined {\r\n const localRange = Range3d.create();\r\n const localToWorld = options?.localToWorld ?? Transform.createIdentity();\r\n if (!this.computeLocalRange(curves, localRange, localToWorld))\r\n return undefined;\r\n const maxAltitude = Math.abs(options?.maxDeviation ?? Geometry.smallMetricDistance);\r\n if (localRange.zLength() > maxAltitude)\r\n return undefined; // non-planar\r\n\r\n const ray = options?.colinearRay ?? Ray3d.createZero();\r\n ray.origin.setFrom(localToWorld.origin);\r\n\r\n const xLength = localRange.xLength();\r\n const yLength = localRange.yLength();\r\n if (xLength <= maxAltitude && yLength <= maxAltitude) {\r\n ray.direction.setZero();\r\n return ray; // the input is essentially a point\r\n }\r\n if (yLength <= maxAltitude) {\r\n localToWorld.matrix.columnX(ray.direction);\r\n return ray; // the input lies along local x-axis\r\n }\r\n if (xLength <= maxAltitude) {\r\n localToWorld.matrix.columnY(ray.direction);\r\n return ray; // the input lies along local y-axis\r\n }\r\n if (!options?.xyColinear)\r\n return undefined; // non-colinear\r\n\r\n const angleTolerance = Math.abs(options?.radianTolerance ?? Geometry.smallAngleRadians);\r\n const verticalPlaneDeviation = Math.abs(localToWorld.matrix.columnDotXYZ(AxisIndex.Z, 0, 0, 1));\r\n if (verticalPlaneDeviation > angleTolerance) // cos(t + pi/2) = -sin(t) ~ -t for small t\r\n return undefined; // non-xy-colinear\r\n\r\n if (xLength > yLength)\r\n localToWorld.matrix.columnX(ray.direction);\r\n else\r\n localToWorld.matrix.columnY(ray.direction);\r\n ray.direction.z = 0.0;\r\n return ray; // xy-colinear (plane is vertical)\r\n }\r\n}\r\n"]}
|
|
@@ -39,6 +39,20 @@ export type GeometryQueryCategory = "polyface" | "curvePrimitive" | "curveCollec
|
|
|
39
39
|
* @public
|
|
40
40
|
*/
|
|
41
41
|
export type AnyGeometryQuery = Polyface | CurvePrimitive | CurveCollection | SolidPrimitive | CoordinateXYZ | PointString3d | BSpline2dNd;
|
|
42
|
+
/**
|
|
43
|
+
* Options bundle for [[GeometryQuery.computeScaledTolerance]] and [[GeometryQuery.scaleToleranceForGeometry]].
|
|
44
|
+
* @public
|
|
45
|
+
*/
|
|
46
|
+
export interface ScaledToleranceOptions {
|
|
47
|
+
/** Optional transform to apply to geometry before computing its size. */
|
|
48
|
+
transform?: Transform;
|
|
49
|
+
/** Relative tolerance by which to scale the computed geometry size. Default is [[Geometry.smallMetricDistance]]. */
|
|
50
|
+
relativeTolerance?: number;
|
|
51
|
+
/** Smallest tolerance to return. Default is [[Geometry.smallMetricDistanceSquared]]. */
|
|
52
|
+
minimumTolerance?: number;
|
|
53
|
+
/** Whether to ignore z-coordinates when computing the geometry size. */
|
|
54
|
+
xyOnly?: boolean;
|
|
55
|
+
}
|
|
42
56
|
/**
|
|
43
57
|
* Queries to be supported by Curve, Surface, and Solid objects.
|
|
44
58
|
* * `GeometryQuery` is an abstract base class with (abstract) methods for querying curve, solid primitive, mesh,
|
|
@@ -95,5 +109,32 @@ export declare abstract class GeometryQuery {
|
|
|
95
109
|
* @param handler handler to be called by the particular geometry class
|
|
96
110
|
*/
|
|
97
111
|
abstract dispatchToGeometryHandler(handler: GeometryHandler): any;
|
|
112
|
+
/**
|
|
113
|
+
* Compute a distance tolerance appropriate for comparing the coordinates of `geom`.
|
|
114
|
+
* * The formula is `absTol = minTol + relTol * geomSize`, where `geomSize` is the largest absolute coordinate of
|
|
115
|
+
* the geometry range.
|
|
116
|
+
* * Scaling tolerances by geometry size helps account for the decreased floating point resolution between large
|
|
117
|
+
* coordinates. While using such scaled tolerances can enable more tolerance-sensitive constructions to succeed on
|
|
118
|
+
* far-flung geometries, on extremely small geometries at extremely large coordinate magnitudes, geometric
|
|
119
|
+
* constructions are generally more accurate when applied to the geometry temporarily translated to the origin.
|
|
120
|
+
* @param geom geometry to measure
|
|
121
|
+
* @param options bundle of options
|
|
122
|
+
* @returns the computed absolute tolerance
|
|
123
|
+
* @see [[scaleToleranceForGeometry]]
|
|
124
|
+
*/
|
|
125
|
+
static computeScaledTolerance(geom: GeometryQuery | GeometryQuery[], options?: ScaledToleranceOptions): number;
|
|
126
|
+
/**
|
|
127
|
+
* Scale the given distance tolerance as appropriate for comparing the coordinates of `geom`.
|
|
128
|
+
* * Scaling tolerances by geometry size helps account for the decreased floating point resolution between large
|
|
129
|
+
* coordinates. While using such scaled tolerances can enable more tolerance-sensitive constructions to succeed on
|
|
130
|
+
* far-flung geometries, on extremely small geometries at extremely large coordinate magnitudes, geometric
|
|
131
|
+
* constructions are generally more accurate when applied to the geometry temporarily translated to the origin.
|
|
132
|
+
* @param geom geometry to measure
|
|
133
|
+
* @param distanceTolerance positive input distance tolerance to examine
|
|
134
|
+
* @param options bundle of options (`minimumTolerance` and `relativeTolerance` are ignored)
|
|
135
|
+
* @return a distance tolerance >= `distanceTolerance`
|
|
136
|
+
* @see [[computeScaledTolerance]]
|
|
137
|
+
*/
|
|
138
|
+
static scaleToleranceForGeometry(geom: GeometryQuery | GeometryQuery[], distanceTolerance: number, options?: ScaledToleranceOptions): number;
|
|
98
139
|
}
|
|
99
140
|
//# sourceMappingURL=GeometryQuery.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GeometryQuery.d.ts","sourceRoot":"","sources":["../../../src/curve/GeometryQuery.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"GeometryQuery.d.ts","sourceRoot":"","sources":["../../../src/curve/GeometryQuery.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,qBAAqB,GAAG,UAAU,GAAG,gBAAgB,GAAG,iBAAiB,GAAG,OAAO,GAAG,OAAO,GAAG,iBAAiB,GAAG,OAAO,CAAC;AAExI;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,cAAc,GAAG,eAAe,GAAG,cAAc,GAAG,aAAa,GAAG,aAAa,GAAG,WAAW,CAAC;AAE1I;;;GAGG;AACH,MAAM,WAAW,sB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sB,CAAC,IAAI,EAAE,aAAa,GAAG,aAAa,EAAE,EAAE,OAAO,CAAC,EAAE,sBAAsB,GAAG,MAAM;IASrH;;;;;;;;;;;OAWG;WACW,yBAAyB,CAAC,IAAI,EAAE,aAAa,GAAG,aAAa,EAAE,EAAE,iBAAiB,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,sBAAsB,GAAG,MAAM;CAkBpJ"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GeometryQuery = void 0;
|
|
4
|
+
const Geometry_1 = require("../Geometry");
|
|
4
5
|
const Range_1 = require("../geometry3d/Range");
|
|
5
6
|
const Transform_1 = require("../geometry3d/Transform");
|
|
6
7
|
/**
|
|
@@ -70,6 +71,57 @@ class GeometryQuery {
|
|
|
70
71
|
return true;
|
|
71
72
|
return false;
|
|
72
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Compute a distance tolerance appropriate for comparing the coordinates of `geom`.
|
|
76
|
+
* * The formula is `absTol = minTol + relTol * geomSize`, where `geomSize` is the largest absolute coordinate of
|
|
77
|
+
* the geometry range.
|
|
78
|
+
* * Scaling tolerances by geometry size helps account for the decreased floating point resolution between large
|
|
79
|
+
* coordinates. While using such scaled tolerances can enable more tolerance-sensitive constructions to succeed on
|
|
80
|
+
* far-flung geometries, on extremely small geometries at extremely large coordinate magnitudes, geometric
|
|
81
|
+
* constructions are generally more accurate when applied to the geometry temporarily translated to the origin.
|
|
82
|
+
* @param geom geometry to measure
|
|
83
|
+
* @param options bundle of options
|
|
84
|
+
* @returns the computed absolute tolerance
|
|
85
|
+
* @see [[scaleToleranceForGeometry]]
|
|
86
|
+
*/
|
|
87
|
+
static computeScaledTolerance(geom, options) {
|
|
88
|
+
const relTol = Math.abs(options?.relativeTolerance ?? Geometry_1.Geometry.smallMetricDistance);
|
|
89
|
+
const minTol = Math.abs(options?.minimumTolerance ?? Geometry_1.Geometry.smallMetricDistanceSquared);
|
|
90
|
+
const geomRange = Range_1.Range3d.createNull();
|
|
91
|
+
(Array.isArray(geom) ? geom : [geom]).forEach((g) => g.extendRange(geomRange, options?.transform));
|
|
92
|
+
const geomSize = geomRange.isNull ? 0 : options?.xyOnly ? geomRange.maxAbsXY() : geomRange.maxAbs();
|
|
93
|
+
return minTol + relTol * geomSize;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Scale the given distance tolerance as appropriate for comparing the coordinates of `geom`.
|
|
97
|
+
* * Scaling tolerances by geometry size helps account for the decreased floating point resolution between large
|
|
98
|
+
* coordinates. While using such scaled tolerances can enable more tolerance-sensitive constructions to succeed on
|
|
99
|
+
* far-flung geometries, on extremely small geometries at extremely large coordinate magnitudes, geometric
|
|
100
|
+
* constructions are generally more accurate when applied to the geometry temporarily translated to the origin.
|
|
101
|
+
* @param geom geometry to measure
|
|
102
|
+
* @param distanceTolerance positive input distance tolerance to examine
|
|
103
|
+
* @param options bundle of options (`minimumTolerance` and `relativeTolerance` are ignored)
|
|
104
|
+
* @return a distance tolerance >= `distanceTolerance`
|
|
105
|
+
* @see [[computeScaledTolerance]]
|
|
106
|
+
*/
|
|
107
|
+
static scaleToleranceForGeometry(geom, distanceTolerance, options) {
|
|
108
|
+
if (distanceTolerance > 0) {
|
|
109
|
+
const geomRange = Range_1.Range3d.createNull();
|
|
110
|
+
(Array.isArray(geom) ? geom : [geom]).forEach((g) => g.extendRange(geomRange, options?.transform));
|
|
111
|
+
if (!geomRange.isNull) {
|
|
112
|
+
const geomSize = options?.xyOnly ? geomRange.maxAbsXY() : geomRange.maxAbs();
|
|
113
|
+
if (geomSize > 0) {
|
|
114
|
+
// HEURISTIC: truncate the fractional part of a coordinate's base-10 significand to maxDigits digits.
|
|
115
|
+
// Adding the tolerance to this number should change the significand; otherwise, it's too small.
|
|
116
|
+
const maxDigits = 10; // comfortably far from IEEE double's 15 guaranteed fractional digits
|
|
117
|
+
const requiredDigitsForTol = Math.floor(Math.log10(geomSize / distanceTolerance));
|
|
118
|
+
if (requiredDigitsForTol > maxDigits)
|
|
119
|
+
distanceTolerance *= Math.pow(10, requiredDigitsForTol - maxDigits);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return distanceTolerance;
|
|
124
|
+
}
|
|
73
125
|
}
|
|
74
126
|
exports.GeometryQuery = GeometryQuery;
|
|
75
127
|
//# sourceMappingURL=GeometryQuery.js.map
|