@itwin/core-geometry 5.0.0-dev.16 → 5.0.0-dev.20

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.
Files changed (65) hide show
  1. package/lib/cjs/curve/CurveCollection.d.ts +10 -0
  2. package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
  3. package/lib/cjs/curve/CurveCollection.js +22 -0
  4. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  5. package/lib/cjs/curve/CurveFactory.d.ts +35 -28
  6. package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
  7. package/lib/cjs/curve/CurveFactory.js +119 -61
  8. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  9. package/lib/cjs/geometry3d/FrameBuilder.js +4 -4
  10. package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
  11. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +2 -2
  12. package/lib/cjs/geometry3d/Point3dVector3d.js +2 -2
  13. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  14. package/lib/cjs/geometry3d/PolygonOps.d.ts +2 -2
  15. package/lib/cjs/geometry3d/PolygonOps.js +2 -2
  16. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  17. package/lib/cjs/geometry3d/PolylineOps.d.ts +1 -1
  18. package/lib/cjs/geometry3d/PolylineOps.d.ts.map +1 -1
  19. package/lib/cjs/geometry3d/PolylineOps.js +1 -1
  20. package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
  21. package/lib/cjs/geometry4d/MomentData.d.ts +72 -73
  22. package/lib/cjs/geometry4d/MomentData.d.ts.map +1 -1
  23. package/lib/cjs/geometry4d/MomentData.js +62 -64
  24. package/lib/cjs/geometry4d/MomentData.js.map +1 -1
  25. package/lib/cjs/solid/RuledSweep.d.ts +26 -23
  26. package/lib/cjs/solid/RuledSweep.d.ts.map +1 -1
  27. package/lib/cjs/solid/RuledSweep.js +30 -23
  28. package/lib/cjs/solid/RuledSweep.js.map +1 -1
  29. package/lib/cjs/solid/SolidPrimitive.d.ts +12 -11
  30. package/lib/cjs/solid/SolidPrimitive.d.ts.map +1 -1
  31. package/lib/cjs/solid/SolidPrimitive.js +8 -5
  32. package/lib/cjs/solid/SolidPrimitive.js.map +1 -1
  33. package/lib/esm/curve/CurveCollection.d.ts +10 -0
  34. package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
  35. package/lib/esm/curve/CurveCollection.js +22 -0
  36. package/lib/esm/curve/CurveCollection.js.map +1 -1
  37. package/lib/esm/curve/CurveFactory.d.ts +35 -28
  38. package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
  39. package/lib/esm/curve/CurveFactory.js +119 -61
  40. package/lib/esm/curve/CurveFactory.js.map +1 -1
  41. package/lib/esm/geometry3d/FrameBuilder.js +4 -4
  42. package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
  43. package/lib/esm/geometry3d/Point3dVector3d.d.ts +2 -2
  44. package/lib/esm/geometry3d/Point3dVector3d.js +2 -2
  45. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  46. package/lib/esm/geometry3d/PolygonOps.d.ts +2 -2
  47. package/lib/esm/geometry3d/PolygonOps.js +2 -2
  48. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  49. package/lib/esm/geometry3d/PolylineOps.d.ts +1 -1
  50. package/lib/esm/geometry3d/PolylineOps.d.ts.map +1 -1
  51. package/lib/esm/geometry3d/PolylineOps.js +1 -1
  52. package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
  53. package/lib/esm/geometry4d/MomentData.d.ts +72 -73
  54. package/lib/esm/geometry4d/MomentData.d.ts.map +1 -1
  55. package/lib/esm/geometry4d/MomentData.js +62 -64
  56. package/lib/esm/geometry4d/MomentData.js.map +1 -1
  57. package/lib/esm/solid/RuledSweep.d.ts +26 -23
  58. package/lib/esm/solid/RuledSweep.d.ts.map +1 -1
  59. package/lib/esm/solid/RuledSweep.js +30 -23
  60. package/lib/esm/solid/RuledSweep.js.map +1 -1
  61. package/lib/esm/solid/SolidPrimitive.d.ts +12 -11
  62. package/lib/esm/solid/SolidPrimitive.d.ts.map +1 -1
  63. package/lib/esm/solid/SolidPrimitive.js +8 -5
  64. package/lib/esm/solid/SolidPrimitive.js.map +1 -1
  65. package/package.json +3 -3
