@itwin/core-geometry 3.5.0-dev.35 → 3.5.0-dev.41

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 (173) hide show
  1. package/lib/cjs/Geometry.d.ts +13 -0
  2. package/lib/cjs/Geometry.d.ts.map +1 -1
  3. package/lib/cjs/Geometry.js.map +1 -1
  4. package/lib/cjs/bspline/BSplineCurve.d.ts +1 -1
  5. package/lib/cjs/bspline/BSplineCurve.js +1 -1
  6. package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
  7. package/lib/cjs/bspline/KnotVector.d.ts.map +1 -1
  8. package/lib/cjs/bspline/KnotVector.js +3 -0
  9. package/lib/cjs/bspline/KnotVector.js.map +1 -1
  10. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +7 -5
  11. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  12. package/lib/cjs/curve/CurveChainWithDistanceIndex.js +37 -29
  13. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  14. package/lib/cjs/curve/CurveCollection.d.ts +4 -2
  15. package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
  16. package/lib/cjs/curve/CurveCollection.js +14 -2
  17. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  18. package/lib/cjs/curve/CurvePrimitive.d.ts +13 -17
  19. package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
  20. package/lib/cjs/curve/CurvePrimitive.js +51 -340
  21. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  22. package/lib/cjs/curve/LineString3d.d.ts +11 -1
  23. package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
  24. package/lib/cjs/curve/LineString3d.js +30 -23
  25. package/lib/cjs/curve/LineString3d.js.map +1 -1
  26. package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.d.ts +55 -0
  27. package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.d.ts.map +1 -0
  28. package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js +143 -0
  29. package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -0
  30. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.d.ts +43 -0
  31. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.d.ts.map +1 -0
  32. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js +146 -0
  33. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -0
  34. package/lib/cjs/curve/internalContexts/CurveLengthContext.d.ts +33 -0
  35. package/lib/cjs/curve/internalContexts/CurveLengthContext.d.ts.map +1 -0
  36. package/lib/cjs/curve/internalContexts/CurveLengthContext.js +91 -0
  37. package/lib/cjs/curve/internalContexts/CurveLengthContext.js.map +1 -0
  38. package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.d.ts +21 -0
  39. package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.d.ts.map +1 -0
  40. package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.js +34 -0
  41. package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -0
  42. package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts +2 -2
  43. package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
  44. package/lib/cjs/curve/spiral/DirectSpiral3d.js +15 -8
  45. package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
  46. package/lib/cjs/geometry3d/Angle.d.ts +20 -10
  47. package/lib/cjs/geometry3d/Angle.d.ts.map +1 -1
  48. package/lib/cjs/geometry3d/Angle.js +30 -15
  49. package/lib/cjs/geometry3d/Angle.js.map +1 -1
  50. package/lib/cjs/geometry3d/Matrix3d.d.ts +25 -8
  51. package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
  52. package/lib/cjs/geometry3d/Matrix3d.js +67 -15
  53. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  54. package/lib/cjs/geometry3d/Point2dVector2d.d.ts +23 -8
  55. package/lib/cjs/geometry3d/Point2dVector2d.d.ts.map +1 -1
  56. package/lib/cjs/geometry3d/Point2dVector2d.js +40 -13
  57. package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
  58. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +90 -55
  59. package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
  60. package/lib/cjs/geometry3d/Point3dVector3d.js +254 -123
  61. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  62. package/lib/cjs/geometry3d/Range.d.ts +0 -1
  63. package/lib/cjs/geometry3d/Range.d.ts.map +1 -1
  64. package/lib/cjs/geometry3d/Range.js +0 -1
  65. package/lib/cjs/geometry3d/Range.js.map +1 -1
  66. package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
  67. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  68. package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
  69. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  70. package/lib/cjs/serialization/IModelJsonSchema.d.ts +1 -1
  71. package/lib/cjs/serialization/IModelJsonSchema.d.ts.map +1 -1
  72. package/lib/cjs/serialization/IModelJsonSchema.js +4 -3
  73. package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
  74. package/lib/cjs/solid/Sphere.d.ts +1 -1
  75. package/lib/cjs/solid/Sphere.js +3 -3
  76. package/lib/cjs/solid/Sphere.js.map +1 -1
  77. package/lib/cjs/solid/TorusPipe.d.ts +17 -13
  78. package/lib/cjs/solid/TorusPipe.d.ts.map +1 -1
  79. package/lib/cjs/solid/TorusPipe.js +67 -38
  80. package/lib/cjs/solid/TorusPipe.js.map +1 -1
  81. package/lib/cjs/topology/Graph.d.ts +1 -1
  82. package/lib/cjs/topology/Graph.js +1 -1
  83. package/lib/cjs/topology/Graph.js.map +1 -1
  84. package/lib/cjs/topology/Triangulation.d.ts +1 -1
  85. package/lib/cjs/topology/Triangulation.js +1 -1
  86. package/lib/cjs/topology/Triangulation.js.map +1 -1
  87. package/lib/esm/Geometry.d.ts +13 -0
  88. package/lib/esm/Geometry.d.ts.map +1 -1
  89. package/lib/esm/Geometry.js.map +1 -1
  90. package/lib/esm/bspline/BSplineCurve.d.ts +1 -1
  91. package/lib/esm/bspline/BSplineCurve.js +1 -1
  92. package/lib/esm/bspline/BSplineCurve.js.map +1 -1
  93. package/lib/esm/bspline/KnotVector.d.ts.map +1 -1
  94. package/lib/esm/bspline/KnotVector.js +3 -0
  95. package/lib/esm/bspline/KnotVector.js.map +1 -1
  96. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +7 -5
  97. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  98. package/lib/esm/curve/CurveChainWithDistanceIndex.js +37 -29
  99. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  100. package/lib/esm/curve/CurveCollection.d.ts +4 -2
  101. package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
  102. package/lib/esm/curve/CurveCollection.js +14 -2
  103. package/lib/esm/curve/CurveCollection.js.map +1 -1
  104. package/lib/esm/curve/CurvePrimitive.d.ts +13 -17
  105. package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
  106. package/lib/esm/curve/CurvePrimitive.js +46 -335
  107. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  108. package/lib/esm/curve/LineString3d.d.ts +11 -1
  109. package/lib/esm/curve/LineString3d.d.ts.map +1 -1
  110. package/lib/esm/curve/LineString3d.js +30 -23
  111. package/lib/esm/curve/LineString3d.js.map +1 -1
  112. package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.d.ts +55 -0
  113. package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.d.ts.map +1 -0
  114. package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js +139 -0
  115. package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -0
  116. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.d.ts +43 -0
  117. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.d.ts.map +1 -0
  118. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js +142 -0
  119. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -0
  120. package/lib/esm/curve/internalContexts/CurveLengthContext.d.ts +33 -0
  121. package/lib/esm/curve/internalContexts/CurveLengthContext.d.ts.map +1 -0
  122. package/lib/esm/curve/internalContexts/CurveLengthContext.js +87 -0
  123. package/lib/esm/curve/internalContexts/CurveLengthContext.js.map +1 -0
  124. package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.d.ts +21 -0
  125. package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.d.ts.map +1 -0
  126. package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js +30 -0
  127. package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -0
  128. package/lib/esm/curve/spiral/DirectSpiral3d.d.ts +2 -2
  129. package/lib/esm/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
  130. package/lib/esm/curve/spiral/DirectSpiral3d.js +15 -8
  131. package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
  132. package/lib/esm/geometry3d/Angle.d.ts +20 -10
  133. package/lib/esm/geometry3d/Angle.d.ts.map +1 -1
  134. package/lib/esm/geometry3d/Angle.js +30 -15
  135. package/lib/esm/geometry3d/Angle.js.map +1 -1
  136. package/lib/esm/geometry3d/Matrix3d.d.ts +25 -8
  137. package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
  138. package/lib/esm/geometry3d/Matrix3d.js +67 -15
  139. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  140. package/lib/esm/geometry3d/Point2dVector2d.d.ts +23 -8
  141. package/lib/esm/geometry3d/Point2dVector2d.d.ts.map +1 -1
  142. package/lib/esm/geometry3d/Point2dVector2d.js +40 -13
  143. package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
  144. package/lib/esm/geometry3d/Point3dVector3d.d.ts +90 -55
  145. package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
  146. package/lib/esm/geometry3d/Point3dVector3d.js +254 -123
  147. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  148. package/lib/esm/geometry3d/Range.d.ts +0 -1
  149. package/lib/esm/geometry3d/Range.d.ts.map +1 -1
  150. package/lib/esm/geometry3d/Range.js +0 -1
  151. package/lib/esm/geometry3d/Range.js.map +1 -1
  152. package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
  153. package/lib/esm/geometry3d/Transform.js.map +1 -1
  154. package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
  155. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  156. package/lib/esm/serialization/IModelJsonSchema.d.ts +1 -1
  157. package/lib/esm/serialization/IModelJsonSchema.d.ts.map +1 -1
  158. package/lib/esm/serialization/IModelJsonSchema.js +4 -3
  159. package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
  160. package/lib/esm/solid/Sphere.d.ts +1 -1
  161. package/lib/esm/solid/Sphere.js +3 -3
  162. package/lib/esm/solid/Sphere.js.map +1 -1
  163. package/lib/esm/solid/TorusPipe.d.ts +17 -13
  164. package/lib/esm/solid/TorusPipe.d.ts.map +1 -1
  165. package/lib/esm/solid/TorusPipe.js +67 -38
  166. package/lib/esm/solid/TorusPipe.js.map +1 -1
  167. package/lib/esm/topology/Graph.d.ts +1 -1
  168. package/lib/esm/topology/Graph.js +1 -1
  169. package/lib/esm/topology/Graph.js.map +1 -1
  170. package/lib/esm/topology/Triangulation.d.ts +1 -1
  171. package/lib/esm/topology/Triangulation.js +1 -1
  172. package/lib/esm/topology/Triangulation.js.map +1 -1
  173. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"CurveC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AC,CAAC;IACzC,CAAC;CACF;AACD;;;GAGG;AACH,MAAM,OAAO,yCAAyC;IAAtD;QACE,8GAA8G;QACvG,8BAAyB,GAAY,IAAI,CAAC;QACjD,0CAA0C;QACnC,8BAAyB,GAAY,IAAI,CAAC;QACjD,gDAAgD;QACzC,4BAAuB,GAAG,QAAQ,CAAC,mBAAmB,CAAC;QAC9D,uDAAuD;QAChD,2BAAsB,GAAG,QAAQ,CAAC,mBAAmB,CAAC;IAC/D,CAAC;CAAA","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 } from \"../geometry3d/Point3dVector3d\";\r\nimport { Range3d } from \"../geometry3d/Range\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { AnyCurve } from \"./CurveChain\";\r\nimport { CurveLocationDetail } from \"./CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"./CurvePrimitive\";\r\nimport { RecursiveCurveProcessor } from \"./CurveProcessor\";\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 { SumLengthsContext } from \"./internalContexts/SumLengthsContext\";\r\nimport { TransformInPlaceContext } from \"./internalContexts/TransformInPlaceContext\";\r\nimport { LineString3d } from \"./LineString3d\";\r\nimport { StrokeOptions } from \"./StrokeOptions\";\r\n\r\n/** Describes the concrete type of a [[CurveCollection]]. Each type name maps to a specific subclass and can be 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` is a (non-instantiable) intermediate class for a sequence of `CurvePrimitive ` joining head-to-tail. The two instantiable forms of `CurveChain` are\r\n * - `Path` - A chain not required to close, and not enclosing a planar area\r\n * - `Loop` - A chain required to close from last to first so that a planar area is enclosed.\r\n * - `ParityRegion` -- a collection of coplanar `Loop`s, with \"in/out\" classification by parity rules\r\n * - `UnionRegion` -- a collection of coplanar `Loop`s, 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\r\n /* eslint-disable @typescript-eslint/naming-convention, no-empty */\r\n /** Flag for inner loop status. Only used by `Loop`. */\r\n public isInner: boolean = false;\r\n /** Return the sum of the lengths of all contained curves. */\r\n public sumLengths(): number { return SumLengthsContext.sumLengths(this); }\r\n /** Return the closest point on the contained curves */\r\n public closestPoint(spacePoint: Point3d): CurveLocationDetail | undefined {\r\n let detailA: CurveLocationDetail | undefined;\r\n if (this.children !== undefined) {\r\n for (const child of this.children) {\r\n if (child instanceof CurvePrimitive) {\r\n const detailB = child.closestPoint(spacePoint, false);\r\n detailA = CurveLocationDetail.chooseSmallerA(detailA, detailB);\r\n } else if (child instanceof CurveCollection) {\r\n const detailB = child.closestPoint(spacePoint);\r\n detailA = CurveLocationDetail.chooseSmallerA(detailA, detailB);\r\n }\r\n }\r\n }\r\n return detailA;\r\n }\r\n\r\n /** return the max gap between adjacent primitives in Path and Loop collections.\r\n *\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 \"unstructured\" so gaps should not be semantically meaningful.\r\n */\r\n public maxGap(): number { return GapSearchContext.maxGap(this); }\r\n /** return true if the curve collection has any primitives other than LineSegment3d and LineString3d */\r\n public checkForNonLinearPrimitives(): boolean { return CountLinearPartsSearchContext.hasNonLinearPrimitives(this); }\r\n /** Apply transform recursively to children */\r\n public tryTransformInPlace(transform: Transform): boolean { return TransformInPlaceContext.tryTransformInPlace(this, transform); }\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 expanded to multiple LineSegment3d. */\r\n public cloneWithExpandedLineStrings(): CurveCollection {\r\n return CloneWithExpandedLineStrings.clone(this);\r\n }\r\n /** Recurse through children to collect CurvePrimitive's in flat array. */\r\n private collectCurvePrimitivesGo(results: CurvePrimitive[], smallestPossiblePrimitives: boolean, explodeLinestrings: boolean = false) {\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 /**\r\n * Return an array containing only the curve primitives.\r\n * @param collectorArray optional array to receive primitives. If present, new primitives are ADDED (without clearing the array.)\r\n * @param smallestPossiblePrimitives if false, CurvePrimitiveWithDistanceIndex returns only itself. If true, it recurses to its (otherwise hidden) children.\r\n */\r\n public collectCurvePrimitives(collectorArray?: CurvePrimitive[], smallestPossiblePrimitives: boolean = false, explodeLineStrings: boolean = false): 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 */\r\n public get isAnyRegionType(): boolean {\r\n return this.dgnBoundaryType() === 2 || this.dgnBoundaryType() === 5 || this.dgnBoundaryType() === 4;\r\n }\r\n /** Return true for a `Path`, i.e. a chain of curves joined head-to-tail\r\n */\r\n public get isOpenPath(): boolean {\r\n return this.dgnBoundaryType() === 1;\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 */\r\n public get isClosedPath(): boolean {\r\n return this.dgnBoundaryType() === 2;\r\n }\r\n /** Return a CurveCollection with the same structure but all curves replaced by strokes. */\r\n public abstract cloneStroked(options?: StrokeOptions): AnyCurve;\r\n\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 /** 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 /** Extend (increase) `rangeToExtend` as needed to include these curves (optionally transformed) */\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 curve primitive in the source.\r\n * * Evaluate it at a fraction (which by default is an interior fraction)\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(source: GeometryQuery | undefined, fraction: number = 0.5): 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/** 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 * - A single entry in the chain can in fact contain multiple curve primitives if the entry itself is (for instance) `CurveChainWithDistanceIndex`\r\n * which presents itself (through method interface) as a CurvePrimitive with well defined mappings from fraction to xyz, but in fact does all the\r\n * calculations over multiple primitives.\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 * @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 protected constructor() { super(); this._curves = []; }\r\n /** Return the array of `CurvePrimitive` */\r\n public override get children(): CurvePrimitive[] {\r\n if (this._curves === undefined)\r\n this._curves = [];\r\n return this._curves;\r\n }\r\n /**\r\n * Return the `[index]` curve primitive, 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 /** Try simplest non-cyclic access first . . */\r\n if (index >= 0 && index < n)\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 /** 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 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): AnyCurve;\r\n /* EDL 01/20 Path, Loop, CurveChainWithDistanceIndex all implement this.\r\n Reducing it to abstract.\r\n Hypothetically, a derived class in the wild might be depending on this.\r\n {\r\n const strokes = LineString3d.create();\r\n for (const curve of this.children)\r\n curve.emitStrokes(strokes, options);\r\n return strokes;\r\n }\r\n */\r\n /** add a child curve.\r\n * * Returns false if the given child is not a CurvePrimitive.\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 in the CurveChain array.\r\n */\r\n public reverseChildrenInPlace() {\r\n for (const curve of this._curves)\r\n curve.reverseInPlace();\r\n this._curves.reverse();\r\n }\r\n /** Return the index where target is found in the array of children */\r\n public childIndex(target: CurvePrimitive | undefined): 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 return undefined;\r\n }\r\n /** Evaluate an indexed curve at a fraction. Return as a CurveLocationDetail that indicates the primitive.\r\n */\r\n public primitiveIndexAndFractionToCurveLocationDetailPointAndDerivative(index: number, fraction: number, cyclic: boolean = false, result?: CurveLocationDetail): 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\r\n /** test if `other` is an instance of `BagOfCurves` */\r\n public isSameGeometryClass(other: GeometryQuery): boolean { return other instanceof BagOfCurves; }\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() { super(); this._children = []; }\r\n /** Return the (reference to) array of children */\r\n public override get children(): AnyCurve[] { return this._children; }\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 { return 0; }\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 { return new BagOfCurves(); }\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/**\r\n * * Options to control method `RegionOps.consolidateAdjacentPrimitives`\r\n * @public\r\n */\r\nexport class ConsolidateAdjacentCurvePrimitivesOptions {\r\n /** True to consolidated linear geometry (e.g. separate LineSegment3d and LineString3d) into LineString3d */\r\n public consolidateLinearGeometry: boolean = true;\r\n /** True to consolidate contiguous arcs */\r\n public consolidateCompatibleArcs: boolean = true;\r\n /** Tolerance for collapsing identical points */\r\n public duplicatePointTolerance = Geometry.smallMetricDistance;\r\n /** Tolerance for removing interior colinear points. */\r\n public colinearPointTolerance = Geometry.smallMetricDistance;\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,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAOvC,OAAO,EAAE,mB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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;AACD;;;GAGG;AACH,MAAM,OAAO,yCAAyC;IAAtD;QACE,8GAA8G;QACvG,8BAAyB,GAAY,IAAI,CAAC;QACjD,0CAA0C;QACnC,8BAAyB,GAAY,IAAI,CAAC;QACjD,gDAAgD;QACzC,4BAAuB,GAAG,QAAQ,CAAC,mBAAmB,CAAC;QAC9D,uDAAuD;QAChD,2BAAsB,GAAG,QAAQ,CAAC,mBAAmB,CAAC;IAC/D,CAAC;CAAA","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 } from \"../geometry3d/Point3dVector3d\";\r\nimport { Range3d } from \"../geometry3d/Range\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { AnyCurve } from \"./CurveChain\";\r\nimport { CurveLocationDetail } from \"./CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"./CurvePrimitive\";\r\nimport { RecursiveCurveProcessor } from \"./CurveProcessor\";\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 { 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\n/** Describes the concrete type of a [[CurveCollection]]. Each type name maps to a specific subclass and can be 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` is a (non-instantiable) intermediate class for a sequence of `CurvePrimitive ` joining head-to-tail. The two instantiable forms of `CurveChain` are\r\n * - `Path` - A chain not required to close, and not enclosing a planar area\r\n * - `Loop` - A chain required to close from last to first so that a planar area is enclosed.\r\n * - `ParityRegion` -- a collection of coplanar `Loop`s, with \"in/out\" classification by parity rules\r\n * - `UnionRegion` -- a collection of coplanar `Loop`s, 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\r\n /* eslint-disable @typescript-eslint/naming-convention, no-empty */\r\n /** Flag for inner loop status. Only used by `Loop`. */\r\n public isInner: boolean = false;\r\n /** Return the sum of the lengths of all contained curves. */\r\n public sumLengths(): number { return SumLengthsContext.sumLengths(this); }\r\n /** Return the closest point on the contained curves */\r\n public closestPoint(spacePoint: Point3d): CurveLocationDetail | undefined {\r\n let detailA: CurveLocationDetail | undefined;\r\n if (this.children !== undefined) {\r\n for (const child of this.children) {\r\n if (child instanceof CurvePrimitive) {\r\n const detailB = child.closestPoint(spacePoint, false);\r\n detailA = CurveLocationDetail.chooseSmallerA(detailA, detailB);\r\n } else if (child instanceof CurveCollection) {\r\n const detailB = child.closestPoint(spacePoint);\r\n detailA = CurveLocationDetail.chooseSmallerA(detailA, detailB);\r\n }\r\n }\r\n }\r\n return detailA;\r\n }\r\n\r\n /** return the max gap between adjacent primitives in Path and Loop collections.\r\n *\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 \"unstructured\" so gaps should not be semantically meaningful.\r\n */\r\n public maxGap(): number { return GapSearchContext.maxGap(this); }\r\n /** return true if the curve collection has any primitives other than LineSegment3d and LineString3d */\r\n public checkForNonLinearPrimitives(): boolean { return CountLinearPartsSearchContext.hasNonLinearPrimitives(this); }\r\n /** Apply transform recursively to children */\r\n public tryTransformInPlace(transform: Transform): boolean { return TransformInPlaceContext.tryTransformInPlace(this, transform); }\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 expanded to multiple LineSegment3d. */\r\n public cloneWithExpandedLineStrings(): CurveCollection {\r\n return CloneWithExpandedLineStrings.clone(this);\r\n }\r\n /** Recurse through children to collect CurvePrimitive's in flat array. */\r\n private collectCurvePrimitivesGo(results: CurvePrimitive[], smallestPossiblePrimitives: boolean, explodeLinestrings: boolean = false) {\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 /**\r\n * Return an array containing only the curve primitives.\r\n * @param collectorArray optional array to receive primitives. If present, new primitives are ADDED (without clearing the array.)\r\n * @param smallestPossiblePrimitives if false, CurvePrimitiveWithDistanceIndex returns only itself. If true, it recurses to its (otherwise hidden) children.\r\n */\r\n public collectCurvePrimitives(collectorArray?: CurvePrimitive[], smallestPossiblePrimitives: boolean = false, explodeLineStrings: boolean = false): 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 */\r\n public get isAnyRegionType(): boolean {\r\n return this.dgnBoundaryType() === 2 || this.dgnBoundaryType() === 5 || this.dgnBoundaryType() === 4;\r\n }\r\n /** Return true for a `Path`, i.e. a chain of curves joined head-to-tail\r\n */\r\n public get isOpenPath(): boolean {\r\n return this.dgnBoundaryType() === 1;\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 */\r\n public get isClosedPath(): boolean {\r\n return this.dgnBoundaryType() === 2;\r\n }\r\n /** Return a CurveCollection with the same structure but all curves replaced by strokes. */\r\n public abstract cloneStroked(options?: StrokeOptions): AnyCurve;\r\n\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 /** 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 /** Extend (increase) `rangeToExtend` as needed to include these curves (optionally transformed) */\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 curve primitive in the source.\r\n * * Evaluate it at a fraction (which by default is an interior fraction)\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(source: GeometryQuery | undefined, fraction: number = 0.5): 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/** 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 * - A single entry in the chain can in fact contain multiple curve primitives if the entry itself is (for instance) `CurveChainWithDistanceIndex`\r\n * which presents itself (through method interface) as a CurvePrimitive with well defined mappings from fraction to xyz, but in fact does all the\r\n * calculations over multiple primitives.\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 * @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 protected constructor() { super(); this._curves = []; }\r\n /** Return the array of `CurvePrimitive` */\r\n public override get children(): CurvePrimitive[] {\r\n if (this._curves === undefined)\r\n this._curves = [];\r\n return this._curves;\r\n }\r\n /**\r\n * Return the `[index]` curve primitive, 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 /** Try simplest non-cyclic access first . . */\r\n if (index >= 0 && index < n)\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 /** 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 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): AnyCurve;\r\n /* EDL 01/20 Path, Loop, CurveChainWithDistanceIndex all implement this.\r\n Reducing it to abstract.\r\n Hypothetically, a derived class in the wild might be depending on this.\r\n {\r\n const strokes = LineString3d.create();\r\n for (const curve of this.children)\r\n curve.emitStrokes(strokes, options);\r\n return strokes;\r\n }\r\n */\r\n /** add a child curve.\r\n * * Returns false if the given child is not a CurvePrimitive.\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 in the CurveChain array.\r\n */\r\n public reverseChildrenInPlace() {\r\n for (const curve of this._curves)\r\n curve.reverseInPlace();\r\n this._curves.reverse();\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 */\r\n public primitiveIndexAndFractionToCurveLocationDetailPointAndDerivative(index: number, fraction: number, cyclic: boolean = false, result?: CurveLocationDetail): 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\r\n /** test if `other` is an instance of `BagOfCurves` */\r\n public isSameGeometryClass(other: GeometryQuery): boolean { return other instanceof BagOfCurves; }\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() { super(); this._children = []; }\r\n /** Return the (reference to) array of children */\r\n public override get children(): AnyCurve[] { return this._children; }\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 { return 0; }\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 { return new BagOfCurves(); }\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/**\r\n * * Options to control method `RegionOps.consolidateAdjacentPrimitives`\r\n * @public\r\n */\r\nexport class ConsolidateAdjacentCurvePrimitivesOptions {\r\n /** True to consolidated linear geometry (e.g. separate LineSegment3d and LineString3d) into LineString3d */\r\n public consolidateLinearGeometry: boolean = true;\r\n /** True to consolidate contiguous arcs */\r\n public consolidateCompatibleArcs: boolean = true;\r\n /** Tolerance for collapsing identical points */\r\n public duplicatePointTolerance = Geometry.smallMetricDistance;\r\n /** Tolerance for removing interior colinear points. */\r\n public colinearPointTolerance = Geometry.smallMetricDistance;\r\n}\r\n"]}
