@itwin/core-geometry 4.9.0-dev.18 → 4.9.0-dev.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +11 -6
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js +12 -10
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/cjs/curve/CurveCurve.d.ts +11 -9
- package/lib/cjs/curve/CurveCurve.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCurve.js +11 -9
- package/lib/cjs/curve/CurveCurve.js.map +1 -1
- package/lib/cjs/curve/CurveFactory.d.ts +4 -3
- package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
- package/lib/cjs/curve/CurveFactory.js +4 -3
- package/lib/cjs/curve/CurveFactory.js.map +1 -1
- package/lib/cjs/curve/LineString3d.d.ts +7 -5
- package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineString3d.js +7 -5
- package/lib/cjs/curve/LineString3d.js.map +1 -1
- package/lib/cjs/curve/Loop.d.ts.map +1 -1
- package/lib/cjs/curve/Loop.js +6 -6
- package/lib/cjs/curve/Loop.js.map +1 -1
- package/lib/cjs/curve/Path.d.ts.map +1 -1
- package/lib/cjs/curve/Path.js +5 -6
- package/lib/cjs/curve/Path.js.map +1 -1
- package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts.map +1 -1
- package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js +3 -4
- package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
- package/lib/cjs/curve/RegionOps.d.ts +2 -2
- package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
- package/lib/cjs/curve/RegionOps.js +2 -2
- package/lib/cjs/curve/RegionOps.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts +22 -8
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +127 -52
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/cjs/geometry3d/GeometryHandler.d.ts.map +1 -1
- package/lib/cjs/geometry3d/GeometryHandler.js +1 -7
- package/lib/cjs/geometry3d/GeometryHandler.js.map +1 -1
- package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.d.ts +1 -1
- package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js +3 -3
- package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +11 -6
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.js +12 -10
- package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/esm/curve/CurveCurve.d.ts +11 -9
- package/lib/esm/curve/CurveCurve.d.ts.map +1 -1
- package/lib/esm/curve/CurveCurve.js +11 -9
- package/lib/esm/curve/CurveCurve.js.map +1 -1
- package/lib/esm/curve/CurveFactory.d.ts +4 -3
- package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
- package/lib/esm/curve/CurveFactory.js +4 -3
- package/lib/esm/curve/CurveFactory.js.map +1 -1
- package/lib/esm/curve/LineString3d.d.ts +7 -5
- package/lib/esm/curve/LineString3d.d.ts.map +1 -1
- package/lib/esm/curve/LineString3d.js +7 -5
- package/lib/esm/curve/LineString3d.js.map +1 -1
- package/lib/esm/curve/Loop.d.ts.map +1 -1
- package/lib/esm/curve/Loop.js +6 -6
- package/lib/esm/curve/Loop.js.map +1 -1
- package/lib/esm/curve/Path.d.ts.map +1 -1
- package/lib/esm/curve/Path.js +5 -6
- package/lib/esm/curve/Path.js.map +1 -1
- package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts.map +1 -1
- package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js +3 -4
- package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
- package/lib/esm/curve/RegionOps.d.ts +2 -2
- package/lib/esm/curve/RegionOps.d.ts.map +1 -1
- package/lib/esm/curve/RegionOps.js +2 -2
- package/lib/esm/curve/RegionOps.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts +22 -8
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +127 -52
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/esm/geometry3d/GeometryHandler.d.ts.map +1 -1
- package/lib/esm/geometry3d/GeometryHandler.js +1 -7
- package/lib/esm/geometry3d/GeometryHandler.js.map +1 -1
- package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.d.ts +1 -1
- package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.d.ts.map +1 -1
- package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js +3 -3
- package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GeometryHandler.js","sourceRoot":"","sources":["../../../src/geometry3d/GeometryHandler.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAsB/F,wCAAqC;AAErC,wCAAqC;AAgBrC;;;;;;GAMG;AACH,MAAsB,eAAe;IAOnC,kDAAkD;IAC3C,qBAAqB,CAAC,EAAmB,IAAS,CAAC;IAmB1D,yFAAyF;IAClF,UAAU,CAAC,CAAO;QACvB,OAAO,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC;IACD,yFAAy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;IACxB,mBAAmB,CAAC,EAAiB;QAC1C,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,+BAA+B;IACxB,mBAAmB,CAAC,EAAiB;QAC1C,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,+BAA+B;IACxB,oBAAoB,CAAC,EAAkB;QAC5C,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AArGD,wEAqGC","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 ArraysAndInterfaces\r\n */\r\n\r\nimport { AkimaCurve3d } from \"../bspline/AkimaCurve3d\";\r\nimport { BezierCurve3d } from \"../bspline/BezierCurve3d\";\r\nimport { BezierCurve3dH } from \"../bspline/BezierCurve3dH\";\r\nimport { BezierCurveBase } from \"../bspline/BezierCurveBase\";\r\nimport { BSplineCurve3d } from \"../bspline/BSplineCurve\";\r\nimport { BSplineCurve3dH } from \"../bspline/BSplineCurve3dH\";\r\nimport { BSplineSurface3d, BSplineSurface3dH } from \"../bspline/BSplineSurface\";\r\nimport { InterpolationCurve3d } from \"../bspline/InterpolationCurve3d\";\r\nimport { Arc3d } from \"../curve/Arc3d\";\r\nimport { CoordinateXYZ } from \"../curve/CoordinateXYZ\";\r\nimport { CurveChainWithDistanceIndex } from \"../curve/CurveChainWithDistanceIndex\";\r\nimport { BagOfCurves, CurveCollection } from \"../curve/CurveCollection\";\r\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\r\nimport { LineSegment3d } from \"../curve/LineSegment3d\";\r\nimport { LineString3d } from \"../curve/LineString3d\";\r\nimport { Loop } from \"../curve/Loop\";\r\nimport { ParityRegion } from \"../curve/ParityRegion\";\r\nimport { Path } from \"../curve/Path\";\r\nimport { PointString3d } from \"../curve/PointString3d\";\r\nimport { TransitionSpiral3d } from \"../curve/spiral/TransitionSpiral3d\";\r\nimport { UnionRegion } from \"../curve/UnionRegion\";\r\nimport { IndexedPolyface } from \"../polyface/Polyface\";\r\nimport { Box } from \"../solid/Box\";\r\nimport { Cone } from \"../solid/Cone\";\r\nimport { LinearSweep } from \"../solid/LinearSweep\";\r\nimport { RotationalSweep } from \"../solid/RotationalSweep\";\r\nimport { RuledSweep } from \"../solid/RuledSweep\";\r\nimport { Sphere } from \"../solid/Sphere\";\r\nimport { TorusPipe } from \"../solid/TorusPipe\";\r\nimport { Plane3dByOriginAndVectors } from \"./Plane3dByOriginAndVectors\";\r\nimport { Vector2d } from \"./Point2dVector2d\";\r\nimport { Point3d, Vector3d } from \"./Point3dVector3d\";\r\n\r\n/**\r\n * `GeometryHandler` defines the base abstract methods for double-dispatch geometry computation.\r\n * * User code that wants to handle one or all of the commonly known geometry types implements a handler class.\r\n * * User code that does not handle all types is most likely to start with `NullGeometryHandler`, which will provide\r\n * No-action implementations for all types.\r\n * @public\r\n */\r\nexport abstract class GeometryHandler {\r\n /** Handle strongly typed [[LineSegment3d]] */\r\n public abstract handleLineSegment3d(g: LineSegment3d): any;\r\n /** Handle strongly typed [[LineString3d]] */\r\n public abstract handleLineString3d(g: LineString3d): any;\r\n /** Handle strongly typed [[Arc3d]] */\r\n public abstract handleArc3d(g: Arc3d): any;\r\n /** Handle strongly typed [[CurveCollection]] */\r\n public handleCurveCollection(_g: CurveCollection): any { }\r\n /** Handle strongly typed [[BSplineCurve3d]] */\r\n public abstract handleBSplineCurve3d(g: BSplineCurve3d): any;\r\n /** Handle strongly typed [[InterpolationCurve3d]] */\r\n public abstract handleInterpolationCurve3d(g: InterpolationCurve3d): any;\r\n /** Handle strongly typed [[AkimaCurve3d]] */\r\n public abstract handleAkimaCurve3d(g: AkimaCurve3d): any;\r\n /** Handle strongly typed [[BSplineCurve3dH]] */\r\n public abstract handleBSplineCurve3dH(g: BSplineCurve3dH): any;\r\n /** Handle strongly typed [[BSplineSurface3d]] */\r\n public abstract handleBSplineSurface3d(g: BSplineSurface3d): any;\r\n /** Handle strongly typed [[CoordinateXYZ]] */\r\n public abstract handleCoordinateXYZ(g: CoordinateXYZ): any;\r\n /** Handle strongly typed [[BSplineSurface3dH]] */\r\n public abstract handleBSplineSurface3dH(g: BSplineSurface3dH): any;\r\n /** Handle strongly typed [[IndexedPolyface]] */\r\n public abstract handleIndexedPolyface(g: IndexedPolyface): any;\r\n /** handle strongly typed [[TransitionSpiral3d]] */\r\n public abstract handleTransitionSpiral(g: TransitionSpiral3d): any;\r\n /** Handle strongly typed [[Path]] (base class method calls [[handleCurveCollection]]) */\r\n public handlePath(g: Path): any {\r\n return this.handleCurveCollection(g);\r\n }\r\n /** Handle strongly typed [[Loop]] (base class method calls [[handleCurveCollection]]) */\r\n public handleLoop(g: Loop): any {\r\n return this.handleCurveCollection(g);\r\n }\r\n /** Handle strongly typed [[ParityRegion]] (base class method calls [[handleCurveCollection]]) */\r\n public handleParityRegion(g: ParityRegion): any {\r\n return this.handleCurveCollection(g);\r\n }\r\n /** Handle strongly typed [[UnionRegion]] (base class method calls [[handleCurveCollection]]) */\r\n public handleUnionRegion(g: UnionRegion): any {\r\n return this.handleCurveCollection(g);\r\n }\r\n /** Handle strongly typed [[BagOfCurves]] (base class method calls [[handleCurveCollection]]) */\r\n public handleBagOfCurves(g: BagOfCurves): any {\r\n return this.handleCurveCollection(g);\r\n }\r\n /** Handle strongly typed [[CurveChainWithDistanceIndex]] (base class method calls [[handlePath]] or [[handleLoop]]) */\r\n public handleCurveChainWithDistanceIndex(g: CurveChainWithDistanceIndex): any {\r\n if (g.path instanceof Path)\r\n return this.handlePath(g.path);\r\n if (g.path instanceof Loop)\r\n return this.handleLoop(g.path);\r\n return this.handleCurveCollection(g.path);\r\n }\r\n /** Handle strongly typed Sphere */\r\n public abstract handleSphere(g: Sphere): any;\r\n /** Handle strongly typed Cone */\r\n public abstract handleCone(g: Cone): any;\r\n /** Handle strongly typed Box */\r\n public abstract handleBox(g: Box): any;\r\n /** Handle strongly typed TorusPipe */\r\n public abstract handleTorusPipe(g: TorusPipe): any;\r\n /** Handle strongly typed LinearSweep */\r\n public abstract handleLinearSweep(g: LinearSweep): any;\r\n /** Handle strongly typed RotationalSweep */\r\n public abstract handleRotationalSweep(g: RotationalSweep): any;\r\n /** Handle strongly typed RuledSweep */\r\n public abstract handleRuledSweep(g: RuledSweep): any;\r\n /** Handle strongly typed PointString3d */\r\n public abstract handlePointString3d(g: PointString3d): any;\r\n /** Handle strongly typed BezierCurve3d */\r\n public abstract handleBezierCurve3d(g: BezierCurve3d): any;\r\n /** Handle strongly typed BezierCurve3dH */\r\n public abstract handleBezierCurve3dH(g: BezierCurve3dH): any;\r\n}\r\n/**\r\n * `NullGeometryHandler` is a base class for dispatching various geometry types to application specific implementation\r\n * of some service.\r\n * To use:\r\n * * Derive a class from `NullGeometryHandler`\r\n * * Re-implement any or all of the specific `handleXXXX` methods\r\n * * Create a handler instance `myHandler`\r\n * * To send a `GeometryQuery` object `candidateGeometry` through the (fast) dispatch, invoke\r\n * `candidateGeometry.dispatchToHandler (myHandler).\r\n * * The appropriate method or methods will get called with a strongly typed `_g ` value.\r\n * @public\r\n */\r\nexport class NullGeometryHandler extends GeometryHandler {\r\n /** No-action implementation */\r\n public handleLineSegment3d(_g: LineSegment3d): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleLineString3d(_g: LineString3d): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleArc3d(_g: Arc3d): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public override handleCurveCollection(_g: CurveCollection): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public override handleCurveChainWithDistanceIndex(_g: CurveChainWithDistanceIndex): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleBSplineCurve3d(_g: BSplineCurve3d): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleInterpolationCurve3d(_g: InterpolationCurve3d): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleAkimaCurve3d(_g: AkimaCurve3d): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleBSplineCurve3dH(_g: BSplineCurve3dH): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleBSplineSurface3d(_g: BSplineSurface3d): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleCoordinateXYZ(_g: CoordinateXYZ): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleBSplineSurface3dH(_g: BSplineSurface3dH): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleIndexedPolyface(_g: IndexedPolyface): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleTransitionSpiral(_g: TransitionSpiral3d): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public override handlePath(_g: Path): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public override handleLoop(_g: Loop): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public override handleParityRegion(_g: ParityRegion): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public override handleUnionRegion(_g: UnionRegion): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public override handleBagOfCurves(_g: BagOfCurves): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleSphere(_g: Sphere): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleCone(_g: Cone): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleBox(_g: Box): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleTorusPipe(_g: TorusPipe): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleLinearSweep(_g: LinearSweep): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleRotationalSweep(_g: RotationalSweep): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleRuledSweep(_g: RuledSweep): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handlePointString3d(_g: PointString3d): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleBezierCurve3d(_g: BezierCurve3d): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleBezierCurve3dH(_g: BezierCurve3dH): any {\r\n return undefined;\r\n }\r\n}\r\n/**\r\n * Implement GeometryHandler methods, but override `handleCurveCollection` so that all methods\r\n * that operate on a [[CurveCollection]] recurse to their children.\r\n * @public\r\n */\r\nexport class RecurseToCurvesGeometryHandler extends GeometryHandler {\r\n /** No-action implementation */\r\n public handleLineSegment3d(_g: LineSegment3d): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleLineString3d(_g: LineString3d): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleArc3d(_g: Arc3d): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleBSplineCurve3d(_g: BSplineCurve3d): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleInterpolationCurve3d(_g: InterpolationCurve3d): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleAkimaCurve3d(_g: AkimaCurve3d): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleBSplineCurve3dH(_g: BSplineCurve3dH): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleBSplineSurface3d(_g: BSplineSurface3d): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleCoordinateXYZ(_g: CoordinateXYZ): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleBSplineSurface3dH(_g: BSplineSurface3dH): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleIndexedPolyface(_g: IndexedPolyface): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleTransitionSpiral(_g: TransitionSpiral3d): any {\r\n return undefined;\r\n }\r\n /** Invoke `child.dispatchToGeometryHandler(this)` for each child in the array returned by the query `g.children` */\r\n public handleChildren(g: GeometryQuery): any {\r\n const children = g.children;\r\n if (children)\r\n for (const child of children) {\r\n child.dispatchToGeometryHandler(this);\r\n }\r\n }\r\n /** Recurse to children */\r\n public override handleCurveCollection(g: CurveCollection): any {\r\n return this.handleChildren(g);\r\n }\r\n /** No-action implementation */\r\n public handleSphere(_g: Sphere): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleCone(_g: Cone): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleBox(_g: Box): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleTorusPipe(_g: TorusPipe): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleLinearSweep(_g: LinearSweep): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleRotationalSweep(_g: RotationalSweep): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleRuledSweep(_g: RuledSweep): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handlePointString3d(_g: PointString3d): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleBezierCurve3d(_g: BezierCurve3d): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleBezierCurve3dH(_g: BezierCurve3dH): any {\r\n return undefined;\r\n }\r\n}\r\n\r\n/**\r\n * IStrokeHandler is an interface with methods to receive data about curves being stroked.\r\n * CurvePrimitives emitStrokes () methods emit calls to a handler object with these methods.\r\n * The various CurvePrimitive types are free to announce either single points (announcePoint), linear fragments,\r\n * or fractional intervals of the parent curve.\r\n * * handler.startCurvePrimitive (cp) -- announce the curve primitive whose strokes will follow.\r\n * * announcePointTangent (xyz, fraction, tangent) -- announce a single point on the curve.\r\n * * announceIntervalForUniformStepStrokes (cp, numStrokes, fraction0, fraction1) -- announce a fraction\r\n * interval in which the curve can be evaluated (e.g. the handler can call cp->fractionToPointAndDerivative ())\r\n * * announceSegmentInterval (cp, point0, point1, numStrokes, fraction0, fraction1) -- announce\r\n * that the fractional interval fraction0, fraction1 is a straight line which should be broken into\r\n * numStrokes strokes.\r\n * * A LineSegment would make a single call to this.\r\n * * A LineString would make one call to this for each of its segments, with fractions indicating position\r\n * within the linestring.\r\n * * endCurvePrimitive (cp) -- announce the end of the curve primitive.\r\n * @public\r\n */\r\nexport interface IStrokeHandler {\r\n /**\r\n * Announce a parent curve primitive\r\n * * startParentCurvePrimitive() ...endParentCurvePrimitive() are wrapped around startCurvePrimitive and\r\n * endCurvePrimitive when the interior primitive is a proxy.\r\n */\r\n startParentCurvePrimitive(cp: CurvePrimitive): void;\r\n /** Announce the curve primitive that will be described in subsequent calls. */\r\n startCurvePrimitive(cp: CurvePrimitive): void;\r\n /**\r\n * Announce a single point with its fraction and tangent.\r\n * * (IMPORTANT) the same Point3d and Vector3d will be reset and passed on multiple calls.\r\n * * (THEREFORE) if the implementation is saving coordinates, it must copy the xyz data out into its own data\r\n * structure rather than save the references.\r\n */\r\n announcePointTangent(xyz: Point3d, fraction: number, tangent: Vector3d): void;\r\n\r\n /**\r\n * Announce that curve primitive cp should be evaluated in the specified fraction interval.\r\n * * Note that this method is permitted (expected) to provide pre-stroked data if available.\r\n * * In th pre-stroked case, the cp passed to the handler will be the stroked image, not the original.\r\n * * Callers that want summary data should implement (and return true from) needPrimaryDataForStrokes\r\n */\r\n announceIntervalForUniformStepStrokes(\r\n cp: CurvePrimitive, numStrokes: number, fraction0: number, fraction1: number,\r\n ): void;\r\n /**\r\n * OPTIONAL method for a handler to indicate that it wants primary geometry (e.g. spirals) rather than strokes.\r\n * @returns true if primary geometry should be passed (rather than stroked or otherwise simplified)\r\n */\r\n needPrimaryGeometryForStrokes?(): boolean;\r\n /** Announce numPoints interpolated between point0 and point1, with associated fractions */\r\n announceSegmentInterval(\r\n cp: CurvePrimitive, point0: Point3d, point1: Point3d, numStrokes: number, fraction0: number, fraction1: number,\r\n ): void;\r\n /** Announce that all data about `cp` has been announced. */\r\n endCurvePrimitive(cp: CurvePrimitive): void;\r\n /** Announce that all data about the parent primitive has been announced. */\r\n endParentCurvePrimitive(cp: CurvePrimitive): void;\r\n /**\r\n * Announce a bezier curve fragment.\r\n * * this is usually a section of BsplineCurve\r\n * * If this function is missing, the same interval will be passed to announceIntervalForUniformSteps.\r\n * @param bezier bezier fragment\r\n * @param numStrokes suggested number of strokes (uniform in bezier interval 0..1)\r\n * @param parent parent curve\r\n * @param spanIndex spanIndex within parent\r\n * @param fraction0 start fraction on parent curve\r\n * @param fraction1 end fraction on parent curve\r\n */\r\n announceBezierCurve?(\r\n bezier: BezierCurveBase,\r\n numStrokes: number,\r\n parent: CurvePrimitive,\r\n spandex: number,\r\n fraction0: number,\r\n fraction1: number,\r\n ): void;\r\n}\r\n\r\n/**\r\n * Interface with methods for mapping (u,v) fractional coordinates to surface xyz and derivatives.\r\n * @public\r\n */\r\nexport interface UVSurface {\r\n /**\r\n * Convert fractional u and v coordinates to surface point.\r\n * @param uFraction fractional coordinate in u direction\r\n * @param vFraction fractional coordinate in v direction\r\n * @param result optional pre-allocated point\r\n */\r\n uvFractionToPoint(uFraction: number, vFraction: number, result?: Point3d): Point3d;\r\n /**\r\n * Convert fractional u and v coordinates to surface point and in-surface tangent directions.\r\n * * The vectors are expected to be non-zero tangents which can be crossed to get a normal.\r\n * * Hence they are not necessarily (a) partial derivatives or (b) Frenet vectors.\r\n * @param uFraction fractional coordinate in u direction\r\n * @param vFraction fractional coordinate in v direction\r\n * @param result optional pre-allocated carrier for point and vectors\r\n */\r\n uvFractionToPointAndTangents(\r\n uFraction: number, vFraction: number, result?: Plane3dByOriginAndVectors,\r\n ): Plane3dByOriginAndVectors;\r\n}\r\n/**\r\n * Interface for queries of distance-along in u and v directions\r\n * @public\r\n */\r\nexport interface UVSurfaceIsoParametricDistance {\r\n /**\r\n * * Return a vector whose x and y parts are \"size\" of the surface in the u and v directions.\r\n * * Sizes are use for applying scaling to mesh parameters\r\n * * These sizes are (reasonable approximations of) the max curve length along u and v isoparameter lines.\r\n * * e.g. for a sphere, these are:\r\n * * u direction = distance around the equator\r\n * * v direction = distance from south pole to north pole.\r\n */\r\n maxIsoParametricDistance(): Vector2d;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"GeometryHandler.js","sourceRoot":"","sources":["../../../src/geometry3d/GeometryHandler.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAwC/F;;;;;;GAMG;AACH,MAAsB,eAAe;IAOnC,kDAAkD;IAC3C,qBAAqB,CAAC,EAAmB,IAAS,CAAC;IAmB1D,yFAAyF;IAClF,UAAU,CAAC,CAAO;QACvB,OAAO,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC;IACD,yFAAyF;IAClF,UAAU,CAAC,CAAO;QACvB,OAAO,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC;IACD,iGAAiG;IAC1F,kBAAkB,CAAC,CAAe;QACvC,OAAO,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC;IACD,gGAAgG;IACzF,iBAAiB,CAAC,CAAc;QACrC,OAAO,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC;IACD,gGAAgG;IACzF,iBAAiB,CAAC,CAAc;QACrC,OAAO,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC;IACD,uHAAuH;IAChH,iCAAiC,CAAC,CAA8B;QACrE,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;CAqBH;AAvED,0CAuEC;AACD;;;;;;;;;;;GAWG;AACH,MAAa,mBAAoB,SAAQ,eAAe;IACtD,+BAA+B;IACxB,mBAAmB,CAAC,EAAiB;QAC1C,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,+BAA+B;IACxB,kBAAkB,CAAC,EAAgB;QACxC,OAAO,SAAS,CAAC;IACnB,CAAC;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+BAA+B;IACxB,iBAAiB,CAAC,EAAe;QACtC,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,+BAA+B;IACxB,qBAAqB,CAAC,EAAmB;QAC9C,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,+BAA+B;IACxB,gBAAgB,CAAC,EAAc;QACpC,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,+BAA+B;IACxB,mBAAmB,CAAC,EAAiB;QAC1C,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,+BAA+B;IACxB,mBAAmB,CAAC,EAAiB;QAC1C,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,+BAA+B;IACxB,oBAAoB,CAAC,EAAkB;QAC5C,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AArGD,wEAqGC","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 ArraysAndInterfaces\r\n */\r\n\r\nimport { AkimaCurve3d } from \"../bspline/AkimaCurve3d\";\r\nimport { BezierCurve3d } from \"../bspline/BezierCurve3d\";\r\nimport { BezierCurve3dH } from \"../bspline/BezierCurve3dH\";\r\nimport { BezierCurveBase } from \"../bspline/BezierCurveBase\";\r\nimport { BSplineCurve3d } from \"../bspline/BSplineCurve\";\r\nimport { BSplineCurve3dH } from \"../bspline/BSplineCurve3dH\";\r\nimport { BSplineSurface3d, BSplineSurface3dH } from \"../bspline/BSplineSurface\";\r\nimport { InterpolationCurve3d } from \"../bspline/InterpolationCurve3d\";\r\nimport { Arc3d } from \"../curve/Arc3d\";\r\nimport { CoordinateXYZ } from \"../curve/CoordinateXYZ\";\r\nimport { CurveChainWithDistanceIndex } from \"../curve/CurveChainWithDistanceIndex\";\r\nimport { BagOfCurves, CurveCollection } from \"../curve/CurveCollection\";\r\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\r\nimport { LineSegment3d } from \"../curve/LineSegment3d\";\r\nimport { LineString3d } from \"../curve/LineString3d\";\r\nimport { Loop } from \"../curve/Loop\";\r\nimport { ParityRegion } from \"../curve/ParityRegion\";\r\nimport { Path } from \"../curve/Path\";\r\nimport { PointString3d } from \"../curve/PointString3d\";\r\nimport { TransitionSpiral3d } from \"../curve/spiral/TransitionSpiral3d\";\r\nimport { UnionRegion } from \"../curve/UnionRegion\";\r\nimport { IndexedPolyface } from \"../polyface/Polyface\";\r\nimport { Box } from \"../solid/Box\";\r\nimport { Cone } from \"../solid/Cone\";\r\nimport { LinearSweep } from \"../solid/LinearSweep\";\r\nimport { RotationalSweep } from \"../solid/RotationalSweep\";\r\nimport { RuledSweep } from \"../solid/RuledSweep\";\r\nimport { Sphere } from \"../solid/Sphere\";\r\nimport { TorusPipe } from \"../solid/TorusPipe\";\r\nimport { Plane3dByOriginAndVectors } from \"./Plane3dByOriginAndVectors\";\r\nimport { Vector2d } from \"./Point2dVector2d\";\r\nimport { Point3d, Vector3d } from \"./Point3dVector3d\";\r\n\r\n/**\r\n * `GeometryHandler` defines the base abstract methods for double-dispatch geometry computation.\r\n * * User code that wants to handle one or all of the commonly known geometry types implements a handler class.\r\n * * User code that does not handle all types is most likely to start with `NullGeometryHandler`, which will provide\r\n * No-action implementations for all types.\r\n * @public\r\n */\r\nexport abstract class GeometryHandler {\r\n /** Handle strongly typed [[LineSegment3d]] */\r\n public abstract handleLineSegment3d(g: LineSegment3d): any;\r\n /** Handle strongly typed [[LineString3d]] */\r\n public abstract handleLineString3d(g: LineString3d): any;\r\n /** Handle strongly typed [[Arc3d]] */\r\n public abstract handleArc3d(g: Arc3d): any;\r\n /** Handle strongly typed [[CurveCollection]] */\r\n public handleCurveCollection(_g: CurveCollection): any { }\r\n /** Handle strongly typed [[BSplineCurve3d]] */\r\n public abstract handleBSplineCurve3d(g: BSplineCurve3d): any;\r\n /** Handle strongly typed [[InterpolationCurve3d]] */\r\n public abstract handleInterpolationCurve3d(g: InterpolationCurve3d): any;\r\n /** Handle strongly typed [[AkimaCurve3d]] */\r\n public abstract handleAkimaCurve3d(g: AkimaCurve3d): any;\r\n /** Handle strongly typed [[BSplineCurve3dH]] */\r\n public abstract handleBSplineCurve3dH(g: BSplineCurve3dH): any;\r\n /** Handle strongly typed [[BSplineSurface3d]] */\r\n public abstract handleBSplineSurface3d(g: BSplineSurface3d): any;\r\n /** Handle strongly typed [[CoordinateXYZ]] */\r\n public abstract handleCoordinateXYZ(g: CoordinateXYZ): any;\r\n /** Handle strongly typed [[BSplineSurface3dH]] */\r\n public abstract handleBSplineSurface3dH(g: BSplineSurface3dH): any;\r\n /** Handle strongly typed [[IndexedPolyface]] */\r\n public abstract handleIndexedPolyface(g: IndexedPolyface): any;\r\n /** handle strongly typed [[TransitionSpiral3d]] */\r\n public abstract handleTransitionSpiral(g: TransitionSpiral3d): any;\r\n /** Handle strongly typed [[Path]] (base class method calls [[handleCurveCollection]]) */\r\n public handlePath(g: Path): any {\r\n return this.handleCurveCollection(g);\r\n }\r\n /** Handle strongly typed [[Loop]] (base class method calls [[handleCurveCollection]]) */\r\n public handleLoop(g: Loop): any {\r\n return this.handleCurveCollection(g);\r\n }\r\n /** Handle strongly typed [[ParityRegion]] (base class method calls [[handleCurveCollection]]) */\r\n public handleParityRegion(g: ParityRegion): any {\r\n return this.handleCurveCollection(g);\r\n }\r\n /** Handle strongly typed [[UnionRegion]] (base class method calls [[handleCurveCollection]]) */\r\n public handleUnionRegion(g: UnionRegion): any {\r\n return this.handleCurveCollection(g);\r\n }\r\n /** Handle strongly typed [[BagOfCurves]] (base class method calls [[handleCurveCollection]]) */\r\n public handleBagOfCurves(g: BagOfCurves): any {\r\n return this.handleCurveCollection(g);\r\n }\r\n /** Handle strongly typed [[CurveChainWithDistanceIndex]] (base class method calls [[handlePath]] or [[handleLoop]]) */\r\n public handleCurveChainWithDistanceIndex(g: CurveChainWithDistanceIndex): any {\r\n return this.handlePath(g.path);\r\n }\r\n /** Handle strongly typed Sphere */\r\n public abstract handleSphere(g: Sphere): any;\r\n /** Handle strongly typed Cone */\r\n public abstract handleCone(g: Cone): any;\r\n /** Handle strongly typed Box */\r\n public abstract handleBox(g: Box): any;\r\n /** Handle strongly typed TorusPipe */\r\n public abstract handleTorusPipe(g: TorusPipe): any;\r\n /** Handle strongly typed LinearSweep */\r\n public abstract handleLinearSweep(g: LinearSweep): any;\r\n /** Handle strongly typed RotationalSweep */\r\n public abstract handleRotationalSweep(g: RotationalSweep): any;\r\n /** Handle strongly typed RuledSweep */\r\n public abstract handleRuledSweep(g: RuledSweep): any;\r\n /** Handle strongly typed PointString3d */\r\n public abstract handlePointString3d(g: PointString3d): any;\r\n /** Handle strongly typed BezierCurve3d */\r\n public abstract handleBezierCurve3d(g: BezierCurve3d): any;\r\n /** Handle strongly typed BezierCurve3dH */\r\n public abstract handleBezierCurve3dH(g: BezierCurve3dH): any;\r\n}\r\n/**\r\n * `NullGeometryHandler` is a base class for dispatching various geometry types to application specific implementation\r\n * of some service.\r\n * To use:\r\n * * Derive a class from `NullGeometryHandler`\r\n * * Re-implement any or all of the specific `handleXXXX` methods\r\n * * Create a handler instance `myHandler`\r\n * * To send a `GeometryQuery` object `candidateGeometry` through the (fast) dispatch, invoke\r\n * `candidateGeometry.dispatchToHandler (myHandler).\r\n * * The appropriate method or methods will get called with a strongly typed `_g ` value.\r\n * @public\r\n */\r\nexport class NullGeometryHandler extends GeometryHandler {\r\n /** No-action implementation */\r\n public handleLineSegment3d(_g: LineSegment3d): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleLineString3d(_g: LineString3d): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleArc3d(_g: Arc3d): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public override handleCurveCollection(_g: CurveCollection): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public override handleCurveChainWithDistanceIndex(_g: CurveChainWithDistanceIndex): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleBSplineCurve3d(_g: BSplineCurve3d): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleInterpolationCurve3d(_g: InterpolationCurve3d): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleAkimaCurve3d(_g: AkimaCurve3d): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleBSplineCurve3dH(_g: BSplineCurve3dH): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleBSplineSurface3d(_g: BSplineSurface3d): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleCoordinateXYZ(_g: CoordinateXYZ): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleBSplineSurface3dH(_g: BSplineSurface3dH): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleIndexedPolyface(_g: IndexedPolyface): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleTransitionSpiral(_g: TransitionSpiral3d): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public override handlePath(_g: Path): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public override handleLoop(_g: Loop): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public override handleParityRegion(_g: ParityRegion): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public override handleUnionRegion(_g: UnionRegion): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public override handleBagOfCurves(_g: BagOfCurves): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleSphere(_g: Sphere): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleCone(_g: Cone): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleBox(_g: Box): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleTorusPipe(_g: TorusPipe): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleLinearSweep(_g: LinearSweep): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleRotationalSweep(_g: RotationalSweep): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleRuledSweep(_g: RuledSweep): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handlePointString3d(_g: PointString3d): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleBezierCurve3d(_g: BezierCurve3d): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleBezierCurve3dH(_g: BezierCurve3dH): any {\r\n return undefined;\r\n }\r\n}\r\n/**\r\n * Implement GeometryHandler methods, but override `handleCurveCollection` so that all methods\r\n * that operate on a [[CurveCollection]] recurse to their children.\r\n * @public\r\n */\r\nexport class RecurseToCurvesGeometryHandler extends GeometryHandler {\r\n /** No-action implementation */\r\n public handleLineSegment3d(_g: LineSegment3d): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleLineString3d(_g: LineString3d): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleArc3d(_g: Arc3d): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleBSplineCurve3d(_g: BSplineCurve3d): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleInterpolationCurve3d(_g: InterpolationCurve3d): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleAkimaCurve3d(_g: AkimaCurve3d): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleBSplineCurve3dH(_g: BSplineCurve3dH): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleBSplineSurface3d(_g: BSplineSurface3d): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleCoordinateXYZ(_g: CoordinateXYZ): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleBSplineSurface3dH(_g: BSplineSurface3dH): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleIndexedPolyface(_g: IndexedPolyface): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleTransitionSpiral(_g: TransitionSpiral3d): any {\r\n return undefined;\r\n }\r\n /** Invoke `child.dispatchToGeometryHandler(this)` for each child in the array returned by the query `g.children` */\r\n public handleChildren(g: GeometryQuery): any {\r\n const children = g.children;\r\n if (children)\r\n for (const child of children) {\r\n child.dispatchToGeometryHandler(this);\r\n }\r\n }\r\n /** Recurse to children */\r\n public override handleCurveCollection(g: CurveCollection): any {\r\n return this.handleChildren(g);\r\n }\r\n /** No-action implementation */\r\n public handleSphere(_g: Sphere): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleCone(_g: Cone): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleBox(_g: Box): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleTorusPipe(_g: TorusPipe): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleLinearSweep(_g: LinearSweep): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleRotationalSweep(_g: RotationalSweep): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleRuledSweep(_g: RuledSweep): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handlePointString3d(_g: PointString3d): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleBezierCurve3d(_g: BezierCurve3d): any {\r\n return undefined;\r\n }\r\n /** No-action implementation */\r\n public handleBezierCurve3dH(_g: BezierCurve3dH): any {\r\n return undefined;\r\n }\r\n}\r\n\r\n/**\r\n * IStrokeHandler is an interface with methods to receive data about curves being stroked.\r\n * CurvePrimitives emitStrokes () methods emit calls to a handler object with these methods.\r\n * The various CurvePrimitive types are free to announce either single points (announcePoint), linear fragments,\r\n * or fractional intervals of the parent curve.\r\n * * handler.startCurvePrimitive (cp) -- announce the curve primitive whose strokes will follow.\r\n * * announcePointTangent (xyz, fraction, tangent) -- announce a single point on the curve.\r\n * * announceIntervalForUniformStepStrokes (cp, numStrokes, fraction0, fraction1) -- announce a fraction\r\n * interval in which the curve can be evaluated (e.g. the handler can call cp->fractionToPointAndDerivative ())\r\n * * announceSegmentInterval (cp, point0, point1, numStrokes, fraction0, fraction1) -- announce\r\n * that the fractional interval fraction0, fraction1 is a straight line which should be broken into\r\n * numStrokes strokes.\r\n * * A LineSegment would make a single call to this.\r\n * * A LineString would make one call to this for each of its segments, with fractions indicating position\r\n * within the linestring.\r\n * * endCurvePrimitive (cp) -- announce the end of the curve primitive.\r\n * @public\r\n */\r\nexport interface IStrokeHandler {\r\n /**\r\n * Announce a parent curve primitive\r\n * * startParentCurvePrimitive() ...endParentCurvePrimitive() are wrapped around startCurvePrimitive and\r\n * endCurvePrimitive when the interior primitive is a proxy.\r\n */\r\n startParentCurvePrimitive(cp: CurvePrimitive): void;\r\n /** Announce the curve primitive that will be described in subsequent calls. */\r\n startCurvePrimitive(cp: CurvePrimitive): void;\r\n /**\r\n * Announce a single point with its fraction and tangent.\r\n * * (IMPORTANT) the same Point3d and Vector3d will be reset and passed on multiple calls.\r\n * * (THEREFORE) if the implementation is saving coordinates, it must copy the xyz data out into its own data\r\n * structure rather than save the references.\r\n */\r\n announcePointTangent(xyz: Point3d, fraction: number, tangent: Vector3d): void;\r\n\r\n /**\r\n * Announce that curve primitive cp should be evaluated in the specified fraction interval.\r\n * * Note that this method is permitted (expected) to provide pre-stroked data if available.\r\n * * In th pre-stroked case, the cp passed to the handler will be the stroked image, not the original.\r\n * * Callers that want summary data should implement (and return true from) needPrimaryDataForStrokes\r\n */\r\n announceIntervalForUniformStepStrokes(\r\n cp: CurvePrimitive, numStrokes: number, fraction0: number, fraction1: number,\r\n ): void;\r\n /**\r\n * OPTIONAL method for a handler to indicate that it wants primary geometry (e.g. spirals) rather than strokes.\r\n * @returns true if primary geometry should be passed (rather than stroked or otherwise simplified)\r\n */\r\n needPrimaryGeometryForStrokes?(): boolean;\r\n /** Announce numPoints interpolated between point0 and point1, with associated fractions */\r\n announceSegmentInterval(\r\n cp: CurvePrimitive, point0: Point3d, point1: Point3d, numStrokes: number, fraction0: number, fraction1: number,\r\n ): void;\r\n /** Announce that all data about `cp` has been announced. */\r\n endCurvePrimitive(cp: CurvePrimitive): void;\r\n /** Announce that all data about the parent primitive has been announced. */\r\n endParentCurvePrimitive(cp: CurvePrimitive): void;\r\n /**\r\n * Announce a bezier curve fragment.\r\n * * this is usually a section of BsplineCurve\r\n * * If this function is missing, the same interval will be passed to announceIntervalForUniformSteps.\r\n * @param bezier bezier fragment\r\n * @param numStrokes suggested number of strokes (uniform in bezier interval 0..1)\r\n * @param parent parent curve\r\n * @param spanIndex spanIndex within parent\r\n * @param fraction0 start fraction on parent curve\r\n * @param fraction1 end fraction on parent curve\r\n */\r\n announceBezierCurve?(\r\n bezier: BezierCurveBase,\r\n numStrokes: number,\r\n parent: CurvePrimitive,\r\n spandex: number,\r\n fraction0: number,\r\n fraction1: number,\r\n ): void;\r\n}\r\n\r\n/**\r\n * Interface with methods for mapping (u,v) fractional coordinates to surface xyz and derivatives.\r\n * @public\r\n */\r\nexport interface UVSurface {\r\n /**\r\n * Convert fractional u and v coordinates to surface point.\r\n * @param uFraction fractional coordinate in u direction\r\n * @param vFraction fractional coordinate in v direction\r\n * @param result optional pre-allocated point\r\n */\r\n uvFractionToPoint(uFraction: number, vFraction: number, result?: Point3d): Point3d;\r\n /**\r\n * Convert fractional u and v coordinates to surface point and in-surface tangent directions.\r\n * * The vectors are expected to be non-zero tangents which can be crossed to get a normal.\r\n * * Hence they are not necessarily (a) partial derivatives or (b) Frenet vectors.\r\n * @param uFraction fractional coordinate in u direction\r\n * @param vFraction fractional coordinate in v direction\r\n * @param result optional pre-allocated carrier for point and vectors\r\n */\r\n uvFractionToPointAndTangents(\r\n uFraction: number, vFraction: number, result?: Plane3dByOriginAndVectors,\r\n ): Plane3dByOriginAndVectors;\r\n}\r\n/**\r\n * Interface for queries of distance-along in u and v directions\r\n * @public\r\n */\r\nexport interface UVSurfaceIsoParametricDistance {\r\n /**\r\n * * Return a vector whose x and y parts are \"size\" of the surface in the u and v directions.\r\n * * Sizes are use for applying scaling to mesh parameters\r\n * * These sizes are (reasonable approximations of) the max curve length along u and v isoparameter lines.\r\n * * e.g. for a sphere, these are:\r\n * * u direction = distance around the equator\r\n * * v direction = distance from south pole to north pole.\r\n */\r\n maxIsoParametricDistance(): Vector2d;\r\n}\r\n"]}
|
|
@@ -76,6 +76,6 @@ export declare class PolylineCompressionContext {
|
|
|
76
76
|
* @param points
|
|
77
77
|
* @param perpendicularDistance
|
|
78
78
|
*/
|
|
79
|
-
static compressColinearWrapInPlace(points: Point3d[],
|
|
79
|
+
static compressColinearWrapInPlace(points: Point3d[], duplicatePointTolerance: number, colinearPointTolerance: number): void;
|
|
80
80
|
}
|
|
81
81
|
//# sourceMappingURL=PolylineCompressionByEdgeOffset.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PolylineCompressionByEdgeOffset.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/PolylineCompressionByEdgeOffset.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,6BAA6B,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE7F,OAAO,EAAE,OAAO,EAAY,MAAM,mBAAmB,CAAC;AAGtD;;GAEG;AACH,qBAAa,0BAA0B;IACrC;;OAEG;IACH,OAAO;IAKP,OAAO,CAAC,OAAO,CAAuB;IAEtC,OAAO,CAAC,KAAK,CAAgC;IAE7C,yCAAyC;IACzC,OAAO,CAAC,iBAAiB,CAAS;IAClC;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAK1B,2CAA2C;IAC3C,OAAO,CAAC,MAAM,CAAC,SAAS,CAA+B;IACvD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA+B;IACtD;;;;;OAKG;IACH,OAAO,CAAC,sB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QAAQ,CAA+B;IACtD;;;;;OAKG;IACH,OAAO,CAAC,sBAAsB;IAkB9B;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;IA+B3B;;;;;;OAMG;IAGH,OAAO,CAAC,+BAA+B;IAcvC;;;;;OAKG;WACW,gCAAgC,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,EAAE;IAMpG;;;;;;;;OAQG;WACW,8BAA8B,CAAC,MAAM,EAAE,oBAAoB,EAAE,IAAI,EAAE,6BAA6B,EAAE,cAAc,EAAE,MAAM;IAuBtI;;OAEG;WACW,gCAAgC,CAAC,IAAI,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM;IA6BzF;;OAEG;WACW,kCAAkC,CAAC,IAAI,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM;IAgB7F;;OAEG;WACW,sCAAsC,CAAC,IAAI,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,EAAE,oBAAoB,SAAS;IAiCzI;;;;;OAKG;WACW,2BAA2B,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,uBAAuB,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM;CAqB7H"}
|
|
@@ -249,9 +249,9 @@ class PolylineCompressionContext {
|
|
|
249
249
|
* @param points
|
|
250
250
|
* @param perpendicularDistance
|
|
251
251
|
*/
|
|
252
|
-
static compressColinearWrapInPlace(points,
|
|
252
|
+
static compressColinearWrapInPlace(points, duplicatePointTolerance, colinearPointTolerance) {
|
|
253
253
|
const lastIndex = points.length - 1;
|
|
254
|
-
if (lastIndex >= 3 && points[0].distance(points[lastIndex]) <
|
|
254
|
+
if (lastIndex >= 3 && points[0].distance(points[lastIndex]) < duplicatePointTolerance) {
|
|
255
255
|
// indices of 3 points potentially colinear.
|
|
256
256
|
const indexA = lastIndex - 1;
|
|
257
257
|
const indexB = 0;
|
|
@@ -263,7 +263,7 @@ class PolylineCompressionContext {
|
|
|
263
263
|
const fraction = Geometry_1.Geometry.conditionalDivideFraction(uDotV, uDotU);
|
|
264
264
|
if (fraction !== undefined && fraction > 0.0 && fraction < 1.0) {
|
|
265
265
|
const h2 = vectorV.magnitudeSquared() - fraction * fraction * uDotU;
|
|
266
|
-
if (Math.sqrt(Math.abs(h2)) <
|
|
266
|
+
if (Math.sqrt(Math.abs(h2)) < colinearPointTolerance) {
|
|
267
267
|
points[0] = points[indexA];
|
|
268
268
|
points.pop();
|
|
269
269
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PolylineCompressionByEdgeOffset.js","sourceRoot":"","sources":["../../../src/geometry3d/PolylineCompressionByEdgeOffset.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,0CAAuC;AAGvC,+DAA4D;AAC5D,uDAAsD;AAEtD,sBAAsB;AACtB;;GAEG;AACH,MAAa,0BAA0B;IACrC;;OAEG;IACH,YAAoB,MAA4B,EAAE,IAAmC,EAAE,SAAiB;QACtG,IAAI,CAAC,iBAAiB,GAAG,SAAS,GAAG,SAAS,CAAC;QAC/C,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAOD;;OAEG;IACK,kBAAkB,CAAC,CAAS;QAClC,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,6BAA6B,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;QACtF,IAAI,KAAK;YACP,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IAID;;;;;OAKG;IACK,sBAAsB,CAAC,MAAc,EAAE,MAAc;QAC3D,IAAI,IAAI,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,CAAC;QACN,IAAI,QAA4B,CAAC;QACjC,KAAK,IAAI,KAAK,GAAG,MAAM,EAAE,KAAK,IAAI,MAAM,EAAE,KAAK,EAAE,EAAE,CA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AG,QAAQ,GAAG,KAAK,CAAC;gBACpE,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS,EAAE,CAAC;oBACxC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;oBAC3B,MAAM,CAAC,GAAG,EAAE,CAAC;gBACf,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;;AA1QH,gEA2QC;AApPC,2CAA2C;AAC5B,oCAAS,GAAa,0BAAQ,CAAC,MAAM,EAAE,CAAC;AACxC,mCAAQ,GAAa,0BAAQ,CAAC,MAAM,EAAE,CAAC","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\nimport { Geometry } from \"../Geometry\";\r\nimport { GrowableXYZArray } from \"./GrowableXYZArray\";\r\nimport { IndexedReadWriteXYZCollection, IndexedXYZCollection } from \"./IndexedXYZCollection\";\r\nimport { Point3dArrayCarrier } from \"./Point3dArrayCarrier\";\r\nimport { Point3d, Vector3d } from \"./Point3dVector3d\";\r\n\r\n// cspell:word Puecker\r\n/** context class for Puecker-Douglas polyline compression, viz https://en.wikipedia.org/wiki/Ramer–Douglas–Peucker_algorithm\r\n * @internal\r\n */\r\nexport class PolylineCompressionContext {\r\n /** Caller provides source and tolerance.\r\n * * pointer to source is retained, but contents of source are never modified.\r\n */\r\n private constructor(source: IndexedXYZCollection, dest: IndexedReadWriteXYZCollection, tolerance: number) {\r\n this._toleranceSquared = tolerance * tolerance;\r\n this._source = source;\r\n this._dest = dest;\r\n }\r\n private _source: IndexedXYZCollection;\r\n\r\n private _dest: IndexedReadWriteXYZCollection;\r\n\r\n /** Squared tolerance for equal point. */\r\n private _toleranceSquared: number;\r\n /** push (clone of) the point at index i from the source to the growing result.\r\n * * index is adjusted cyclically to source index range by modulo.\r\n */\r\n private acceptPointByIndex(i: number) {\r\n const point = this._source.getPoint3dAtCheckedPointIndex(this._source.cyclicIndex(i));\r\n if (point)\r\n this._dest.push(point);\r\n }\r\n /** work data used by find max deviation */\r\n private static _vector01: Vector3d = Vector3d.create();\r\n private static _vectorQ: Vector3d = Vector3d.create();\r\n /**\r\n * Return index of max magnitude of cross product of vectors (index to index+1) and (index to index+2)\r\n * * Return undefined if unable to find a nonzero cross product.\r\n * @param i0 first cross product central index.\r\n * @param i1 last cross product central index.\r\n */\r\n private indexOfMaxCrossProduct(index0: number, index1: number): number | undefined {\r\n let qMax = 0.0;\r\n let q;\r\n let indexMax: number | undefined;\r\n for (let index = index0; index <= index1; index++) {\r\n const iA = this._source.cyclicIndex(index);\r\n const iB = this._source.cyclicIndex(index + 1);\r\n const iC = this._source.cyclicIndex(index + 2);\r\n this._source.crossProductIndexIndexIndex(iA, iB, iC, PolylineCompressionContext._vectorQ);\r\n q = PolylineCompressionContext._vectorQ.magnitudeSquared();\r\n if (q > qMax) {\r\n qMax = q;\r\n indexMax = index;\r\n }\r\n }\r\n return indexMax;\r\n }\r\n\r\n /**\r\n * Return interior index where max deviation in excess of tolerance occurs.\r\n * @param i0 first index of interval\r\n * @param i1 INCLUSIVE final index\r\n */\r\n private indexOfMaxDeviation(index0: number, index1: number): number | undefined {\r\n const i0 = this._source.cyclicIndex(index0);\r\n const i1 = this._source.cyclicIndex(index1);\r\n let maxDeviation = this._toleranceSquared;\r\n let maxDeviationIndex;\r\n let numerator;\r\n let distanceSquared;\r\n let s;\r\n let i;\r\n this._source.vectorIndexIndex(i0, i1, PolylineCompressionContext._vector01)!;\r\n const denominator = PolylineCompressionContext._vector01.magnitudeSquared();\r\n for (let index = index0 + 1; index < index1; index++) {\r\n i = this._source.cyclicIndex(index);\r\n this._source.vectorIndexIndex(i0, i, PolylineCompressionContext._vectorQ);\r\n numerator = PolylineCompressionContext._vector01.dotProduct(PolylineCompressionContext._vectorQ);\r\n if (numerator <= 0) {\r\n distanceSquared = PolylineCompressionContext._vectorQ.magnitudeSquared();\r\n } else if (numerator > denominator) {\r\n this._source.vectorIndexIndex(i1, i, PolylineCompressionContext._vectorQ);\r\n distanceSquared = PolylineCompressionContext._vectorQ.magnitudeSquared();\r\n } else {\r\n s = numerator / denominator;\r\n distanceSquared = PolylineCompressionContext._vectorQ.magnitudeSquared() - denominator * s * s;\r\n }\r\n if (distanceSquared > maxDeviation) {\r\n maxDeviation = distanceSquared;\r\n maxDeviationIndex = index;\r\n }\r\n }\r\n return maxDeviationIndex;\r\n }\r\n /**\r\n *\r\n * @param i0 first active point index\r\n * @param i1 last active point index (INCLUSIVE -- not \"one beyond\")\r\n * @param chordTolerance\r\n * @param result\r\n */\r\n // ASSUME index i0 is already saved.\r\n // ASSUME point i\r\n private recursiveCompressByChordErrorGo(i0: number, i1: number) {\r\n if (i1 === i0 + 1) {\r\n this.acceptPointByIndex(i1);\r\n return;\r\n }\r\n const distantPointIndex = this.indexOfMaxDeviation(i0, i1);\r\n if (distantPointIndex === undefined) {\r\n this.acceptPointByIndex(i1); // which compresses out some points.\r\n } else {\r\n this.recursiveCompressByChordErrorGo(i0, distantPointIndex);\r\n this.recursiveCompressByChordErrorGo(distantPointIndex, i1);\r\n }\r\n }\r\n // cspell:word Peucker\r\n /**\r\n * Return a point array with a subset of the input points.\r\n * * This is a global analysis (Douglas-Peucker)\r\n * @param source input points.\r\n * @param chordTolerance Points less than this distance from a retained edge may be ignored.\r\n */\r\n public static compressPoint3dArrayByChordError(source: Point3d[], chordTolerance: number): Point3d[] {\r\n const source1 = new Point3dArrayCarrier(source);\r\n const dest1 = new Point3dArrayCarrier([]);\r\n this.compressCollectionByChordError(source1, dest1, chordTolerance);\r\n return dest1.data;\r\n }\r\n /**\r\n * * Return a polyline with a subset of the input points.\r\n * * This is a global analysis (Douglas-Peucker)\r\n * * Global search for vertices that are close to edges between widely separated neighbors.\r\n * * Recurses to smaller subsets.\r\n * @param source input points\r\n * @param dest output points. Must be different from source.\r\n * @param chordTolerance Points less than this distance from a retained edge may be ignored.\r\n */\r\n public static compressCollectionByChordError(source: IndexedXYZCollection, dest: IndexedReadWriteXYZCollection, chordTolerance: number) {\r\n dest.clear();\r\n const n = source.length;\r\n if (n === 1) {\r\n dest.push(source.getPoint3dAtCheckedPointIndex(0)!);\r\n return;\r\n }\r\n const context = new PolylineCompressionContext(source, dest, chordTolerance);\r\n // Do compression on inclusive interval from indexA to indexB, with indices interpreted cyclically if closed\r\n let indexA = 0;\r\n let indexB = n - 1;\r\n if (n > 2 && source.distanceIndexIndex(0, n - 1)! <= chordTolerance) {\r\n // cyclic data. It is possible that the wrap point itself has to be seen as an internal point.\r\n // do the search from point index where there is a large triangle . ..\r\n const maxCrossProductIndex = context.indexOfMaxCrossProduct(0, n - 1);\r\n if (maxCrossProductIndex !== undefined) {\r\n indexA = maxCrossProductIndex + 1;\r\n indexB = indexA + n;\r\n }\r\n }\r\n context.acceptPointByIndex(indexA);\r\n context.recursiveCompressByChordErrorGo(indexA, indexB);\r\n }\r\n /** Copy points from source to dest, omitting those too close to predecessor.\r\n * * First and last points are always preserved.\r\n */\r\n public static compressInPlaceByShortEdgeLength(data: GrowableXYZArray, edgeLength: number) {\r\n const n = data.length;\r\n if (n < 2)\r\n return;\r\n let lastAcceptedIndex = 0;\r\n // back up from final point ..\r\n let indexB = n - 1;\r\n while (indexB > 0 && data.distanceIndexIndex(indexB - 1, n - 1)! < edgeLength)\r\n indexB--;\r\n if (indexB === 0) {\r\n // Theres only one point there.\r\n data.length = 1;\r\n return;\r\n }\r\n // we want the exact bits of the final point even if others were nearby ..\r\n if (indexB < n - 1)\r\n data.moveIndexToIndex(n - 1, indexB);\r\n let candidateIndex = lastAcceptedIndex + 1;\r\n while (candidateIndex <= indexB) {\r\n const d = data.distanceIndexIndex(lastAcceptedIndex, candidateIndex)!;\r\n if (d >= edgeLength) {\r\n data.moveIndexToIndex(candidateIndex, lastAcceptedIndex + 1);\r\n lastAcceptedIndex++;\r\n }\r\n candidateIndex++;\r\n }\r\n data.length = lastAcceptedIndex + 1;\r\n }\r\n\r\n /** Copy points from source to dest, omitting those too close to predecessor.\r\n * * First and last points are always preserved.\r\n */\r\n public static compressInPlaceBySmallTriangleArea(data: GrowableXYZArray, triangleArea: number) {\r\n const n = data.length;\r\n if (n < 3)\r\n return;\r\n let lastAcceptedIndex = 0;\r\n const cross = Vector3d.create();\r\n for (let i1 = 1; i1 + 1 < n; i1++) {\r\n data.crossProductIndexIndexIndex(lastAcceptedIndex, i1, i1 + 1, cross);\r\n if (0.5 * cross.magnitude() > triangleArea) {\r\n data.moveIndexToIndex(i1, ++lastAcceptedIndex);\r\n }\r\n }\r\n data.moveIndexToIndex(n - 1, ++lastAcceptedIndex);\r\n data.length = lastAcceptedIndex + 1;\r\n }\r\n\r\n /** Copy points from source to dest, omitting those too close to edge between neighbors.\r\n * * First and last points are always preserved.\r\n */\r\n public static compressInPlaceByPerpendicularDistance(data: GrowableXYZArray, perpendicularDistance: number, maxExtensionFraction = 1.0001) {\r\n const n = data.length;\r\n if (n < 3)\r\n return;\r\n let lastAcceptedIndex = 0;\r\n const vector01 = PolylineCompressionContext._vector01;\r\n const vectorQ = PolylineCompressionContext._vectorQ;\r\n let distanceSquared;\r\n const perpendicularDistanceSquared = perpendicularDistance * perpendicularDistance;\r\n let denominator;\r\n let i1 = 1;\r\n for (; i1 + 1 < n; i1++) {\r\n data.vectorIndexIndex(lastAcceptedIndex, i1 + 1, vector01);\r\n data.vectorIndexIndex(lastAcceptedIndex, i1, vectorQ);\r\n denominator = vector01.magnitudeSquared();\r\n const s = Geometry.conditionalDivideFraction(vectorQ.dotProduct(vector01), denominator);\r\n if (s !== undefined) {\r\n if (s >= 0.0 && s <= maxExtensionFraction) {\r\n distanceSquared = PolylineCompressionContext._vectorQ.magnitudeSquared() - denominator * s * s;\r\n if (distanceSquared <= perpendicularDistanceSquared) {\r\n // force accept of point i1+1 .\r\n data.moveIndexToIndex(i1 + 1, ++lastAcceptedIndex);\r\n i1 = i1 + 1;\r\n continue;\r\n }\r\n }\r\n }\r\n data.moveIndexToIndex(i1, ++lastAcceptedIndex);\r\n }\r\n if (i1 < n)\r\n data.moveIndexToIndex(i1, ++lastAcceptedIndex);\r\n data.length = lastAcceptedIndex + 1;\r\n }\r\n /**\r\n * IF the first and last points are close AND first and last segments are colinear, remove first and last points. Prior second to last becomes replicated start and end.\r\n * * Expected to be called \"last\" after other compressions, so points \"next to\" shared first and last are good to keep.\r\n * @param points\r\n * @param perpendicularDistance\r\n */\r\n public static compressColinearWrapInPlace(points: Point3d[], tolerance: number) {\r\n const lastIndex = points.length - 1;\r\n if (lastIndex >= 3 && points[0].distance(points[lastIndex]) < tolerance) {\r\n // indices of 3 points potentially colinear.\r\n const indexA = lastIndex - 1;\r\n const indexB = 0;\r\n const indexC = 1;\r\n const vectorU = Vector3d.createStartEnd(points[indexA], points[indexC]);\r\n const vectorV = Vector3d.createStartEnd(points[indexA], points[indexB]);\r\n const uDotU = vectorU.dotProduct(vectorU);\r\n const uDotV = vectorU.dotProduct(vectorV);\r\n const fraction = Geometry.conditionalDivideFraction(uDotV, uDotU);\r\n if (fraction !== undefined && fraction > 0.0 && fraction < 1.0) {\r\n const h2 = vectorV.magnitudeSquared() - fraction * fraction * uDotU;\r\n if (Math.sqrt(Math.abs(h2)) < tolerance) {\r\n points[0] = points[indexA];\r\n points.pop();\r\n }\r\n }\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"PolylineCompressionByEdgeOffset.js","sourceRoot":"","sources":["../../../src/geometry3d/PolylineCompressionByEdgeOffset.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,0CAAuC;AAGvC,+DAA4D;AAC5D,uDAAsD;AAEtD,sBAAsB;AACtB;;GAEG;AACH,MAAa,0BAA0B;IACrC;;OAEG;IACH,YAAoB,MAA4B,EAAE,IAAmC,EAAE,SAAiB;QACtG,IAAI,CAAC,iBAAiB,GAAG,SAAS,GAA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M,OAAO,GAAG,0BAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;YACxE,MAAM,OAAO,GAAG,0BAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;YACxE,MAAM,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;YAC1C,MAAM,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;YAC1C,MAAM,QAAQ,GAAG,mBAAQ,CAAC,yBAAyB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YAClE,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,GAAG,GAAG,IAAI,QAAQ,GAAG,GAAG,EAAE,CAAC;gBAC/D,MAAM,EAAE,GAAG,OAAO,CAAC,gBAAgB,EAAE,GAAG,QAAQ,GAAG,QAAQ,GAAG,KAAK,CAAC;gBACpE,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,sBAAsB,EAAE,CAAC;oBACrD,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;oBAC3B,MAAM,CAAC,GAAG,EAAE,CAAC;gBACf,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;;AA1QH,gEA2QC;AApPC,2CAA2C;AAC5B,oCAAS,GAAa,0BAAQ,CAAC,MAAM,EAAE,CAAC;AACxC,mCAAQ,GAAa,0BAAQ,CAAC,MAAM,EAAE,CAAC","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\nimport { Geometry } from \"../Geometry\";\r\nimport { GrowableXYZArray } from \"./GrowableXYZArray\";\r\nimport { IndexedReadWriteXYZCollection, IndexedXYZCollection } from \"./IndexedXYZCollection\";\r\nimport { Point3dArrayCarrier } from \"./Point3dArrayCarrier\";\r\nimport { Point3d, Vector3d } from \"./Point3dVector3d\";\r\n\r\n// cspell:word Puecker\r\n/** context class for Puecker-Douglas polyline compression, viz https://en.wikipedia.org/wiki/Ramer–Douglas–Peucker_algorithm\r\n * @internal\r\n */\r\nexport class PolylineCompressionContext {\r\n /** Caller provides source and tolerance.\r\n * * pointer to source is retained, but contents of source are never modified.\r\n */\r\n private constructor(source: IndexedXYZCollection, dest: IndexedReadWriteXYZCollection, tolerance: number) {\r\n this._toleranceSquared = tolerance * tolerance;\r\n this._source = source;\r\n this._dest = dest;\r\n }\r\n private _source: IndexedXYZCollection;\r\n\r\n private _dest: IndexedReadWriteXYZCollection;\r\n\r\n /** Squared tolerance for equal point. */\r\n private _toleranceSquared: number;\r\n /** push (clone of) the point at index i from the source to the growing result.\r\n * * index is adjusted cyclically to source index range by modulo.\r\n */\r\n private acceptPointByIndex(i: number) {\r\n const point = this._source.getPoint3dAtCheckedPointIndex(this._source.cyclicIndex(i));\r\n if (point)\r\n this._dest.push(point);\r\n }\r\n /** work data used by find max deviation */\r\n private static _vector01: Vector3d = Vector3d.create();\r\n private static _vectorQ: Vector3d = Vector3d.create();\r\n /**\r\n * Return index of max magnitude of cross product of vectors (index to index+1) and (index to index+2)\r\n * * Return undefined if unable to find a nonzero cross product.\r\n * @param i0 first cross product central index.\r\n * @param i1 last cross product central index.\r\n */\r\n private indexOfMaxCrossProduct(index0: number, index1: number): number | undefined {\r\n let qMax = 0.0;\r\n let q;\r\n let indexMax: number | undefined;\r\n for (let index = index0; index <= index1; index++) {\r\n const iA = this._source.cyclicIndex(index);\r\n const iB = this._source.cyclicIndex(index + 1);\r\n const iC = this._source.cyclicIndex(index + 2);\r\n this._source.crossProductIndexIndexIndex(iA, iB, iC, PolylineCompressionContext._vectorQ);\r\n q = PolylineCompressionContext._vectorQ.magnitudeSquared();\r\n if (q > qMax) {\r\n qMax = q;\r\n indexMax = index;\r\n }\r\n }\r\n return indexMax;\r\n }\r\n\r\n /**\r\n * Return interior index where max deviation in excess of tolerance occurs.\r\n * @param i0 first index of interval\r\n * @param i1 INCLUSIVE final index\r\n */\r\n private indexOfMaxDeviation(index0: number, index1: number): number | undefined {\r\n const i0 = this._source.cyclicIndex(index0);\r\n const i1 = this._source.cyclicIndex(index1);\r\n let maxDeviation = this._toleranceSquared;\r\n let maxDeviationIndex;\r\n let numerator;\r\n let distanceSquared;\r\n let s;\r\n let i;\r\n this._source.vectorIndexIndex(i0, i1, PolylineCompressionContext._vector01)!;\r\n const denominator = PolylineCompressionContext._vector01.magnitudeSquared();\r\n for (let index = index0 + 1; index < index1; index++) {\r\n i = this._source.cyclicIndex(index);\r\n this._source.vectorIndexIndex(i0, i, PolylineCompressionContext._vectorQ);\r\n numerator = PolylineCompressionContext._vector01.dotProduct(PolylineCompressionContext._vectorQ);\r\n if (numerator <= 0) {\r\n distanceSquared = PolylineCompressionContext._vectorQ.magnitudeSquared();\r\n } else if (numerator > denominator) {\r\n this._source.vectorIndexIndex(i1, i, PolylineCompressionContext._vectorQ);\r\n distanceSquared = PolylineCompressionContext._vectorQ.magnitudeSquared();\r\n } else {\r\n s = numerator / denominator;\r\n distanceSquared = PolylineCompressionContext._vectorQ.magnitudeSquared() - denominator * s * s;\r\n }\r\n if (distanceSquared > maxDeviation) {\r\n maxDeviation = distanceSquared;\r\n maxDeviationIndex = index;\r\n }\r\n }\r\n return maxDeviationIndex;\r\n }\r\n /**\r\n *\r\n * @param i0 first active point index\r\n * @param i1 last active point index (INCLUSIVE -- not \"one beyond\")\r\n * @param chordTolerance\r\n * @param result\r\n */\r\n // ASSUME index i0 is already saved.\r\n // ASSUME point i\r\n private recursiveCompressByChordErrorGo(i0: number, i1: number) {\r\n if (i1 === i0 + 1) {\r\n this.acceptPointByIndex(i1);\r\n return;\r\n }\r\n const distantPointIndex = this.indexOfMaxDeviation(i0, i1);\r\n if (distantPointIndex === undefined) {\r\n this.acceptPointByIndex(i1); // which compresses out some points.\r\n } else {\r\n this.recursiveCompressByChordErrorGo(i0, distantPointIndex);\r\n this.recursiveCompressByChordErrorGo(distantPointIndex, i1);\r\n }\r\n }\r\n // cspell:word Peucker\r\n /**\r\n * Return a point array with a subset of the input points.\r\n * * This is a global analysis (Douglas-Peucker)\r\n * @param source input points.\r\n * @param chordTolerance Points less than this distance from a retained edge may be ignored.\r\n */\r\n public static compressPoint3dArrayByChordError(source: Point3d[], chordTolerance: number): Point3d[] {\r\n const source1 = new Point3dArrayCarrier(source);\r\n const dest1 = new Point3dArrayCarrier([]);\r\n this.compressCollectionByChordError(source1, dest1, chordTolerance);\r\n return dest1.data;\r\n }\r\n /**\r\n * * Return a polyline with a subset of the input points.\r\n * * This is a global analysis (Douglas-Peucker)\r\n * * Global search for vertices that are close to edges between widely separated neighbors.\r\n * * Recurses to smaller subsets.\r\n * @param source input points\r\n * @param dest output points. Must be different from source.\r\n * @param chordTolerance Points less than this distance from a retained edge may be ignored.\r\n */\r\n public static compressCollectionByChordError(source: IndexedXYZCollection, dest: IndexedReadWriteXYZCollection, chordTolerance: number) {\r\n dest.clear();\r\n const n = source.length;\r\n if (n === 1) {\r\n dest.push(source.getPoint3dAtCheckedPointIndex(0)!);\r\n return;\r\n }\r\n const context = new PolylineCompressionContext(source, dest, chordTolerance);\r\n // Do compression on inclusive interval from indexA to indexB, with indices interpreted cyclically if closed\r\n let indexA = 0;\r\n let indexB = n - 1;\r\n if (n > 2 && source.distanceIndexIndex(0, n - 1)! <= chordTolerance) {\r\n // cyclic data. It is possible that the wrap point itself has to be seen as an internal point.\r\n // do the search from point index where there is a large triangle . ..\r\n const maxCrossProductIndex = context.indexOfMaxCrossProduct(0, n - 1);\r\n if (maxCrossProductIndex !== undefined) {\r\n indexA = maxCrossProductIndex + 1;\r\n indexB = indexA + n;\r\n }\r\n }\r\n context.acceptPointByIndex(indexA);\r\n context.recursiveCompressByChordErrorGo(indexA, indexB);\r\n }\r\n /** Copy points from source to dest, omitting those too close to predecessor.\r\n * * First and last points are always preserved.\r\n */\r\n public static compressInPlaceByShortEdgeLength(data: GrowableXYZArray, edgeLength: number) {\r\n const n = data.length;\r\n if (n < 2)\r\n return;\r\n let lastAcceptedIndex = 0;\r\n // back up from final point ..\r\n let indexB = n - 1;\r\n while (indexB > 0 && data.distanceIndexIndex(indexB - 1, n - 1)! < edgeLength)\r\n indexB--;\r\n if (indexB === 0) {\r\n // Theres only one point there.\r\n data.length = 1;\r\n return;\r\n }\r\n // we want the exact bits of the final point even if others were nearby ..\r\n if (indexB < n - 1)\r\n data.moveIndexToIndex(n - 1, indexB);\r\n let candidateIndex = lastAcceptedIndex + 1;\r\n while (candidateIndex <= indexB) {\r\n const d = data.distanceIndexIndex(lastAcceptedIndex, candidateIndex)!;\r\n if (d >= edgeLength) {\r\n data.moveIndexToIndex(candidateIndex, lastAcceptedIndex + 1);\r\n lastAcceptedIndex++;\r\n }\r\n candidateIndex++;\r\n }\r\n data.length = lastAcceptedIndex + 1;\r\n }\r\n\r\n /** Copy points from source to dest, omitting those too close to predecessor.\r\n * * First and last points are always preserved.\r\n */\r\n public static compressInPlaceBySmallTriangleArea(data: GrowableXYZArray, triangleArea: number) {\r\n const n = data.length;\r\n if (n < 3)\r\n return;\r\n let lastAcceptedIndex = 0;\r\n const cross = Vector3d.create();\r\n for (let i1 = 1; i1 + 1 < n; i1++) {\r\n data.crossProductIndexIndexIndex(lastAcceptedIndex, i1, i1 + 1, cross);\r\n if (0.5 * cross.magnitude() > triangleArea) {\r\n data.moveIndexToIndex(i1, ++lastAcceptedIndex);\r\n }\r\n }\r\n data.moveIndexToIndex(n - 1, ++lastAcceptedIndex);\r\n data.length = lastAcceptedIndex + 1;\r\n }\r\n\r\n /** Copy points from source to dest, omitting those too close to edge between neighbors.\r\n * * First and last points are always preserved.\r\n */\r\n public static compressInPlaceByPerpendicularDistance(data: GrowableXYZArray, perpendicularDistance: number, maxExtensionFraction = 1.0001) {\r\n const n = data.length;\r\n if (n < 3)\r\n return;\r\n let lastAcceptedIndex = 0;\r\n const vector01 = PolylineCompressionContext._vector01;\r\n const vectorQ = PolylineCompressionContext._vectorQ;\r\n let distanceSquared;\r\n const perpendicularDistanceSquared = perpendicularDistance * perpendicularDistance;\r\n let denominator;\r\n let i1 = 1;\r\n for (; i1 + 1 < n; i1++) {\r\n data.vectorIndexIndex(lastAcceptedIndex, i1 + 1, vector01);\r\n data.vectorIndexIndex(lastAcceptedIndex, i1, vectorQ);\r\n denominator = vector01.magnitudeSquared();\r\n const s = Geometry.conditionalDivideFraction(vectorQ.dotProduct(vector01), denominator);\r\n if (s !== undefined) {\r\n if (s >= 0.0 && s <= maxExtensionFraction) {\r\n distanceSquared = PolylineCompressionContext._vectorQ.magnitudeSquared() - denominator * s * s;\r\n if (distanceSquared <= perpendicularDistanceSquared) {\r\n // force accept of point i1+1 .\r\n data.moveIndexToIndex(i1 + 1, ++lastAcceptedIndex);\r\n i1 = i1 + 1;\r\n continue;\r\n }\r\n }\r\n }\r\n data.moveIndexToIndex(i1, ++lastAcceptedIndex);\r\n }\r\n if (i1 < n)\r\n data.moveIndexToIndex(i1, ++lastAcceptedIndex);\r\n data.length = lastAcceptedIndex + 1;\r\n }\r\n /**\r\n * IF the first and last points are close AND first and last segments are colinear, remove first and last points. Prior second to last becomes replicated start and end.\r\n * * Expected to be called \"last\" after other compressions, so points \"next to\" shared first and last are good to keep.\r\n * @param points\r\n * @param perpendicularDistance\r\n */\r\n public static compressColinearWrapInPlace(points: Point3d[], duplicatePointTolerance: number, colinearPointTolerance: number) {\r\n const lastIndex = points.length - 1;\r\n if (lastIndex >= 3 && points[0].distance(points[lastIndex]) < duplicatePointTolerance) {\r\n // indices of 3 points potentially colinear.\r\n const indexA = lastIndex - 1;\r\n const indexB = 0;\r\n const indexC = 1;\r\n const vectorU = Vector3d.createStartEnd(points[indexA], points[indexC]);\r\n const vectorV = Vector3d.createStartEnd(points[indexA], points[indexB]);\r\n const uDotU = vectorU.dotProduct(vectorU);\r\n const uDotV = vectorU.dotProduct(vectorV);\r\n const fraction = Geometry.conditionalDivideFraction(uDotV, uDotU);\r\n if (fraction !== undefined && fraction > 0.0 && fraction < 1.0) {\r\n const h2 = vectorV.magnitudeSquared() - fraction * fraction * uDotU;\r\n if (Math.sqrt(Math.abs(h2)) < colinearPointTolerance) {\r\n points[0] = points[indexA];\r\n points.pop();\r\n }\r\n }\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -13,6 +13,7 @@ import { CurveLocationDetail, CurveLocationDetailPair } from "./CurveLocationDet
|
|
|
13
13
|
import { GeometryQuery } from "./GeometryQuery";
|
|
14
14
|
import { LineString3d } from "./LineString3d";
|
|
15
15
|
import { OffsetOptions } from "./OffsetOptions";
|
|
16
|
+
import { Path } from "./Path";
|
|
16
17
|
import { StrokeOptions } from "./StrokeOptions";
|
|
17
18
|
/**
|
|
18
19
|
* Annotation of a fragment, i.e. an interval of a curve.
|
|
@@ -82,11 +83,14 @@ export declare class PathFragment {
|
|
|
82
83
|
childFractionToChainDistance(fraction: number): number;
|
|
83
84
|
}
|
|
84
85
|
/**
|
|
85
|
-
* `CurveChainWithDistanceIndex` is a CurvePrimitive whose fractional parameterization is proportional to true
|
|
86
|
-
* distance along a
|
|
86
|
+
* `CurveChainWithDistanceIndex` is a [[CurvePrimitive]] whose fractional parameterization is proportional to true
|
|
87
|
+
* distance along a path.
|
|
87
88
|
* * For example if the total length of the chain is `L`, then the distance along the chain from parameters `t0`
|
|
88
89
|
* to `t1` is easily computed as `L*(t1-t0)`.
|
|
89
|
-
* *
|
|
90
|
+
* * In this way the `CurveChainWithDistanceIndex` provides a global arc length parameterization for a [[CurveChain]].
|
|
91
|
+
* * A `CurveChainWithDistanceIndex` can be created from any [[CurveChain]], but a [[Path]] is stored internally.
|
|
92
|
+
* * Adding a `CurveChainWithDistanceIndex` to a `CurveChain` does not preserve the distance index; instead the
|
|
93
|
+
* internal path children are added directly to the `CurveChain`.
|
|
90
94
|
* @public
|
|
91
95
|
*/
|
|
92
96
|
export declare class CurveChainWithDistanceIndex extends CurvePrimitive {
|
|
@@ -111,7 +115,7 @@ export declare class CurveChainWithDistanceIndex extends CurvePrimitive {
|
|
|
111
115
|
* Reference to the contained path.
|
|
112
116
|
* * Do not modify the path. The distance index will be wrong.
|
|
113
117
|
*/
|
|
114
|
-
get path():
|
|
118
|
+
get path(): Path;
|
|
115
119
|
/**
|
|
116
120
|
* Reference to the fragments array.
|
|
117
121
|
* * Do not modify.
|
|
@@ -170,8 +174,9 @@ export declare class CurveChainWithDistanceIndex extends CurvePrimitive {
|
|
|
170
174
|
*/
|
|
171
175
|
private static flattenNestedChains;
|
|
172
176
|
/**
|
|
173
|
-
* Capture (not clone) a path into a new `CurveChainWithDistanceIndex
|
|
174
|
-
* @param path
|
|
177
|
+
* Capture (not clone) a path into a new `CurveChainWithDistanceIndex`.
|
|
178
|
+
* @param path chain to be CAPTURED (not cloned)
|
|
179
|
+
* @param options how finely to stroke the path to create the distance index
|
|
175
180
|
*/
|
|
176
181
|
static createCapture(path: CurveChain, options?: StrokeOptions): CurveChainWithDistanceIndex;
|
|
177
182
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurveChainWithDistanceIndex.d.ts","sourceRoot":"","sources":["../../../src/curve/CurveChainWithDistanceIndex.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAC1F,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,OAAO,EAA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E,2BAA2B,GAAG,mBAAmB,GAAG,SAAS;IA0CvH;;;;;OAKG;IACa,iBAAiB,CAC/B,uBAAuB,EAAE,MAAM,GAAG,aAAa,GAC9C,cAAc,GAAG,cAAc,EAAE,GAAG,SAAS;IAchD;;;;;;;OAOG;IACa,uBAAuB,CAAC,GAAG,EAAE,QAAQ,GAAG,KAAK,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS;IAGtG;;;;OAIG;IACI,kBAAkB,CAAC,WAAW,EAAE,mBAAmB,GAAG,mBAAmB,GAAG,SAAS;IAc5F;;;;;;;;;;;OAWG;WACW,+BAA+B,CAAC,KAAK,EAAE,uBAAuB,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,2BAA2B,EAAE,MAAM,CAAC,EAAE,2BAA2B,EAAE,gBAAgB,CAAC,EAAE,OAAO,GAAG,uBAAuB,EAAE;CAmBnO"}
|
|
@@ -11,7 +11,6 @@ import { StrokeCountMap } from "../curve/Query/StrokeCountMap";
|
|
|
11
11
|
import { Geometry } from "../Geometry";
|
|
12
12
|
import { Point3d } from "../geometry3d/Point3dVector3d";
|
|
13
13
|
import { Range3d } from "../geometry3d/Range";
|
|
14
|
-
import { CurveChain } from "./CurveCollection";
|
|
15
14
|
import { CurveExtendMode, CurveExtendOptions } from "./CurveExtendMode";
|
|
16
15
|
import { CurveLocationDetail, CurveLocationDetailPair } from "./CurveLocationDetail";
|
|
17
16
|
import { PlaneAltitudeRangeContext } from "./internalContexts/PlaneAltitudeRangeContext";
|
|
@@ -177,11 +176,14 @@ class DistanceIndexConstructionContext {
|
|
|
177
176
|
}
|
|
178
177
|
}
|
|
179
178
|
/**
|
|
180
|
-
* `CurveChainWithDistanceIndex` is a CurvePrimitive whose fractional parameterization is proportional to true
|
|
181
|
-
* distance along a
|
|
179
|
+
* `CurveChainWithDistanceIndex` is a [[CurvePrimitive]] whose fractional parameterization is proportional to true
|
|
180
|
+
* distance along a path.
|
|
182
181
|
* * For example if the total length of the chain is `L`, then the distance along the chain from parameters `t0`
|
|
183
182
|
* to `t1` is easily computed as `L*(t1-t0)`.
|
|
184
|
-
* *
|
|
183
|
+
* * In this way the `CurveChainWithDistanceIndex` provides a global arc length parameterization for a [[CurveChain]].
|
|
184
|
+
* * A `CurveChainWithDistanceIndex` can be created from any [[CurveChain]], but a [[Path]] is stored internally.
|
|
185
|
+
* * Adding a `CurveChainWithDistanceIndex` to a `CurveChain` does not preserve the distance index; instead the
|
|
186
|
+
* internal path children are added directly to the `CurveChain`.
|
|
185
187
|
* @public
|
|
186
188
|
*/
|
|
187
189
|
export class CurveChainWithDistanceIndex extends CurvePrimitive {
|
|
@@ -194,7 +196,7 @@ export class CurveChainWithDistanceIndex extends CurvePrimitive {
|
|
|
194
196
|
super();
|
|
195
197
|
/** String name for schema properties */
|
|
196
198
|
this.curvePrimitiveType = "curveChainWithDistanceIndex";
|
|
197
|
-
this._path = path;
|
|
199
|
+
this._path = path instanceof Path ? path : Path.create(...path.children);
|
|
198
200
|
this._fragments = fragments;
|
|
199
201
|
this._totalLength = fragments.length > 0 ? fragments[fragments.length - 1].chainDistance1 : 0;
|
|
200
202
|
}
|
|
@@ -204,7 +206,7 @@ export class CurveChainWithDistanceIndex extends CurvePrimitive {
|
|
|
204
206
|
*/
|
|
205
207
|
cloneTransformed(transform) {
|
|
206
208
|
const c = this._path.clone();
|
|
207
|
-
if (c
|
|
209
|
+
if (c.tryTransformInPlace(transform))
|
|
208
210
|
return CurveChainWithDistanceIndex.createCapture(c);
|
|
209
211
|
return undefined;
|
|
210
212
|
}
|
|
@@ -405,14 +407,14 @@ export class CurveChainWithDistanceIndex extends CurvePrimitive {
|
|
|
405
407
|
return flatChain;
|
|
406
408
|
}
|
|
407
409
|
/**
|
|
408
|
-
* Capture (not clone) a path into a new `CurveChainWithDistanceIndex
|
|
409
|
-
* @param path
|
|
410
|
+
* Capture (not clone) a path into a new `CurveChainWithDistanceIndex`.
|
|
411
|
+
* @param path chain to be CAPTURED (not cloned)
|
|
412
|
+
* @param options how finely to stroke the path to create the distance index
|
|
410
413
|
*/
|
|
411
414
|
static createCapture(path, options) {
|
|
412
415
|
path = this.flattenNestedChains(path); // nested chains not allowed
|
|
413
416
|
const fragments = DistanceIndexConstructionContext.createPathFragmentIndex(path, options);
|
|
414
|
-
|
|
415
|
-
return result;
|
|
417
|
+
return new CurveChainWithDistanceIndex(path, fragments);
|
|
416
418
|
}
|
|
417
419
|
/**
|
|
418
420
|
* Return the PathFragment object at the given `distance` along the chain.
|