@@ -181,6 +181,16 @@ export declare abstract class CurveChain extends CurveCollection {
181
181
  startPoint(result?: Point3d): Point3d | undefined;
182
182
  /** Return the end point of the curve chain (end point of the last child). */
183
183
  endPoint(result?: Point3d): Point3d | undefined;
184
+ /**
185
+ * Return the start point and derivative of the first child of the curve chain.
186
+ * * For queries interior to the chain, use [[CurveChainWithDistanceIndex.fractionToPointAndDerivative]].
187
+ */
188
+ startPointAndDerivative(result?: Ray3d): Ray3d | undefined;
189
+ /**
190
+ * Return the end point and derivative of the last child of the curve chain.
191
+ * * For queries interior to the chain, use [[CurveChainWithDistanceIndex.fractionToPointAndDerivative]].
192
+ */
193
+ endPointAndDerivative(result?: Ray3d): Ray3d | undefined;
184
194
  /**
185
195
  * Return the curve primitive at the given `index`, optionally using `modulo` to map `index` to the cyclic indexing.
186
196
  * * In particular, `-1` is the final curve.
@@ -1 +1 @@
1
- {"version":3,"file":"CurveCollection.d.ts","sourceRoot":"","sources":["../../../src/curve/CurveCollection.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,mBAAmB,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,OAAO,EAAE,MAAM,GAAE,2BAAmC,EAAE,MAAM,CAAC,EAAE,mBAAmB,GAC7F,mBAAmB,GAAG,SAAS;IAWlC,oCAAoC;IAC7B,cAAc,IAAI,WAAW;IAGpC,mBAAmB;IACZ,WAAW,CAAC,KAAK,EAAE,QAAQ,GAAG,SAAS,GAAG,OAAO;IAKxD,2BAA2B;IACpB,QAAQ,CAAC,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS;IAKhD,8EAA8E;IACvE,yBAAyB,CAAC,OAAO,EAAE,eAAe,GAAG,GAAG;CAGhE"}
@@ -247,6 +247,28 @@ class CurveChain extends CurveCollection {
247
247
  else
248
248
  return undefined;
249
249
  }
250
+ /**
251
+ * Return the start point and derivative of the first child of the curve chain.
252
+ * * For queries interior to the chain, use [[CurveChainWithDistanceIndex.fractionToPointAndDerivative]].
253
+ */
254
+ startPointAndDerivative(result) {
255
+ const firstChild = this.getChild(0);
256
+ if (firstChild)
257
+ return firstChild.fractionToPointAndDerivative(0.0, result);
258
+ else
259
+ return undefined;
260
+ }
261
+ /**
262
+ * Return the end point and derivative of the last child of the curve chain.
263
+ * * For queries interior to the chain, use [[CurveChainWithDistanceIndex.fractionToPointAndDerivative]].
264
+ */
265
+ endPointAndDerivative(result) {
266
+ const lastChild = this.getChild(this._curves.length - 1);
267
+ if (lastChild)
268
+ return lastChild.fractionToPointAndDerivative(1.0, result);
269
+ else
270
+ return undefined;
271
+ }
250
272
  /**
251
273
  * Return the curve primitive at the given `index`, optionally using `modulo` to map `index` to the cyclic indexing.
252
274
  * * In particular, `-1` is the final curve.
@@ -1 +1 @@
1
- {"version":3,"file":"CurveCollection.js","sourceRoot":"","sources":["../../../src/curve/CurveCollection.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AACH,0CAAuC;AAQvC,+DAA4D;AAC5D,qDAAkD;AAGlD,mDAAgD;AAChD,8EAA2E;AAC3E,kGAA+F;AAC/F,oGAAiG;AACjG,0EA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,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;AA/FD,kCA+FC","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\nimport { Geometry } from \"../Geometry\";\r\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\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 { VariantCurveExtendParameter } from \"./CurveExtendMode\";\r\nimport { CurveLocationDetail } from \"./CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"./CurvePrimitive\";\r\nimport { RecursiveCurveProcessor } from \"./CurveProcessor\";\r\nimport { AnyCurve, type AnyRegion } from \"./CurveTypes\";\r\nimport { GeometryQuery } from \"./GeometryQuery\";\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 /**\r\n * Return the closest point on the contained curves.\r\n * @param spacePoint point in space.\r\n * @param _extend unused here (pass false), but applicable to overrides in [[Path]] and [[BagOfCurves]].\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 let detailA: CurveLocationDetail | undefined;\r\n const detailB = new CurveLocationDetail();\r\n if (this.children !== undefined) {\r\n for (const child of this.children) {\r\n if (child.closestPoint(spacePoint, false, detailB))\r\n detailA = result = CurveLocationDetail.chooseSmallerA(detailA, detailB)!.clone(result);\r\n }\r\n }\r\n return detailA;\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 /**\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 * @see isPath\r\n */\r\n public get isOpenPath(): boolean {\r\n return this.dgnBoundaryType() === 1;\r\n }\r\n /** Type guard for Path */\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 of a `Path`.\r\n * @see isLoop\r\n */\r\n public get isClosedPath(): boolean {\r\n return this.dgnBoundaryType() === 2;\r\n }\r\n /** Type guard for Loop */\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}\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 * 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 */\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 /**\r\n * Return the closest point on the contained curves.\r\n * @param spacePoint point in space.\r\n * @param extend applicable only to children of type [[CurvePrimitive]], [[Path]], or [[BagOfCurves]]\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 override closestPoint(\r\n spacePoint: Point3d, extend: VariantCurveExtendParameter = false, result?: CurveLocationDetail,\r\n ): CurveLocationDetail | undefined {\r\n let detailA: CurveLocationDetail | undefined;\r\n const detailB = new CurveLocationDetail();\r\n if (this.children !== undefined) {\r\n for (const child of this.children) {\r\n if (child.closestPoint(spacePoint, extend, detailB))\r\n detailA = result = CurveLocationDetail.chooseSmallerA(detailA, detailB)!.clone(result);\r\n }\r\n }\r\n return detailA;\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;AACH,0CAAuC;AAQvC,+DAA4D;AAC5D,qDAAkD;AAGlD,mDAAgD;AAChD,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;IAA3D;;QACE,wCAAwC;QACxB,qBAAgB,GAAG,iBAAiB,CAAC;QAGrD,uDAAuD;QAChD,YAAO,GAAY,KAAK,CAAC;IAqMlC,CAAC;IAlMC,6D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;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;AA/FD,kCA+FC","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\nimport { Geometry } from \"../Geometry\";\r\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\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 { VariantCurveExtendParameter } from \"./CurveExtendMode\";\r\nimport { CurveLocationDetail } from \"./CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"./CurvePrimitive\";\r\nimport { RecursiveCurveProcessor } from \"./CurveProcessor\";\r\nimport { AnyCurve, type AnyRegion } from \"./CurveTypes\";\r\nimport { GeometryQuery } from \"./GeometryQuery\";\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 /**\r\n * Return the closest point on the contained curves.\r\n * @param spacePoint point in space.\r\n * @param _extend unused here (pass false), but applicable to overrides in [[Path]] and [[BagOfCurves]].\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 let detailA: CurveLocationDetail | undefined;\r\n const detailB = new CurveLocationDetail();\r\n if (this.children !== undefined) {\r\n for (const child of this.children) {\r\n if (child.closestPoint(spacePoint, false, detailB))\r\n detailA = result = CurveLocationDetail.chooseSmallerA(detailA, detailB)!.clone(result);\r\n }\r\n }\r\n return detailA;\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 /**\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 * @see isPath\r\n */\r\n public get isOpenPath(): boolean {\r\n return this.dgnBoundaryType() === 1;\r\n }\r\n /** Type guard for Path */\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 of a `Path`.\r\n * @see isLoop\r\n */\r\n public get isClosedPath(): boolean {\r\n return this.dgnBoundaryType() === 2;\r\n }\r\n /** Type guard for Loop */\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}\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 * 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 */\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 /**\r\n * Return the closest point on the contained curves.\r\n * @param spacePoint point in space.\r\n * @param extend applicable only to children of type [[CurvePrimitive]], [[Path]], or [[BagOfCurves]]\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 override closestPoint(\r\n spacePoint: Point3d, extend: VariantCurveExtendParameter = false, result?: CurveLocationDetail,\r\n ): CurveLocationDetail | undefined {\r\n let detailA: CurveLocationDetail | undefined;\r\n const detailB = new CurveLocationDetail();\r\n if (this.children !== undefined) {\r\n for (const child of this.children) {\r\n if (child.closestPoint(spacePoint, extend, detailB))\r\n detailA = result = CurveLocationDetail.chooseSmallerA(detailA, detailB)!.clone(result);\r\n }\r\n }\r\n return detailA;\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"]}
@@ -61,21 +61,13 @@ export interface MiteredSweepOptions {
61
61
  wrapIfPhysicallyClosed?: boolean;
62
62
  /** Whether to output sections only, or sections plus optional geometry constructed from them. Default value is `MiteredSweepOutputSelect.Sections`. */