@@ -1,31 +1,28 @@
1
- /** @packageDocumentation
2
- * @module Curve
3
- */
4
- import type { InterpolationCurve3d } from "../bspline/InterpolationCurve3d";
5
1
  import { Clipper } from "../clipping/ClipUtils";
6
2
  import { StrokeCountMap } from "../curve/Query/StrokeCountMap";
7
3
  import { PlaneAltitudeEvaluator } from "../Geometry";
8
- import type { AkimaCurve3d } from "../bspline/AkimaCurve3d";
9
- import type { BSplineCurve3d } from "../bspline/BSplineCurve";
10
- import type { BezierCurve3d } from "../bspline/BezierCurve3d";
11
- import type { CurveChainWithDistanceIndex } from "./CurveChainWithDistanceIndex";
12
- import type { DirectSpiral3d } from "./spiral/DirectSpiral3d";
13
- import type { IntegratedSpiral3d } from "./spiral/IntegratedSpiral3d";
14
4
  import { IStrokeHandler } from "../geometry3d/GeometryHandler";
15
5
  import { Plane3dByOriginAndUnitNormal } from "../geometry3d/Plane3dByOriginAndUnitNormal";
16
6
  import { Plane3dByOriginAndVectors } from "../geometry3d/Plane3dByOriginAndVectors";
17
7
  import { Point3d } from "../geometry3d/Point3dVector3d";
8
+ import { Range3d } from "../geometry3d/Range";
18
9
  import { Ray3d } from "../geometry3d/Ray3d";
19
10
  import { Transform } from "../geometry3d/Transform";
20
- import type { Arc3d } from "./Arc3d";
21
11
  import { VariantCurveExtendParameter } from "./CurveExtendMode";
22
12
  import { CurveLocationDetail } from "./CurveLocationDetail";
23
13
  import { GeometryQuery } from "./GeometryQuery";
24
- import type { LineSegment3d } from "./LineSegment3d";
25
14
  import { LineString3d } from "./LineString3d";
26
15
  import { StrokeOptions } from "./StrokeOptions";
16
+ import type { InterpolationCurve3d } from "../bspline/InterpolationCurve3d";
17
+ import type { AkimaCurve3d } from "../bspline/AkimaCurve3d";
18
+ import type { BSplineCurve3d } from "../bspline/BSplineCurve";
19
+ import type { BezierCurve3d } from "../bspline/BezierCurve3d";
20
+ import type { CurveChainWithDistanceIndex } from "./CurveChainWithDistanceIndex";
21
+ import type { DirectSpiral3d } from "./spiral/DirectSpiral3d";
22
+ import type { IntegratedSpiral3d } from "./spiral/IntegratedSpiral3d";
23
+ import type { Arc3d } from "./Arc3d";
24
+ import type { LineSegment3d } from "./LineSegment3d";
27
25
  import type { OffsetOptions } from "./internalContexts/PolygonOffsetContext";