63
63
  outputSelect?: MiteredSweepOutputSelect;
64
- /** How to stroke the ruled sweep if outputting a mesh. If undefined, default stroke options are used. */
64
+ /** How to stroke smooth input curves and the ruled sweep (if outputting a mesh). If undefined, default stroke options are used. */
65
65
  strokeOptions?: StrokeOptions;
66
66
  /** Whether to cap the ruled sweep if outputting a ruled sweep or mesh. Default value is `false`. */
67
67
  capped?: boolean;
68
- /**
69
- * If the centerline is not physically closed, the first section's normal is aligned to this vector (typically points
70
- * toward the swept geometry). If the centerline is physically closed, the first section's normal is aligned to this
71
- * vector if and only if endTangent is provided and is equal to startTangent.
72
- */
68
+ /** The first section's normal is aligned to this vector, typically the start tangent of the smooth curve stroked for the centerline. */
73
69
  startTangent?: Vector3d;
74
- /**
75
- * If the centerline is not physically closed, the last section's normal is aligned to this vector (typically points
76
- * away from the swept geometry). If the centerline is physically closed, the last section's normal is aligned to this
77
- * vector if and only if startTangent is provided and is equal to endTangent.
78
- */
70
+ /** The last section's normal is aligned to this vector, typically the end tangent of the smooth curve stroked for the centerline. */
79
71
  endTangent?: Vector3d;
80
72
  }
81
73
  /**
@@ -152,27 +144,42 @@ export declare class CurveFactory {
152
144
  * @param sectionData circle radius, ellipse semi-axis lengths, or full Arc3d (if not full, function makes it full).
153
145
  */
154
146
  static createMiteredPipeSections(centerline: IndexedXYZCollection, sectionData: number | XAndY | Arc3d): Arc3d[];
147
+ /** For a smooth curve, stroke and return unnormalized start/end tangents. */
148
+ private static strokeSmoothCurve;
155
149
  /**
156
- * Sweep the initialSection along each segment of the centerLine until it hits the bisector plane at the next vertex.
157
- * * The caller should place the initialSection on a plane perpendicular to the first edge.
158
- * * This plane is commonly (but not necessarily) through the start point itself.
159
- * * If the initialSection is not "on a perpendicular plane", the output geometry will still be flattened onto the
160
- * various planes.
161
- * * In the "open path" case (i.e when `wrapIfPhysicallyClosed` is false or the path does not have matched first and
162
- * last points), the first/last output plane will be at the start/end of the first/last edge and on a perpendicular
163
- * plane.
164
- * * In the "closed path" case, if start/edn tangents are not provided in the `options`, then the output plane for the
165
- * first and last point is the bisector of the start and end planes from the "open path" case, and the first/last
166
- * section geometry may be different from `initialSection`.
167
- * * The centerline path does NOT have to be planar, however twisting effects effects will appear in the various bisector
168
- * planes.
169
- * @param centerline sweep path, e.g., as stroked from a smooth centerline curve.
150
+ * Align two bisector plane normals to given smooth rail tangents or optional overrides.
151
+ * * Optionally average the normals for physically closed rail.
152
+ */
153
+ private static alignFirstAndLastBisectorPlanes;
154
+ /** Reverse a closed curve or region if necessary so that its orientation is CCW with respect to the plane normal. */
155
+ private static alignClosedCurveToPlane;
156
+ /**
157
+ * Projection to target plane, constructing sweep direction from two given planes.
158
+ * * If successful, push the target plane and swept section to the output arrays and return the swept section.
159
+ * * If unsuccessful, leave the output arrays alone and return the input section.
160
+ */
161
+ private static doSweepToPlane;
162
+ /**
163
+ * Sweep the `initialSection` along each segment of the (stroked) `centerline` until it hits the bisector plane at
164
+ * the next vertex.
165
+ * * For best results, the caller should place `initialSection` in a plane perpendicular to the `centerline`
166
+ * start tangent.
167
+ * * This plane is commonly (but not necessarily) through the centerline start point itself.
168
+ * * To compute the sections, `initialSection` is projected in the direction of the centerline start tangent onto
169
+ * the first bisector plane at the centerline start. The result of this projection will be likewise projected onto
170
+ * the second plane, and so on in sequence.
171
+ * * By default, the first/last bisector plane normals are set to the centerline start/end tangents. The caller can
172
+ * override these with tangents supplied in `options`. If the centerline is physically closed and
173
+ * `options.wrapIfPhysicallyClosed` is true, the first and last plane normals are averaged and equated.
174
+ * * The centerline path does NOT have to be planar, however non-planarity will result in twisting of the sections
175
+ * in the bisector planes.
176
+ * @param centerline sweep path. Will be stroked if smooth.
170
177
  * @param initialSection profile curve to be swept. As noted above, this should be on a plane perpendicular to the
171
- * first segment of the centerline.
178
+ * centerline start tangent.
172
179
  * @param options options for computation and output.
173
- * @return array of sections, starting with `initialSection` projected along the first edge to the first plane.
180
+ * @return array of sections, formed from projecting `initialSection` successively onto the bisector planes.
174
181
  */