28
- import { Range3d } from "../geometry3d/Range";
29
26
  /** Describes the concrete type of a [[CurvePrimitive]]. Each type name maps to a specific subclass and can be used for type-switching in conditional statements.
30
27
  * - "arc" => [[Arc3d]]
31
28
  * - "lineSegment" => [[LineSegment3d]]
@@ -196,9 +193,8 @@ export declare abstract class CurvePrimitive extends GeometryQuery {
196
193
  * * (Attempt to) find a position on the curve at a signed distance from start fraction.
197
194
  * * Return the position as a CurveLocationDetail.
198
195
  * * In the `CurveLocationDetail`, record:
199
- * * `fractional` position
200
- * * `fraction` = coordinates of the point
201
- * * `search
196
+ * * `fraction` = fractional position
197
+ * * `point` = coordinates of the point
202
198
  * * `a` = (signed!) distance moved. If `allowExtension` is false and the move reached the start or end of the curve, this distance is smaller than the requested signedDistance.
203
199
  * * `curveSearchStatus` indicates one of:
204
200
  * * `error` (unusual) computation failed not supported for this curve.
@@ -287,7 +283,7 @@ export declare abstract class CurvePrimitive extends GeometryQuery {
287
283
  */
288
284
  clonePartialCurve(_fractionA: number, _fractionB: number): CurvePrimitive | undefined;
289
285
  /**
290
- * * If the curve primitive has distance-along-curve strictly proportional to curve fraction, return true
286
+ * * If the curve primitive has distance-along-curve strictly proportional to curve fraction, return the scale factor.
291
287
  * * If distance-along-the-curve is not proportional, return undefined.
292
288
  * * When defined, the scale factor is always the length of the curve.
293
289
  * * This scale factor is typically available for these curve types:
@@ -1 +1 @@
1
- {"version":3,"file":"CurvePrimitive.d.ts","sourceRoot":"","sources":["../../../src/curve/CurvePrimitive.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAuB,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAC1F,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,EAAE,OAAO,EAAY,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAIpD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAsB,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AACpF,OAAO,EAAqB,mBAA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;;;OAKG;WACW,qBAAqB,CAAC,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,cAAc,EAAE,SAAS,CAAC,EAAE,cAAc;IAK/G;;;;;;OAMG;IACI,wBAAwB,CAAC,cAAc,EAAE,cAAc,EAAE,EAAE,2BAA2B,EAAE,OAAO,EAAE,mBAAmB,GAAE,OAAe;IAI5I;;;;;OAKG;IACI,sBAAsB,CAAC,cAAc,CAAC,EAAE,cAAc,EAAE,EAAE,0BAA0B,GAAE,OAAe,EAC1G,kBAAkB,GAAE,OAAe,GAAG,cAAc,EAAE;IAMxD;;;;;OAKG;aACa,iBAAiB,CAAC,uBAAuB,EAAE,MAAM,GAAG,aAAa,GAAG,cAAc,GAAG,cAAc,EAAE,GAAG,SAAS;CAClI"}
@@ -1,16 +1,23 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ /** @packageDocumentation
6
+ * @module Curve
7
+ */
8
+ import { assert } from "@itwin/core-bentley";
1
9
  import { StrokeCountMap } from "../curve/Query/StrokeCountMap";
2
10
  import { AxisOrder, Geometry } from "../Geometry";
3
11
  import { Matrix3d } from "../geometry3d/Matrix3d";
4
12
  import { Point3d } from "../geometry3d/Point3dVector3d";
13
+ import { Range3d } from "../geometry3d/Range";
5
14
  import { Ray3d } from "../geometry3d/Ray3d";
6
15
  import { Transform } from "../geometry3d/Transform";
7
- import { Order2Bezier } from "../numerics/BezierPolynomials";
8
- import { Newton1dUnboundedApproximateDerivative, NewtonEvaluatorRtoR } from "../numerics/Newton";
9
- import { GaussMapper } from "../numerics/Quadrature";
10
- import { CurveExtendOptions } from "./CurveExtendMode";
11
16
  import { CurveIntervalRole, CurveLocationDetail, CurveSearchStatus } from "./CurveLocationDetail";
12
17
  import { GeometryQuery } from "./GeometryQuery";