175
- static createMiteredSweepSections(centerline: IndexedXYZCollection | Point3d[], initialSection: AnyCurve, options: MiteredSweepOptions): SectionSequenceWithPlanes | undefined;
182
+ static createMiteredSweepSections(centerline: IndexedXYZCollection | Point3d[] | CurvePrimitive | CurveChain, initialSection: AnyCurve, options: MiteredSweepOptions): SectionSequenceWithPlanes | undefined;
176
183
  /**
177
184
  * Create a circular arc from start point, tangent at start, radius, optional plane normal, arc sweep.
178
185
  * * The vector from start point to center is in the direction of upVector crossed with tangentA.
@@ -1 +1 @@
1
- {"version":3,"file":"CurveFactory.d.ts","sourceRoot":"","sources":["../../../src/curve/CurveFactory.ts"],"names":[],"mappings":"AAKA;;GAEG;AAIH,OAAO,EAAkC,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrF,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE1E,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAG1F,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAG5C,OAAO,EAAE,KA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;WACW,0BAA0B,CACtC,UAAU,EAAE,wBAAwB,EACpC,UAAU,EAAE,OAAO,EACnB,aAAa,EAAE,OAAO,EACtB,WAAW,EAAE,OAAO,GACnB,aAAa,EAAE,GAAG,SAAS;IAkC9B;;;;;;;;;OASG;WACW,0CAA0C,CACtD,UAAU,EAAE,wBAAwB,EACpC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,OAAO,EACf,YAAY,EAAE,MAAM,GACnB,aAAa,EAAE,GAAG,SAAS;IA4C9B;;;;;;;;;OASG;WACW,6BAA6B,CACzC,UAAU,EAAE,wBAAwB,EACpC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,GAChB,aAAa,EAAE,GAAG,SAAS;IAkD9B,iDAAiD;WACnC,yBAAyB,CACrC,MAAM,EAAE,sBAAsB,EAAE,MAAM,EAAE,sBAAsB,GAAG,KAAK,GAAG,SAAS;CAsBrF"}
@@ -8,7 +8,6 @@ exports.CurveFactory = exports.MiteredSweepOutputSelect = void 0;
8
8
  /** @packageDocumentation
9
9
  * @module Curve
10
10
  */
11
- // import { Geometry, Angle, AngleSweep } from "../Geometry";
12
11
  const Geometry_1 = require("../Geometry");
13
12
  const Angle_1 = require("../geometry3d/Angle");
14
13
  const AngleSweep_1 = require("../geometry3d/AngleSweep");
@@ -33,6 +32,7 @@ const LineSegment3d_1 = require("./LineSegment3d");
33
32
  const LineString3d_1 = require("./LineString3d");
34
33
  const Loop_1 = require("./Loop");
35
34
  const Path_1 = require("./Path");
35
+ const RegionOps_1 = require("./RegionOps");
36
36
  const IntegratedSpiral3d_1 = require("./spiral/IntegratedSpiral3d");