13
- import { Range3d } from "../geometry3d/Range";
18
+ import { AppendPlaneIntersectionStrokeHandler } from "./internalContexts/AppendPlaneIntersectionStrokeHandler";
19
+ import { ClosestPointStrokeHandler } from "./internalContexts/ClosestPointStrokeHandler";
20
+ import { CurveLengthContext } from "./internalContexts/CurveLengthContext";
14
21
  /**
15
22
  * A curve primitive is bounded
16
23
  * A curve primitive maps fractions in 0..1 to points in space.
@@ -220,9 +227,8 @@ export class CurvePrimitive extends GeometryQuery {
220
227
  * * (Attempt to) find a position on the curve at a signed distance from start fraction.
221
228
  * * Return the position as a CurveLocationDetail.
222
229
  * * In the `CurveLocationDetail`, record:
223
- * * `fractional` position
224
- * * `fraction` = coordinates of the point
225
- * * `search
230
+ * * `fraction` = fractional position
231
+ * * `point` = coordinates of the point
226
232
  * * `a` = (signed!) distance moved. If `allowExtension` is false and the move reached the start or end of the curve, this distance is smaller than the requested signedDistance.
227
233
  * * `curveSearchStatus` indicates one of:
228
234
  * * `error` (unusual) computation failed not supported for this curve.
@@ -277,13 +283,39 @@ export class CurvePrimitive extends GeometryQuery {
277
283
  * @param result
278
284
  */
279
285
  moveSignedDistanceFromFractionGeneric(startFraction, signedDistance, allowExtension, result) {
280
- const limitFraction = signedDistance > 0.0 ? 1.0 : 0.0;
286
+ let limitFraction;
287
+ const slackFraction = 0.1; // slack to use when integration would otherwise have no room to work
288
+ if (signedDistance === 0.0)
289
+ return CurveLocationDetail.createCurveEvaluatedFraction(this, startFraction, result); // no movement, just evaluate at startFraction
290
+ if (signedDistance > 0.0) {
291
+ limitFraction = 1.0;
292
+ if (startFraction >= 1.0) {
293
+ const newStartFraction = 1.0 - slackFraction;
294
+ signedDistance += this.curveLengthBetweenFractions(newStartFraction, startFraction);
295
+ startFraction = newStartFraction;
296
+ }
297
+ }
298
+ else { // signedDistance < 0.0
299
+ limitFraction = 0.0;
300
+ if (startFraction <= 0.0) {
301
+ const newStartFraction = 0.0 + slackFraction;
302
+ signedDistance -= this.curveLengthBetweenFractions(startFraction, newStartFraction);
303
+ startFraction = newStartFraction;
304
+ }
305
+ }
306
+ const availableLength = this.curveLengthBetweenFractions(startFraction, limitFraction);
307
+ assert(availableLength > 0.0);
281
308
  const absDistance = Math.abs(signedDistance);
282
- const directionFactor = signedDistance < 0.0 ? -1.0 : 1.0;
283
- const availableLength = this.curveLengthBetweenFractions(startFraction, limitFraction); // that is always positive
284
309
  if (availableLength < absDistance && !allowExtension)
285
310
  return CurveLocationDetail.createConditionalMoveSignedDistance(allowExtension, this, startFraction, limitFraction, signedDistance, result);
286
- const fractionStep = absDistance / availableLength;
311
+ const fractionStep = Geometry.conditionalDivideCoordinate(absDistance, availableLength);
312
+ if (undefined === fractionStep) {
313
+ // no available length!
314
+ result = CurveLocationDetail.createCurveEvaluatedFraction(this, startFraction, result);
315
+ result.curveSearchStatus = CurveSearchStatus.error;
316
+ return result;
317
+ }
318
+ const directionFactor = signedDistance < 0.0 ? -1.0 : 1.0;
287
319
  let fractionB = Geometry.interpolate(startFraction, fractionStep, limitFraction);
288
320
  let fractionA = startFraction;
289
321
  let distanceA = 0.0;
@@ -318,9 +350,8 @@ export class CurvePrimitive extends GeometryQuery {
318
350
  distanceA = distance0B;
319
351
  }
320
352
  if (numConverged > 1)
321
- return CurveLocationDetail.createConditionalMoveSignedDistance(false, this, startFraction, fractionB, signedDistance, result);
353
+ return CurveLocationDetail.createConditionalMoveSignedDistance(allowExtension, this, startFraction, fractionB, signedDistance, result);
322
354
  result = CurveLocationDetail.createCurveEvaluatedFraction(this, startFraction, result);
323
- result.a = 0.0;
324
355
  result.curveSearchStatus = CurveSearchStatus.error;
325
356
  return result;
326
357
  }
@@ -364,7 +395,7 @@ export class CurvePrimitive extends GeometryQuery {
364
395
  return undefined;
365
396
  }
366
397
  /**
367
- * * If the curve primitive has distance-along-curve strictly proportional to curve fraction, return true
398
+ * * If the curve primitive has distance-along-curve strictly proportional to curve fraction, return the scale factor.
368
399
  * * If distance-along-the-curve is not proportional, return undefined.
369
400
  * * When defined, the scale factor is always the length of the curve.
370
401
  * * This scale factor is typically available for these curve types:
@@ -537,324 +568,4 @@ export class CurvePrimitive extends GeometryQuery {
537
568
  return results;
538
569
  }
539
570
  }
540
- /** Intermediate class for managing the parentCurve announcements from an IStrokeHandler */
541
- class NewtonRotRStrokeHandler extends NewtonEvaluatorRtoR {
542
- constructor() {
543
- super();
544
- this._parentCurvePrimitive = undefined;
545
- }
546
- /** retain the parentCurvePrimitive.
547
- * * Calling this method tells the handler that the parent curve is to be used for detail searches.
548
- * * Example: Transition spiral search is based on linestring first, then the exact spiral.
549
- * * Example: CurveChainWithDistanceIndex does NOT do this announcement -- the constituents act independently.
550
- */
551
- startParentCurvePrimitive(curve) { this._parentCurvePrimitive = curve; }
552
- /** Forget the parentCurvePrimitive */
553
- endParentCurvePrimitive(_curve) { this._parentCurvePrimitive = undefined; }
554
- }
555
- class AppendPlaneIntersectionStrokeHandler extends NewtonRotRStrokeHandler {
556
- constructor(plane, intersections) {
557
- super();
558
- this._fractionA = 0;
559
- this._functionA = 0;
560
- // private derivativeA: number; <---- Not currently used
561
- this._functionB = 0;
562
- this._fractionB = 0;
563
- this._derivativeB = 0;
564
- this._numThisCurve = 0;
565
- this._plane = plane;
566
- this._intersections = intersections;
567
- this.startCurvePrimitive(undefined);
568
- this._ray = Ray3d.createZero();
569
- this._newtonSolver = new Newton1dUnboundedApproximateDerivative(this);
570
- }
571
- // Return the first defined curve among: this.parentCurvePrimitive, this.curve;
572
- effectiveCurve() {
573
- if (this._parentCurvePrimitive)
574
- return this._parentCurvePrimitive;
575
- return this._curve;
576
- }
577
- get getDerivativeB() { return this._derivativeB; } // <--- DerivativeB is not currently used anywhere. Provided getter to suppress lint error
578
- startCurvePrimitive(curve) {
579
- this._curve = curve;
580
- this._fractionA = 0.0;
581
- this._numThisCurve = 0;
582
- this._functionA = 0.0;
583
- // this.derivativeA = 0.0;
584
- }
585
- endCurvePrimitive() { }
586
- announceIntervalForUniformStepStrokes(cp, numStrokes, fraction0, fraction1) {
587
- this.startCurvePrimitive(cp);
588
- if (numStrokes < 1)
589
- numStrokes = 1;
590
- const df = 1.0 / numStrokes;
591
- for (let i = 0; i <= numStrokes; i++) {
592
- const fraction = Geometry.interpolate(fraction0, i * df, fraction1);
593
- cp.fractionToPointAndDerivative(fraction, this._ray);
594
- this.announcePointTangent(this._ray.origin, fraction, this._ray.direction);
595
- }
596
- }
597
- announceSegmentInterval(_cp, point0, point1, _numStrokes, fraction0, fraction1) {
598
- const h0 = this._plane.altitude(point0);
599
- const h1 = this._plane.altitude(point1);
600
- if (h0 * h1 > 0.0)
601
- return;
602
- const fraction01 = Order2Bezier.solveCoffs(h0, h1);
603
- // let numIntersection = 0;
604
- if (fraction01 !== undefined) {
605
- // numIntersection++;
606
- const fraction = Geometry.interpolate(fraction0, fraction01, fraction1);
607
- this._newtonSolver.setX(fraction);
608
- if (this._newtonSolver.runIterations()) {
609
- this.announceSolutionFraction(this._newtonSolver.getX());
610
- }
611
- // this.intersections.push(CurveLocationDetail.createCurveFractionPoint(cp, fraction, cp.fractionToPoint(fraction)));
612
- }
613
- }
614
- announceSolutionFraction(fraction) {
615
- const curve = this.effectiveCurve();
616
- if (curve) {
617
- this._ray = curve.fractionToPointAndDerivative(fraction, this._ray);
618
- this._intersections.push(CurveLocationDetail.createCurveFractionPoint(curve, fraction, this._ray.origin));
619
- }
620
- }
621
- evaluate(fraction) {
622
- const curve = this.effectiveCurve();
623
- if (!curve)
624
- return false;
625
- this.currentF = this._plane.altitude(curve.fractionToPoint(fraction));
626
- return true;
627
- }
628
- /**
629
- * * ASSUME both the "A" and "B" evaluations (fraction, function, and derivative) are known.
630
- * * If function value changed sign between, interpolate an approximate root and improve it with
631
- * the newton solver.
632
- */
633
- searchInterval() {
634
- if (this._functionA * this._functionB > 0)
635
- return;
636
- if (this._functionA === 0)
637
- this.announceSolutionFraction(this._fractionA);
638
- if (this._functionB === 0)
639
- this.announceSolutionFraction(this._fractionB);
640
- if (this._functionA * this._functionB < 0) {
641
- const fraction = Geometry.inverseInterpolate(this._fractionA, this._functionA, this._fractionB, this._functionB);
642
- if (fraction) {
643
- this._newtonSolver.setX(fraction);
644
- if (this._newtonSolver.runIterations())
645
- this.announceSolutionFraction(this._newtonSolver.getX());
646
- }
647
- }
648
- }
649
- /** Evaluate and save _functionB, _derivativeB, and _fractionB. */
650
- evaluateB(xyz, fraction, tangent) {
651
- this._functionB = this._plane.altitude(xyz);
652
- this._derivativeB = this._plane.velocity(tangent);
653
- this._fractionB = fraction;
654
- }
655
- /**
656
- * Announce point and tangent for evaluations.
657
- * * The function evaluation is saved as the "B" function point.
658
- * * The function point count is incremented
659
- * * If function point count is greater than 1, the current interval is searched.
660
- * * The just-evaluated point ("B") is saved as the "old" ("A") evaluation point.
661
- * @param xyz
662
- * @param fraction
663
- * @param tangent
664
- */
665
- announcePointTangent(xyz, fraction, tangent) {
666
- this.evaluateB(xyz, fraction, tangent);
667
- if (this._numThisCurve++ > 0)
668
- this.searchInterval();
669
- this._functionA = this._functionB;
670
- this._fractionA = this._fractionB;
671
- }
672
- }
673
- class CurveLengthContext {
674
- constructor(fraction0 = 0.0, fraction1 = 1.0, numGaussPoints = 5) {
675
- this.startCurvePrimitive(undefined);
676
- this._summedLength = 0.0;
677
- this._ray = Ray3d.createZero();
678
- if (fraction0 < fraction1) {
679
- this._fraction0 = fraction0;
680
- this._fraction1 = fraction1;
681
- }
682
- else {
683
- this._fraction0 = fraction1;
684
- this._fraction1 = fraction0;
685
- }
686
- this._gaussMapper = new GaussMapper(numGaussPoints);
687
- }
688
- tangentMagnitude(fraction) {
689
- this._ray = this._curve.fractionToPointAndDerivative(fraction, this._ray);
690
- return this._ray.direction.magnitude();
691
- }
692
- getSum() { return this._summedLength; }
693
- startCurvePrimitive(curve) {
694
- this._curve = curve;
695
- }
696
- startParentCurvePrimitive(_curve) { }
697
- endParentCurvePrimitive(_curve) { }
698
- endCurvePrimitive() { }
699
- announceIntervalForUniformStepStrokes(cp, numStrokes, fraction0, fraction1) {
700
- if (fraction0 < this._fraction0)
701
- fraction0 = this._fraction0;
702
- if (fraction1 > this._fraction1)
703
- fraction1 = this._fraction1;
704
- if (fraction1 > fraction0) {
705
- this.startCurvePrimitive(cp);
706
- if (numStrokes < 1)
707
- numStrokes = 1;
708
- const df = 1.0 / numStrokes;
709
- for (let i = 1; i <= numStrokes; i++) {
710
- const fractionA = Geometry.interpolate(fraction0, (i - 1) * df, fraction1);
711
- const fractionB = i === numStrokes ? fraction1 : Geometry.interpolate(fraction0, (i) * df, fraction1);
712
- const numGauss = this._gaussMapper.mapXAndW(fractionA, fractionB);
713
- for (let k = 0; k < numGauss; k++) {
714
- this._summedLength += this._gaussMapper.gaussW[k] * this.tangentMagnitude(this._gaussMapper.gaussX[k]);
715
- }
716
- }
717
- }
718
- }
719
- announceSegmentInterval(_cp, point0, point1, _numStrokes, fraction0, fraction1) {
720
- const segmentLength = point0.distance(point1);
721
- if (this._fraction0 <= fraction0 && fraction1 <= this._fraction1)
722
- this._summedLength += segmentLength;
723
- else {
724
- let g0 = fraction0;
725
- let g1 = fraction1;
726
- if (g0 < this._fraction0)
727
- g0 = this._fraction0;
728
- if (g1 > this._fraction1)
729
- g1 = this._fraction1;
730
- if (g1 > g0) {
731
- this._summedLength += segmentLength * (g1 - g0) / (fraction1 - fraction0);
732
- }
733
- }
734
- }
735
- announcePointTangent(_xyz, _fraction, _tangent) {
736
- // uh oh -- need to retain point for next interval
737
- }
738
- }
739
- // context for searching for closest point .. .
740
- class ClosestPointStrokeHandler extends NewtonRotRStrokeHandler {
741
- constructor(spacePoint, extend) {
742
- super();
743
- this._fractionA = 0;
744
- this._functionA = 0;
745
- this._functionB = 0;
746
- this._fractionB = 0;
747
- this._numThisCurve = 0;
748
- this._spacePoint = spacePoint;
749
- this._workPoint = Point3d.create();
750
- this._workRay = Ray3d.createZero();
751
- this._closestPoint = undefined;
752
- this._extend = extend;
753
- this.startCurvePrimitive(undefined);
754
- this._newtonSolver = new Newton1dUnboundedApproximateDerivative(this);
755
- }
756
- claimResult() {
757
- if (this._closestPoint) {
758
- this._newtonSolver.setX(this._closestPoint.fraction);
759
- this._curve = this._closestPoint.curve;
760
- if (this._newtonSolver.runIterations()) {
761
- let fraction = this._newtonSolver.getX();
762
- fraction = CurveExtendOptions.correctFraction(this._extend, fraction);
763
- this.announceSolutionFraction(fraction);
764
- }
765
- }
766
- return this._closestPoint;
767
- }
768
- needPrimaryGeometryForStrokes() { return true; }
769
- startCurvePrimitive(curve) {
770
- this._curve = curve;
771
- this._fractionA = 0.0;
772
- this._numThisCurve = 0;
773
- this._functionA = 0.0;
774
- }
775
- endCurvePrimitive() { }
776
- announceIntervalForUniformStepStrokes(cp, numStrokes, fraction0, fraction1) {
777
- this.startCurvePrimitive(cp);
778
- this.announceSolutionFraction(0.0); // test start point as closest
779
- this.announceSolutionFraction(1.0); // test end point as closest
780
- if (numStrokes < 1)
781
- numStrokes = 1;
782
- const df = 1.0 / numStrokes;
783
- for (let i = 0; i <= numStrokes; i++) {
784
- const fraction = Geometry.interpolate(fraction0, i * df, fraction1);
785
- cp.fractionToPointAndDerivative(fraction, this._workRay);
786
- this.announceRay(fraction, this._workRay);
787
- }
788
- }
789
- announceCandidate(cp, fraction, point) {
790
- const distance = this._spacePoint.distance(point);
791
- if (this._closestPoint && distance > this._closestPoint.a)
792
- return;
793
- this._closestPoint = CurveLocationDetail.createCurveFractionPoint(cp, fraction, point, this._closestPoint);
794
- this._closestPoint.a = distance;
795
- if (this._parentCurvePrimitive !== undefined)
796
- this._closestPoint.curve = this._parentCurvePrimitive;
797
- }
798
- announceSegmentInterval(cp, point0, point1, _numStrokes, fraction0, fraction1) {
799
- let localFraction = this._spacePoint.fractionOfProjectionToLine(point0, point1, 0.0);
800
- // only consider extending the segment if the immediate caller says we are at endpoints ...
801
- if (!this._extend)
802
- localFraction = Geometry.clampToStartEnd(localFraction, 0.0, 1.0);
803
- else {
804
- if (fraction0 !== 0.0)
805
- localFraction = Math.max(localFraction, 0.0);
806
- if (fraction1 !== 1.0)
807
- localFraction = Math.min(localFraction, 1.0);
808
- }
809
- this._workPoint = point0.interpolate(localFraction, point1);
810
- const globalFraction = Geometry.interpolate(fraction0, localFraction, fraction1);
811
- this.announceCandidate(cp, globalFraction, this._workPoint);
812
- }
813
- searchInterval() {
814
- if (this._functionA * this._functionB > 0)
815
- return;
816
- if (this._functionA === 0)
817
- this.announceSolutionFraction(this._fractionA);
818
- if (this._functionB === 0)
819
- this.announceSolutionFraction(this._fractionB);
820
- if (this._functionA * this._functionB < 0) {
821
- const fraction = Geometry.inverseInterpolate(this._fractionA, this._functionA, this._fractionB, this._functionB);
822
- if (fraction) {
823
- this._newtonSolver.setX(fraction);
824
- if (this._newtonSolver.runIterations())
825
- this.announceSolutionFraction(this._newtonSolver.getX());
826
- }
827
- }
828
- }
829
- evaluateB(fractionB, dataB) {
830
- this._functionB = dataB.dotProductToPoint(this._spacePoint);
831
- this._fractionB = fractionB;
832
- }
833
- announceSolutionFraction(fraction) {
834
- if (this._curve)
835
- this.announceCandidate(this._curve, fraction, this._curve.fractionToPoint(fraction));
836
- }
837
- evaluate(fraction) {
838
- let curve = this._curve;
839
- if (this._parentCurvePrimitive)
840
- curve = this._parentCurvePrimitive;
841
- if (curve) {
842
- this._workRay = curve.fractionToPointAndDerivative(fraction, this._workRay);
843
- this.currentF = this._workRay.dotProductToPoint(this._spacePoint);
844
- return true;
845
- }
846
- return false;
847
- }
848
- announceRay(fraction, data) {
849
- this.evaluateB(fraction, data);
850
- if (this._numThisCurve++ > 0)
851
- this.searchInterval();
852
- this._functionA = this._functionB;
853
- this._fractionA = this._fractionB;
854
- }
855
- announcePointTangent(point, fraction, tangent) {
856
- this._workRay.set(point, tangent);
857
- this.announceRay(fraction, this._workRay);
858
- }
859
- }
860
571
  //# sourceMappingURL=CurvePrimitive.js.map