37
37
  /**
38
38
  * Enumeration of geometric output for [CurveFactory.createMiteredSweepSections].
@@ -47,6 +47,7 @@ var MiteredSweepOutputSelect;
47
47
  /** Output planes and sections, as well as the assembled ruled sweep and its stroked mesh. */
48
48
  MiteredSweepOutputSelect[MiteredSweepOutputSelect["AlsoMesh"] = 2] = "AlsoMesh";
49
49
  })(MiteredSweepOutputSelect || (exports.MiteredSweepOutputSelect = MiteredSweepOutputSelect = {}));
50
+ ;
50
51
  /**
51
52
  * The `CurveFactory` class contains methods for specialized curve constructions.
52
53
  * @public
@@ -352,75 +353,132 @@ class CurveFactory {
352
353
  }
353
354
  return arcs;
354
355
  }
356
+ /** For a smooth curve, stroke and return unnormalized start/end tangents. */
357
+ static strokeSmoothCurve(curve, options) {
358
+ let startTangent, endTangent;
359
+ if (curve instanceof CurvePrimitive_1.CurvePrimitive) {
360
+ startTangent = curve.fractionToPointAndDerivative(0.0).direction;
361
+ endTangent = curve.fractionToPointAndDerivative(1.0).direction;
362
+ const strokes = LineString3d_1.LineString3d.create();
363
+ curve.emitStrokes(strokes, options);
364
+ curve = strokes.packedPoints;
365
+ }
366
+ else if (curve instanceof CurveCollection_1.CurveChain) {
367
+ startTangent = curve.startPointAndDerivative()?.direction;
368
+ endTangent = curve.endPointAndDerivative()?.direction;
369
+ const strokes = curve.getPackedStrokes(options);
370
+ if (!strokes)
371
+ return undefined;
372
+ curve = strokes;
373
+ }
374
+ else if (Array.isArray(curve))
375
+ curve = new Point3dArrayCarrier_1.Point3dArrayCarrier(curve);
376
+ return { strokes: curve, startTangent, endTangent };
377
+ }
355
378
  /**
356
- * Sweep the initialSection along each segment of the centerLine until it hits the bisector plane at the next vertex.
357
- * * The caller should place the initialSection on a plane perpendicular to the first edge.
358
- * * This plane is commonly (but not necessarily) through the start point itself.
359
- * * If the initialSection is not "on a perpendicular plane", the output geometry will still be flattened onto the
360
- * various planes.
361
- * * In the "open path" case (i.e when `wrapIfPhysicallyClosed` is false or the path does not have matched first and
362
- * last points), the first/last output plane will be at the start/end of the first/last edge and on a perpendicular
363
- * plane.
364
- * * In the "closed path" case, if start/edn tangents are not provided in the `options`, then the output plane for the
365
- * first and last point is the bisector of the start and end planes from the "open path" case, and the first/last
366
- * section geometry may be different from `initialSection`.
367
- * * The centerline path does NOT have to be planar, however twisting effects effects will appear in the various bisector
368
- * planes.
369
- * @param centerline sweep path, e.g., as stroked from a smooth centerline curve.
379
+ * Align two bisector plane normals to given smooth rail tangents or optional overrides.
380
+ * * Optionally average the normals for physically closed rail.
381
+ */
382
+ static alignFirstAndLastBisectorPlanes(firstPlane, lastPlane, smoothRailData, options) {
383
+ const normal0 = options?.startTangent ?? (smoothRailData?.startTangent ?? firstPlane.getNormalRef());
384
+ const normal1 = options?.endTangent ?? (smoothRailData?.endTangent ?? lastPlane.getNormalRef());
385
+ if (options?.wrapIfPhysicallyClosed && firstPlane.getOriginRef().isAlmostEqual(lastPlane.getOriginRef())) {
386
+ const avgNormal = normal0.plus(normal1);
387
+ if (avgNormal.tryNormalizeInPlace()) { // ignore cusp at seam
388
+ firstPlane.getNormalRef().setFrom(avgNormal);
389
+ lastPlane.getNormalRef().setFrom(avgNormal);
390
+ return;
391
+ }
392
+ }
393
+ if (normal0.tryNormalizeInPlace())
394
+ firstPlane.getNormalRef().setFrom(normal0);
395
+ if (normal1.tryNormalizeInPlace())
396
+ lastPlane.getNormalRef().setFrom(normal1);
397
+ }
398
+ /** Reverse a closed curve or region if necessary so that its orientation is CCW with respect to the plane normal. */
399
+ static alignClosedCurveToPlane(curve, planeNormal) {
400
+ let closedCurve;
401
+ if (curve instanceof CurvePrimitive_1.CurvePrimitive) {
402
+ if (curve.startPoint().isAlmostEqual(curve.endPoint()))
403
+ closedCurve = Loop_1.Loop.create(curve);
404
+ }
405
+ else if (curve.isAnyRegion())
406
+ closedCurve = curve;
407
+ if (closedCurve) {
408
+ // The alignment condition is equivalent to positive projected curve area computed wrt to the plane normal.
409
+ const toLocal = Matrix3d_1.Matrix3d.createRigidHeadsUp(planeNormal).transpose();
410
+ const projection = closedCurve.cloneTransformed(Transform_1.Transform.createOriginAndMatrix(undefined, toLocal));
411
+ if (projection) { // now we can ignore z-coords
412
+ const areaXY = RegionOps_1.RegionOps.computeXYArea(projection);
413
+ if (areaXY && areaXY < 0)
414
+ curve.reverseInPlace();
415
+ }
416
+ }
417
+ }
418
+ /**
419
+ * Projection to target plane, constructing sweep direction from two given planes.
420
+ * * If successful, push the target plane and swept section to the output arrays and return the swept section.
421
+ * * If unsuccessful, leave the output arrays alone and return the input section.
422
+ */
423
+ static doSweepToPlane(output, edgePlane0, edgePlane1, targetPlane, section) {
424
+ const sweepVector = Point3dVector3d_1.Vector3d.createStartEnd(edgePlane0.getOriginRef(), edgePlane1.getOriginRef());
425
+ const transform = Transform_1.Transform.createFlattenAlongVectorToPlane(sweepVector, targetPlane.getOriginRef(), targetPlane.getNormalRef());
426
+ if (transform === undefined)
427
+ return section;
428
+ const transformedSection = section.cloneTransformed(transform);
429
+ if (transformedSection === undefined)
430
+ return section;
431
+ output.planes.push(targetPlane);
432
+ output.sections.push(transformedSection);
433
+ return transformedSection;
434
+ }
435
+ /**
436
+ * Sweep the `initialSection` along each segment of the (stroked) `centerline` until it hits the bisector plane at
437
+ * the next vertex.
438
+ * * For best results, the caller should place `initialSection` in a plane perpendicular to the `centerline`
439
+ * start tangent.
440
+ * * This plane is commonly (but not necessarily) through the centerline start point itself.
441
+ * * To compute the sections, `initialSection` is projected in the direction of the centerline start tangent onto
442
+ * the first bisector plane at the centerline start. The result of this projection will be likewise projected onto
443
+ * the second plane, and so on in sequence.
444
+ * * By default, the first/last bisector plane normals are set to the centerline start/end tangents. The caller can
445
+ * override these with tangents supplied in `options`. If the centerline is physically closed and
446
+ * `options.wrapIfPhysicallyClosed` is true, the first and last plane normals are averaged and equated.
447
+ * * The centerline path does NOT have to be planar, however non-planarity will result in twisting of the sections
448
+ * in the bisector planes.
449
+ * @param centerline sweep path. Will be stroked if smooth.
370
450
  * @param initialSection profile curve to be swept. As noted above, this should be on a plane perpendicular to the
371
- * first segment of the centerline.
451
+ * centerline start tangent.
372
452
  * @param options options for computation and output.
373
- * @return array of sections, starting with `initialSection` projected along the first edge to the first plane.
453
+ * @return array of sections, formed from projecting `initialSection` successively onto the bisector planes.
374
454
  */
375
455
  static createMiteredSweepSections(centerline, initialSection, options) {
456
+ const rail = this.strokeSmoothCurve(centerline, options.strokeOptions);
457
+ if (!rail)
458
+ return undefined;
459
+ const planes = PolylineOps_1.PolylineOps.createBisectorPlanesForDistinctPoints(rail.strokes);
460
+ if (!planes || planes.length < 2)
461
+ return undefined;
462
+ this.alignFirstAndLastBisectorPlanes(planes[0], planes[planes.length - 1], rail, options);
463
+ // RuledSweep facet construction assumes the contours are oriented CCW with respect to the sweep direction so that
464
+ // facet normals point outward. We only have to align the first contour; the rest will inherit its orientation.
465
+ this.alignClosedCurveToPlane(initialSection, planes[0].getNormalRef());
376
466
  const sectionData = { sections: [], planes: [] };
377
- const planes = PolylineOps_1.PolylineOps.createBisectorPlanesForDistinctPoints(centerline, options.wrapIfPhysicallyClosed);
378
- // apply start/end tangent options
379
- if (planes !== undefined && planes.length > 1) {
380
- const firstPlane = planes[0];
381
- const lastPlane = planes[planes.length - 1];
382
- const startTang = options.startTangent;
383
- const endTang = options.endTangent;
384
- if (!firstPlane.getOriginRef().isAlmostEqual(lastPlane.getOriginRef()) ||
385
- (startTang && endTang && startTang.isAlmostEqual(endTang, 0.0))) {
386
- if (startTang?.tryNormalizeInPlace())
387
- firstPlane.getNormalRef().setFrom(startTang);
388
- if (endTang?.tryNormalizeInPlace())
389
- lastPlane.getNormalRef().setFrom(endTang);
390
- }
391
- // Projection to target plane, constructing sweep direction from two given planes.
392
- // If successful, push the target plane and swept section to the output arrays and return the swept section.
393
- // If unsuccessful, leave the output arrays alone and return the input section.
394
- const doSweepToPlane = function (edgePlane0, edgePlane1, targetPlane, section) {
395
- const sweepVector = Point3dVector3d_1.Vector3d.createStartEnd(edgePlane0.getOriginRef(), edgePlane1.getOriginRef());
396
- const transform = Transform_1.Transform.createFlattenAlongVectorToPlane(sweepVector, targetPlane.getOriginRef(), targetPlane.getNormalRef());
397
- if (transform === undefined)
398
- return section;
399
- const transformedSection = section.cloneTransformed(transform);
400
- if (transformedSection === undefined)
401
- return section;
402
- sectionData.planes.push(targetPlane);
403
- sectionData.sections.push(transformedSection);
404
- return transformedSection;
405
- };
406
- let currentSection = doSweepToPlane(planes[0], planes[1], planes[0], initialSection);
407
- for (let i = 1; i < planes.length; i++) {
408
- currentSection = doSweepToPlane(planes[i - 1], planes[i], planes[i], currentSection);
409
- }
410
- if (options.outputSelect) {
411
- const ruledSweep = RuledSweep_1.RuledSweep.create(sectionData.sections, options.capped ?? false);
412
- if (ruledSweep) {
413
- sectionData.ruledSweep = ruledSweep;
414
- if (MiteredSweepOutputSelect.AlsoMesh === options.outputSelect) {
415
- const builder = PolyfaceBuilder_1.PolyfaceBuilder.create(options.strokeOptions);
416
- builder.addRuledSweep(ruledSweep);
417
- sectionData.mesh = builder.claimPolyface();
418
- }
467
+ let currentSection = this.doSweepToPlane(sectionData, planes[0], planes[1], planes[0], initialSection);
468
+ for (let i = 1; i < planes.length; i++)
469
+ currentSection = this.doSweepToPlane(sectionData, planes[i - 1], planes[i], planes[i], currentSection);
470
+ if (options.outputSelect) {
471
+ const ruledSweep = RuledSweep_1.RuledSweep.create(sectionData.sections, options.capped ?? false);
472
+ if (ruledSweep) {
473
+ sectionData.ruledSweep = ruledSweep;
474
+ if (MiteredSweepOutputSelect.AlsoMesh === options.outputSelect) {
475
+ const builder = PolyfaceBuilder_1.PolyfaceBuilder.create(options.strokeOptions);
476
+ builder.addRuledSweep(ruledSweep);
477
+ sectionData.mesh = builder.claimPolyface();
419
478
  }
420
479
  }
421
- return sectionData;
422
480
  }
423
- return undefined;
481
+ return sectionData;
424
482
  }
425
483
  /**
426
484
  * Create a circular arc from start point, tangent at start, radius, optional plane normal, arc sweep.