@itwin/core-geometry 5.7.2 → 5.8.0-dev.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -1
- package/lib/cjs/Geometry.d.ts +24 -14
- package/lib/cjs/Geometry.d.ts.map +1 -1
- package/lib/cjs/Geometry.js +34 -14
- package/lib/cjs/Geometry.js.map +1 -1
- package/lib/cjs/bspline/BSplineCurve.d.ts +1 -1
- package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
- package/lib/cjs/bspline/BSplineCurve.js +1 -1
- package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
- package/lib/cjs/clipping/ClipPrimitive.d.ts +2 -1
- package/lib/cjs/clipping/ClipPrimitive.d.ts.map +1 -1
- package/lib/cjs/clipping/ClipPrimitive.js +2 -1
- package/lib/cjs/clipping/ClipPrimitive.js.map +1 -1
- package/lib/cjs/core-geometry.d.ts +1 -0
- package/lib/cjs/core-geometry.d.ts.map +1 -1
- package/lib/cjs/core-geometry.js +1 -0
- package/lib/cjs/core-geometry.js.map +1 -1
- package/lib/cjs/curve/Arc3d.d.ts +19 -3
- package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
- package/lib/cjs/curve/Arc3d.js +50 -23
- package/lib/cjs/curve/Arc3d.js.map +1 -1
- package/lib/cjs/curve/ConstrainedCurve2d.d.ts +149 -0
- package/lib/cjs/curve/ConstrainedCurve2d.d.ts.map +1 -0
- package/lib/cjs/curve/ConstrainedCurve2d.js +317 -0
- package/lib/cjs/curve/ConstrainedCurve2d.js.map +1 -0
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +18 -5
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js +34 -14
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/cjs/curve/CurveCollection.d.ts +12 -11
- package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCollection.js +36 -36
- package/lib/cjs/curve/CurveCollection.js.map +1 -1
- package/lib/cjs/curve/CurveExtendMode.d.ts +5 -5
- package/lib/cjs/curve/CurveExtendMode.d.ts.map +1 -1
- package/lib/cjs/curve/CurveExtendMode.js +4 -1
- package/lib/cjs/curve/CurveExtendMode.js.map +1 -1
- package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
- package/lib/cjs/curve/CurveFactory.js.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.d.ts +14 -2
- package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.js +19 -3
- package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
- package/lib/cjs/curve/LineSegment3d.d.ts +2 -2
- package/lib/cjs/curve/LineSegment3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineSegment3d.js +2 -2
- package/lib/cjs/curve/LineSegment3d.js.map +1 -1
- package/lib/cjs/curve/LineString3d.d.ts +1 -1
- package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineString3d.js +1 -1
- package/lib/cjs/curve/LineString3d.js.map +1 -1
- package/lib/cjs/curve/Path.d.ts +4 -15
- package/lib/cjs/curve/Path.d.ts.map +1 -1
- package/lib/cjs/curve/Path.js +1 -35
- package/lib/cjs/curve/Path.js.map +1 -1
- package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.d.ts +2 -1
- package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js +18 -13
- package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
- package/lib/cjs/curve/internalContexts/PointToCurveTangentHandler.d.ts +26 -0
- package/lib/cjs/curve/internalContexts/PointToCurveTangentHandler.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/PointToCurveTangentHandler.js +78 -0
- package/lib/cjs/curve/internalContexts/PointToCurveTangentHandler.js.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ConstrainedImplicitCurve2d.d.ts +152 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ConstrainedImplicitCurve2d.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ConstrainedImplicitCurve2d.js +843 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ConstrainedImplicitCurve2d.js.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ConstraintSet.d.ts +97 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ConstraintSet.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ConstraintSet.js +300 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ConstraintSet.js.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ImplicitCurve2d.d.ts +105 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ImplicitCurve2d.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ImplicitCurve2d.js +141 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ImplicitCurve2d.js.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ImplicitCurve2dConverter.d.ts +27 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ImplicitCurve2dConverter.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ImplicitCurve2dConverter.js +152 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ImplicitCurve2dConverter.js.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedCircle2d.d.ts +81 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedCircle2d.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedCircle2d.js +170 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedCircle2d.js.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedEllipse2d.d.ts +96 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedEllipse2d.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedEllipse2d.js +187 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedEllipse2d.js.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedHyperbola2d.d.ts +91 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedHyperbola2d.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedHyperbola2d.js +197 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedHyperbola2d.js.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedLine2d.d.ts +129 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedLine2d.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedLine2d.js +208 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedLine2d.js.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedParabola2d.d.ts +87 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedParabola2d.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedParabola2d.js +193 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedParabola2d.js.map +1 -0
- package/lib/cjs/geometry3d/Ellipsoid.d.ts +2 -1
- package/lib/cjs/geometry3d/Ellipsoid.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Ellipsoid.js +2 -1
- package/lib/cjs/geometry3d/Ellipsoid.js.map +1 -1
- package/lib/cjs/geometry3d/Point2dVector2d.d.ts +7 -0
- package/lib/cjs/geometry3d/Point2dVector2d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point2dVector2d.js +9 -0
- package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/Ray3d.d.ts +5 -0
- package/lib/cjs/geometry3d/Ray3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Ray3d.js +7 -0
- package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
- package/lib/cjs/numerics/Newton.d.ts.map +1 -1
- package/lib/cjs/numerics/Newton.js +2 -1
- package/lib/cjs/numerics/Newton.js.map +1 -1
- package/lib/cjs/numerics/Polynomials.d.ts.map +1 -1
- package/lib/cjs/numerics/Polynomials.js +8 -6
- package/lib/cjs/numerics/Polynomials.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSpineContext.d.ts.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSpineContext.js +3 -1
- package/lib/cjs/topology/HalfEdgeGraphSpineContext.js.map +1 -1
- package/lib/esm/Geometry.d.ts +24 -14
- package/lib/esm/Geometry.d.ts.map +1 -1
- package/lib/esm/Geometry.js +34 -14
- package/lib/esm/Geometry.js.map +1 -1
- package/lib/esm/bspline/BSplineCurve.d.ts +1 -1
- package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
- package/lib/esm/bspline/BSplineCurve.js +1 -1
- package/lib/esm/bspline/BSplineCurve.js.map +1 -1
- package/lib/esm/clipping/ClipPrimitive.d.ts +2 -1
- package/lib/esm/clipping/ClipPrimitive.d.ts.map +1 -1
- package/lib/esm/clipping/ClipPrimitive.js +2 -1
- package/lib/esm/clipping/ClipPrimitive.js.map +1 -1
- package/lib/esm/core-geometry.d.ts +1 -0
- package/lib/esm/core-geometry.d.ts.map +1 -1
- package/lib/esm/core-geometry.js +1 -0
- package/lib/esm/core-geometry.js.map +1 -1
- package/lib/esm/curve/Arc3d.d.ts +19 -3
- package/lib/esm/curve/Arc3d.d.ts.map +1 -1
- package/lib/esm/curve/Arc3d.js +50 -23
- package/lib/esm/curve/Arc3d.js.map +1 -1
- package/lib/esm/curve/ConstrainedCurve2d.d.ts +149 -0
- package/lib/esm/curve/ConstrainedCurve2d.d.ts.map +1 -0
- package/lib/esm/curve/ConstrainedCurve2d.js +313 -0
- package/lib/esm/curve/ConstrainedCurve2d.js.map +1 -0
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +18 -5
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.js +34 -14
- package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/esm/curve/CurveCollection.d.ts +12 -11
- package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
- package/lib/esm/curve/CurveCollection.js +36 -36
- package/lib/esm/curve/CurveCollection.js.map +1 -1
- package/lib/esm/curve/CurveExtendMode.d.ts +5 -5
- package/lib/esm/curve/CurveExtendMode.d.ts.map +1 -1
- package/lib/esm/curve/CurveExtendMode.js +4 -1
- package/lib/esm/curve/CurveExtendMode.js.map +1 -1
- package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
- package/lib/esm/curve/CurveFactory.js.map +1 -1
- package/lib/esm/curve/CurvePrimitive.d.ts +14 -2
- package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
- package/lib/esm/curve/CurvePrimitive.js +19 -3
- package/lib/esm/curve/CurvePrimitive.js.map +1 -1
- package/lib/esm/curve/LineSegment3d.d.ts +2 -2
- package/lib/esm/curve/LineSegment3d.d.ts.map +1 -1
- package/lib/esm/curve/LineSegment3d.js +2 -2
- package/lib/esm/curve/LineSegment3d.js.map +1 -1
- package/lib/esm/curve/LineString3d.d.ts +1 -1
- package/lib/esm/curve/LineString3d.d.ts.map +1 -1
- package/lib/esm/curve/LineString3d.js +1 -1
- package/lib/esm/curve/LineString3d.js.map +1 -1
- package/lib/esm/curve/Path.d.ts +4 -15
- package/lib/esm/curve/Path.d.ts.map +1 -1
- package/lib/esm/curve/Path.js +1 -35
- package/lib/esm/curve/Path.js.map +1 -1
- package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.d.ts +2 -1
- package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js +19 -14
- package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
- package/lib/esm/curve/internalContexts/PointToCurveTangentHandler.d.ts +26 -0
- package/lib/esm/curve/internalContexts/PointToCurveTangentHandler.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/PointToCurveTangentHandler.js +74 -0
- package/lib/esm/curve/internalContexts/PointToCurveTangentHandler.js.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/ConstrainedImplicitCurve2d.d.ts +152 -0
- package/lib/esm/curve/internalContexts/geometry2d/ConstrainedImplicitCurve2d.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/ConstrainedImplicitCurve2d.js +839 -0
- package/lib/esm/curve/internalContexts/geometry2d/ConstrainedImplicitCurve2d.js.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/ConstraintSet.d.ts +97 -0
- package/lib/esm/curve/internalContexts/geometry2d/ConstraintSet.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/ConstraintSet.js +295 -0
- package/lib/esm/curve/internalContexts/geometry2d/ConstraintSet.js.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/ImplicitCurve2d.d.ts +105 -0
- package/lib/esm/curve/internalContexts/geometry2d/ImplicitCurve2d.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/ImplicitCurve2d.js +135 -0
- package/lib/esm/curve/internalContexts/geometry2d/ImplicitCurve2d.js.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/ImplicitCurve2dConverter.d.ts +27 -0
- package/lib/esm/curve/internalContexts/geometry2d/ImplicitCurve2dConverter.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/ImplicitCurve2dConverter.js +148 -0
- package/lib/esm/curve/internalContexts/geometry2d/ImplicitCurve2dConverter.js.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedCircle2d.d.ts +81 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedCircle2d.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedCircle2d.js +166 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedCircle2d.js.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedEllipse2d.d.ts +96 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedEllipse2d.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedEllipse2d.js +183 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedEllipse2d.js.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedHyperbola2d.d.ts +91 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedHyperbola2d.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedHyperbola2d.js +193 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedHyperbola2d.js.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedLine2d.d.ts +129 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedLine2d.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedLine2d.js +204 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedLine2d.js.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedParabola2d.d.ts +87 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedParabola2d.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedParabola2d.js +189 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedParabola2d.js.map +1 -0
- package/lib/esm/geometry3d/Ellipsoid.d.ts +2 -1
- package/lib/esm/geometry3d/Ellipsoid.d.ts.map +1 -1
- package/lib/esm/geometry3d/Ellipsoid.js +2 -1
- package/lib/esm/geometry3d/Ellipsoid.js.map +1 -1
- package/lib/esm/geometry3d/Point2dVector2d.d.ts +7 -0
- package/lib/esm/geometry3d/Point2dVector2d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point2dVector2d.js +9 -0
- package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/Ray3d.d.ts +5 -0
- package/lib/esm/geometry3d/Ray3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Ray3d.js +7 -0
- package/lib/esm/geometry3d/Ray3d.js.map +1 -1
- package/lib/esm/numerics/Newton.d.ts.map +1 -1
- package/lib/esm/numerics/Newton.js +2 -1
- package/lib/esm/numerics/Newton.js.map +1 -1
- package/lib/esm/numerics/Polynomials.d.ts.map +1 -1
- package/lib/esm/numerics/Polynomials.js +8 -6
- package/lib/esm/numerics/Polynomials.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphSpineContext.d.ts.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphSpineContext.js +3 -1
- package/lib/esm/topology/HalfEdgeGraphSpineContext.js.map +1 -1
- package/package.json +3 -3
package/lib/esm/curve/Path.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Curve
|
|
3
|
+
*/
|
|
1
4
|
import { GeometryHandler } from "../geometry3d/GeometryHandler";
|
|
2
5
|
import { Point3d } from "../geometry3d/Point3dVector3d";
|
|
3
6
|
import { CurveChain } from "./CurveCollection";
|
|
4
|
-
import { VariantCurveExtendParameter } from "./CurveExtendMode";
|
|
5
|
-
import { CurveLocationDetail } from "./CurveLocationDetail";
|
|
6
7
|
import { CurvePrimitive } from "./CurvePrimitive";
|
|
7
8
|
import { RecursiveCurveProcessor } from "./CurveProcessor";
|
|
8
9
|
import { GeometryQuery } from "./GeometryQuery";
|
|
@@ -29,24 +30,12 @@ export declare class Path extends CurveChain {
|
|
|
29
30
|
*/
|
|
30
31
|
static create(...curves: Array<CurvePrimitive | Point3d[]>): Path;
|
|
31
32
|
/**
|
|
32
|
-
* Create a path from
|
|
33
|
+
* Create a path from an array of curve primitives.
|
|
33
34
|
* @param curves array of individual curve primitives.
|
|
34
35
|
*/
|
|
35
36
|
static createArray(curves: CurvePrimitive[]): Path;
|
|
36
37
|
/** Return a deep copy, with leaf-level curve primitives stroked. */
|
|
37
38
|
cloneStroked(options?: StrokeOptions): Path;
|
|
38
|
-
/**
|
|
39
|
-
* Return the closest point on the contained curves.
|
|
40
|
-
* @param spacePoint point in space.
|
|
41
|
-
* @param extend compute the closest point to the path extended according to variant type:
|
|
42
|
-
* * false: do not extend the path
|
|
43
|
-
* * true: extend the path at both start and end
|
|
44
|
-
* * CurveExtendOptions: extend the path in the specified manner at both start and end
|
|
45
|
-
* * CurveExtendOptions[]: first entry applies to path start; second, to path end; any other entries ignored
|
|
46
|
-
* @param result optional pre-allocated detail to populate and return.
|
|
47
|
-
* @returns details of the closest point.
|
|
48
|
-
*/
|
|
49
|
-
closestPoint(spacePoint: Point3d, extend?: VariantCurveExtendParameter, result?: CurveLocationDetail): CurveLocationDetail | undefined;
|
|
50
39
|
/** Return the boundary type (1) of a corresponding MicroStation CurveVector */
|
|
51
40
|
dgnBoundaryType(): number;
|
|
52
41
|
/** Clone as a new `Path` with no primitives */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Path.d.ts","sourceRoot":"","sources":["../../../src/curve/Path.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Path.d.ts","sourceRoot":"","sources":["../../../src/curve/Path.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAExD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;;;;GAKG;AACH,qBAAa,IAAK,SAAQ,UAAU;IAClC,wCAAwC;IACxC,SAAgB,mBAAmB,UAAU;IAC7C,+CAA+C;IACxC,mBAAmB,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO;IAGzD,2DAA2D;IACpD,wBAAwB,CAAC,SAAS,EAAE,uBAAuB,EAAE,aAAa,GAAE,MAAW,GAAG,IAAI;IAGrG,+BAA+B;;IAI/B;;;;OAIG;WACW,MAAM,CAAC,GAAG,MAAM,EAAE,KAAK,CAAC,cAAc,GAAG,OAAO,EAAE,CAAC,GAAG,IAAI;IAaxE;;;OAGG;WACW,WAAW,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,IAAI;IAGzD,oEAAoE;IAC7D,YAAY,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG,IAAI;IAMlD,+EAA+E;IACxE,eAAe,IAAI,MAAM;IAGhC,+CAA+C;IACxC,cAAc,IAAI,IAAI;IAG7B,sEAAsE;IAC/D,yBAAyB,CAAC,OAAO,EAAE,eAAe,GAAG,GAAG;CAGhE"}
|
package/lib/esm/curve/Path.js
CHANGED
|
@@ -2,15 +2,9 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
/** @packageDocumentation
|
|
6
|
-
* @module Curve
|
|
7
|
-
*/
|
|
8
|
-
import { assert } from "@itwin/core-bentley";
|
|
9
5
|
import { Point3d } from "../geometry3d/Point3dVector3d";
|
|
10
6
|
import { CurveChainWithDistanceIndex } from "./CurveChainWithDistanceIndex";
|
|
11
7
|
import { CurveChain } from "./CurveCollection";
|
|
12
|
-
import { CurveExtendMode, CurveExtendOptions } from "./CurveExtendMode";
|
|
13
|
-
import { CurveLocationDetail } from "./CurveLocationDetail";
|
|
14
8
|
import { CurvePrimitive } from "./CurvePrimitive";
|
|
15
9
|
import { LineString3d } from "./LineString3d";
|
|
16
10
|
/**
|
|
@@ -53,7 +47,7 @@ export class Path extends CurveChain {
|
|
|
53
47
|
return result;
|
|
54
48
|
}
|
|
55
49
|
/**
|
|
56
|
-
* Create a path from
|
|
50
|
+
* Create a path from an array of curve primitives.
|
|
57
51
|
* @param curves array of individual curve primitives.
|
|
58
52
|
*/
|
|
59
53
|
static createArray(curves) {
|
|
@@ -66,34 +60,6 @@ export class Path extends CurveChain {
|
|
|
66
60
|
curve.emitStrokes(strokes, options);
|
|
67
61
|
return Path.create(strokes);
|
|
68
62
|
}
|
|
69
|
-
/**
|
|
70
|
-
* Return the closest point on the contained curves.
|
|
71
|
-
* @param spacePoint point in space.
|
|
72
|
-
* @param extend compute the closest point to the path extended according to variant type:
|
|
73
|
-
* * false: do not extend the path
|
|
74
|
-
* * true: extend the path at both start and end
|
|
75
|
-
* * CurveExtendOptions: extend the path in the specified manner at both start and end
|
|
76
|
-
* * CurveExtendOptions[]: first entry applies to path start; second, to path end; any other entries ignored
|
|
77
|
-
* @param result optional pre-allocated detail to populate and return.
|
|
78
|
-
* @returns details of the closest point.
|
|
79
|
-
*/
|
|
80
|
-
closestPoint(spacePoint, extend = false, result) {
|
|
81
|
-
let detailA;
|
|
82
|
-
const detailB = new CurveLocationDetail();
|
|
83
|
-
if (this.children !== undefined) {
|
|
84
|
-
for (let i = 0; i < this.children.length; i++) {
|
|
85
|
-
const child = this.children[i]; // head only extends at start; tail, only at end. NOTE: child may be both head and tail!
|
|
86
|
-
const mode0 = (i === 0) ? CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extend, 0) : CurveExtendMode.None;
|
|
87
|
-
const mode1 = (i === this.children.length - 1) ? CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extend, 1) : CurveExtendMode.None;
|
|
88
|
-
if (child.closestPoint(spacePoint, [mode0, mode1], detailB)) {
|
|
89
|
-
const smaller = CurveLocationDetail.chooseSmallerA(detailA, detailB);
|
|
90
|
-
assert(undefined !== smaller, "expect defined because detailB is always defined");
|
|
91
|
-
detailA = result = smaller.clone(result);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
return detailA;
|
|
96
|
-
}
|
|
97
63
|
/** Return the boundary type (1) of a corresponding MicroStation CurveVector */
|
|
98
64
|
dgnBoundaryType() {
|
|
99
65
|
return 1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Path.js","sourceRoot":"","sources":["../../../src/curve/Path.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;
|
|
1
|
+
{"version":3,"file":"Path.js","sourceRoot":"","sources":["../../../src/curve/Path.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAO/F,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C;;;;;GAKG;AACH,MAAM,OAAO,IAAK,SAAQ,UAAU;IAClC,wCAAwC;IACxB,mBAAmB,GAAG,MAAM,CAAC;IAC7C,+CAA+C;IACxC,mBAAmB,CAAC,KAAoB;QAC7C,OAAO,KAAK,YAAY,IAAI,CAAC;IAC/B,CAAC;IACD,2DAA2D;IACpD,wBAAwB,CAAC,SAAkC,EAAE,gBAAwB,CAAC,CAAC;QAC5F,OAAO,SAAS,CAAC,YAAY,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IACrD,CAAC;IACD,+BAA+B;IAC/B;QACE,KAAK,EAAE,CAAC;IACV,CAAC;IACD;;;;OAIG;IACI,MAAM,CAAC,MAAM,CAAC,GAAG,MAAyC;QAC/D,MAAM,MAAM,GAAG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esContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { Point3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { CurveChainWithDistanceIndex } from \"./CurveChainWithDistanceIndex\";\r\nimport { CurveChain } from \"./CurveCollection\";\r\nimport { CurvePrimitive } from \"./CurvePrimitive\";\r\nimport { RecursiveCurveProcessor } from \"./CurveProcessor\";\r\nimport { GeometryQuery } from \"./GeometryQuery\";\r\nimport { LineString3d } from \"./LineString3d\";\r\nimport { StrokeOptions } from \"./StrokeOptions\";\r\n\r\n/**\r\n * * A `Path` object is a collection of curves that join head-to-tail to form a path.\r\n * * A `Path` object does not bound a planar region. Use `Loop` to indicate region bounding.\r\n * @see [Curve Collections]($docs/learning/geometry/CurveCollection.md) learning article.\r\n * @public\r\n */\r\nexport class Path extends CurveChain {\r\n /** String name for schema properties */\r\n public readonly curveCollectionType = \"path\";\r\n /** Test if `other` is an instance of `Path` */\r\n public isSameGeometryClass(other: GeometryQuery): boolean {\r\n return other instanceof Path;\r\n }\r\n /** Invoke `processor.announcePath(this, indexInParent)` */\r\n public announceToCurveProcessor(processor: RecursiveCurveProcessor, indexInParent: number = -1): void {\r\n return processor.announcePath(this, indexInParent);\r\n }\r\n /** Construct an empty path. */\r\n public constructor() {\r\n super();\r\n }\r\n /**\r\n * Create a path from a variable length list of curve primitives\r\n * * CurvePrimitive params are captured.\r\n * @param curves variable length list of individual curve primitives or point arrays.\r\n */\r\n public static create(...curves: Array<CurvePrimitive | Point3d[]>): Path {\r\n const result = new Path();\r\n for (const curve of curves) {\r\n if (curve instanceof CurveChainWithDistanceIndex)\r\n result.children.push(...curve.path.children);\r\n else if (curve instanceof CurvePrimitive)\r\n result.children.push(curve);\r\n else if (Array.isArray(curve) && curve.length > 0 && curve[0] instanceof Point3d) {\r\n result.children.push(LineString3d.create(curve));\r\n }\r\n }\r\n return result;\r\n }\r\n /**\r\n * Create a path from an array of curve primitives.\r\n * @param curves array of individual curve primitives.\r\n */\r\n public static createArray(curves: CurvePrimitive[]): Path {\r\n return this.create(...curves);\r\n }\r\n /** Return a deep copy, with leaf-level curve primitives stroked. */\r\n public cloneStroked(options?: StrokeOptions): Path {\r\n const strokes = LineString3d.create();\r\n for (const curve of this.children)\r\n curve.emitStrokes(strokes, options);\r\n return Path.create(strokes);\r\n }\r\n /** Return the boundary type (1) of a corresponding MicroStation CurveVector */\r\n public dgnBoundaryType(): number {\r\n return 1;\r\n }\r\n /** Clone as a new `Path` with no primitives */\r\n public cloneEmptyPeer(): Path {\r\n return new Path();\r\n }\r\n /** Second step of double dispatch: call `handler.handlePath(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handlePath(this);\r\n }\r\n}\r\n"]}
|
|
@@ -16,6 +16,7 @@ export declare class ClosestPointStrokeHandler extends NewtonRtoRStrokeHandler i
|
|
|
16
16
|
private _closestPoint;
|
|
17
17
|
private _spacePoint;
|
|
18
18
|
private _extend;
|
|
19
|
+
private _xyOnly;
|
|
19
20
|
private _fractionA;
|
|
20
21
|
private _functionA;
|
|
21
22
|
private _fractionB;
|
|
@@ -25,7 +26,7 @@ export declare class ClosestPointStrokeHandler extends NewtonRtoRStrokeHandler i
|
|
|
25
26
|
private _workRay;
|
|
26
27
|
private _newtonSolver;
|
|
27
28
|
/** Constructor */
|
|
28
|
-
constructor(spacePoint: Point3d, extend?: VariantCurveExtendParameter, result?: CurveLocationDetail);
|
|
29
|
+
constructor(spacePoint: Point3d, extend?: VariantCurveExtendParameter, result?: CurveLocationDetail, xyOnly?: boolean);
|
|
29
30
|
claimResult(): CurveLocationDetail | undefined;
|
|
30
31
|
needPrimaryGeometryForStrokes(): boolean;
|
|
31
32
|
startCurvePrimitive(curve: CurvePrimitive | undefined): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClosestPointStrokeHandler.d.ts","sourceRoot":"","sources":["../../../../src/curve/internalContexts/ClosestPointStrokeHandler.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"ClosestPointStrokeHandler.d.ts","sourceRoot":"","sources":["../../../../src/curve/internalContexts/ClosestPointStrokeHandler.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAIrE,OAAO,EAAuC,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AACtG,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE;;;GAGG;AACH,qBAAa,yBAA0B,SAAQ,uBAAwB,YAAW,cAAc;IAC9F,OAAO,CAAC,MAAM,CAA6B;IAC3C,OAAO,CAAC,aAAa,CAAkC;IACvD,OAAO,CAAC,WAAW,CAAU;IAC7B,OAAO,CAAC,OAAO,CAA8B;IAC7C,OAAO,CAAC,OAAO,CAAU;IAEzB,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,UAAU,CAAa;IAE/B,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,aAAa,CAAa;IAElC,OAAO,CAAC,UAAU,CAAU;IAC5B,OAAO,CAAC,QAAQ,CAAQ;IACxB,OAAO,CAAC,aAAa,CAAyC;IAC9D,kBAAkB;gBACC,UAAU,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,2BAA2B,EAAE,MAAM,CAAC,EAAE,mBAAmB,EAAE,MAAM,CAAC,EAAE,OAAO;IAarH,WAAW,IAAI,mBAAmB,GAAG,SAAS;IAY9C,6BAA6B;IAG7B,mBAAmB,CAAC,KAAK,EAAE,cAAc,GAAG,SAAS;IAMrD,iBAAiB;IAEjB,qCAAqC,CAC1C,EAAE,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAC3E,IAAI;IAaP,OAAO,CAAC,iBAAiB;IASlB,uBAAuB,CAC5B,EAAE,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAC9G,IAAI;IAcP;;;;;;;OAOG;IACH,OAAO,CAAC,cAAc;IAiBtB,OAAO,CAAC,wBAAwB;IAIhC;;;;;;;OAOG;IACH,OAAO,CAAC,gBAAgB;IAYjB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAU1C,OAAO,CAAC,WAAW;IAUZ,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ;CAIhF"}
|
|
@@ -10,7 +10,8 @@ import { Geometry } from "../../Geometry";
|
|
|
10
10
|
import { Point3d } from "../../geometry3d/Point3dVector3d";
|
|
11
11
|
import { Ray3d } from "../../geometry3d/Ray3d";
|
|
12
12
|
import { Newton1dUnboundedApproximateDerivative } from "../../numerics/Newton";
|
|
13
|
-
import {
|
|
13
|
+
import { SmallSystem } from "../../numerics/SmallSystem";
|
|
14
|
+
import { CurveExtendMode, CurveExtendOptions } from "../CurveExtendMode";
|
|
14
15
|
import { CurveLocationDetail } from "../CurveLocationDetail";
|
|
15
16
|
import { NewtonRtoRStrokeHandler } from "./NewtonRtoRStrokeHandler";
|
|
16
17
|
/**
|
|
@@ -22,6 +23,7 @@ export class ClosestPointStrokeHandler extends NewtonRtoRStrokeHandler {
|
|
|
22
23
|
_closestPoint;
|
|
23
24
|
_spacePoint;
|
|
24
25
|
_extend;
|
|
26
|
+
_xyOnly;
|
|
25
27
|
// fraction and function value on one side of an interval that may bracket a root
|
|
26
28
|
_fractionA = 0;
|
|
27
29
|
_functionA = 0;
|
|
@@ -34,7 +36,7 @@ export class ClosestPointStrokeHandler extends NewtonRtoRStrokeHandler {
|
|
|
34
36
|
_workRay;
|
|
35
37
|
_newtonSolver;
|
|
36
38
|
/** Constructor */
|
|
37
|
-
constructor(spacePoint, extend, result) {
|
|
39
|
+
constructor(spacePoint, extend, result, xyOnly) {
|
|
38
40
|
super();
|
|
39
41
|
this._spacePoint = spacePoint;
|
|
40
42
|
this._workPoint = Point3d.create();
|
|
@@ -43,6 +45,7 @@ export class ClosestPointStrokeHandler extends NewtonRtoRStrokeHandler {
|
|
|
43
45
|
if (this._closestPoint)
|
|
44
46
|
this._closestPoint.a = Geometry.largeCoordinateResult;
|
|
45
47
|
this._extend = extend ?? false;
|
|
48
|
+
this._xyOnly = xyOnly ?? false;
|
|
46
49
|
this.startCurvePrimitive(undefined);
|
|
47
50
|
this._newtonSolver = new Newton1dUnboundedApproximateDerivative(this);
|
|
48
51
|
}
|
|
@@ -83,7 +86,7 @@ export class ClosestPointStrokeHandler extends NewtonRtoRStrokeHandler {
|
|
|
83
86
|
}
|
|
84
87
|
}
|
|
85
88
|
announceCandidate(cp, fraction, point) {
|
|
86
|
-
const distance = this._spacePoint.distance(point);
|
|
89
|
+
const distance = this._xyOnly ? this._spacePoint.distanceXY(point) : this._spacePoint.distance(point);
|
|
87
90
|
if (this._closestPoint && distance > this._closestPoint.a)
|
|
88
91
|
return;
|
|
89
92
|
this._closestPoint = CurveLocationDetail.createCurveFractionPoint(cp, fraction, point, this._closestPoint);
|
|
@@ -92,16 +95,15 @@ export class ClosestPointStrokeHandler extends NewtonRtoRStrokeHandler {
|
|
|
92
95
|
this._closestPoint.curve = this._parentCurvePrimitive;
|
|
93
96
|
}
|
|
94
97
|
announceSegmentInterval(cp, point0, point1, _numStrokes, fraction0, fraction1) {
|
|
95
|
-
let localFraction =
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
98
|
+
let localFraction = 0;
|
|
99
|
+
if (this._xyOnly)
|
|
100
|
+
localFraction = SmallSystem.lineSegment3dXYClosestPointUnbounded(point0, point1, this._spacePoint) ?? 0;
|
|
101
|
+
else
|
|
102
|
+
localFraction = this._spacePoint.fractionOfProjectionToLine(point0, point1, 0.0);
|
|
103
|
+
// only consider segment extension at a parent curve endpoint, i.e. when fraction0 is 0 or fraction1 is 1
|
|
104
|
+
const extend0 = (fraction0 === 0) ? CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(this._extend, 0) : CurveExtendMode.None;
|
|
105
|
+
const extend1 = (fraction1 === 1) ? CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(this._extend, 1) : CurveExtendMode.None;
|
|
106
|
+
localFraction = CurveExtendOptions.correctFraction([extend0, extend1], localFraction);
|
|
105
107
|
this._workPoint = point0.interpolate(localFraction, point1);
|
|
106
108
|
const globalFraction = Geometry.interpolate(fraction0, localFraction, fraction1);
|
|
107
109
|
this.announceCandidate(cp, globalFraction, this._workPoint);
|
|
@@ -150,7 +152,10 @@ export class ClosestPointStrokeHandler extends NewtonRtoRStrokeHandler {
|
|
|
150
152
|
this._workRay = curve.fractionToPointAndDerivative(fraction, this._workRay);
|
|
151
153
|
else
|
|
152
154
|
return undefined;
|
|
153
|
-
|
|
155
|
+
if (this._xyOnly)
|
|
156
|
+
return this._workRay.dotProductToPointXY(this._spacePoint);
|
|
157
|
+
else
|
|
158
|
+
return this._workRay.dotProductToPoint(this._spacePoint);
|
|
154
159
|
}
|
|
155
160
|
evaluate(fraction) {
|
|
156
161
|
let curve = this._curve;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClosestPointStrokeHandler.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/ClosestPointStrokeHandler.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,OAAO,EAAY,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,sCAAsC,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAA+B,MAAM,oBAAoB,CAAC;AACrF,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE;;;GAGG;AACH,MAAM,OAAO,yBAA0B,SAAQ,uBAAuB;IAC5D,MAAM,CAA6B;IACnC,aAAa,CAAkC;IAC/C,WAAW,CAAU;IACrB,OAAO,CAA8B;IAC7C,iFAAiF;IACzE,UAAU,GAAW,CAAC,CAAC;IACvB,UAAU,GAAW,CAAC,CAAC;IAC/B,uFAAuF;IAC/E,UAAU,GAAW,CAAC,CAAC;IACvB,UAAU,GAAW,CAAC,CAAC;IACvB,aAAa,GAAW,CAAC,CAAC;IAClC,qCAAqC;IAC7B,UAAU,CAAU;IACpB,QAAQ,CAAQ;IAChB,aAAa,CAAyC;IAC9D,kBAAkB;IAClB,YAAmB,UAAmB,EAAE,MAAoC,EAAE,MAA4B;QACxG,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;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,qBAAqB,CAAC;QACrC,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,SAAS,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;QAChE,IAAI,KAAK,KAAK,SAAS;YACrB,OAAO,KAAK,CAAC;QACf,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB,OAAO,IAAI,CAAC;IACd,CAAC;IACO,WAAW,CAAC,QAAgB,EAAE,IAAW;QAC/C,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAC1C,MAAM,CAAC,KAAK,KAAK,SAAS,EAAE,iFAAiF,CAAC,CAAC;QAC/G,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QACxB,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAC;QAC3B,IAAI,IAAI,CAAC,aAAa,EAAE,GAAG,CAAC,EAAE,oFAAoF;YAChH,IAAI,CAAC,cAAc,EAAE,CAAC;QACxB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAClC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;IACpC,CAAC;IACM,oBAAoB,CAAC,KAAc,EAAE,QAAgB,EAAE,OAAiB;QAC7E,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAClC,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC5C,CAAC;CACF","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/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { Geometry } from \"../../Geometry\";\r\nimport { IStrokeHandler } from \"../../geometry3d/GeometryHandler\";\r\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\r\nimport { Newton1dUnboundedApproximateDerivative } from \"../../numerics/Newton\";\r\nimport { CurveExtendOptions, VariantCurveExtendParameter } from \"../CurveExtendMode\";\r\nimport { CurveLocationDetail } from \"../CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\nimport { NewtonRtoRStrokeHandler } from \"./NewtonRtoRStrokeHandler\";\r\n\r\n/**\r\n * Context for searching for the closest point to a CurvePrimitive.\r\n * @internal\r\n */\r\nexport class ClosestPointStrokeHandler extends NewtonRtoRStrokeHandler implements IStrokeHandler {\r\n private _curve: CurvePrimitive | undefined;\r\n private _closestPoint: CurveLocationDetail | undefined;\r\n private _spacePoint: Point3d;\r\n private _extend: VariantCurveExtendParameter;\r\n // fraction and function value on one side of an interval that may bracket a root\r\n private _fractionA: number = 0;\r\n private _functionA: number = 0;\r\n // fraction and function value on the other side of an interval that may bracket a root\r\n private _fractionB: number = 0;\r\n private _functionB: number = 0;\r\n private _numThisCurve: number = 0;\r\n // scratch vars to use within methods\r\n private _workPoint: Point3d;\r\n private _workRay: Ray3d;\r\n private _newtonSolver: Newton1dUnboundedApproximateDerivative;\r\n /** Constructor */\r\n public constructor(spacePoint: Point3d, extend?: VariantCurveExtendParameter, result?: CurveLocationDetail) {\r\n super();\r\n this._spacePoint = spacePoint;\r\n this._workPoint = Point3d.create();\r\n this._workRay = Ray3d.createZero();\r\n this._closestPoint = result;\r\n if (this._closestPoint)\r\n this._closestPoint.a = Geometry.largeCoordinateResult\r\n this._extend = extend ?? false;\r\n this.startCurvePrimitive(undefined);\r\n this._newtonSolver = new Newton1dUnboundedApproximateDerivative(this);\r\n }\r\n public claimResult(): CurveLocationDetail | undefined {\r\n if (this._closestPoint) {\r\n this._newtonSolver.setX(this._closestPoint.fraction);\r\n this._curve = this._closestPoint.curve;\r\n if (this._newtonSolver.runIterations()) {\r\n let fraction = this._newtonSolver.getX();\r\n fraction = CurveExtendOptions.correctFraction(this._extend, fraction);\r\n this.announceSolutionFraction(fraction);\r\n }\r\n }\r\n return this._closestPoint;\r\n }\r\n public needPrimaryGeometryForStrokes() {\r\n return true;\r\n }\r\n public startCurvePrimitive(curve: CurvePrimitive | undefined) {\r\n this._curve = curve;\r\n this._fractionA = 0.0;\r\n this._numThisCurve = 0;\r\n this._functionA = 0.0;\r\n }\r\n public endCurvePrimitive() {\r\n }\r\n public announceIntervalForUniformStepStrokes(\r\n cp: CurvePrimitive, numStrokes: number, fraction0: number, fraction1: number,\r\n ): void {\r\n this.startCurvePrimitive(cp);\r\n this.announceSolutionFraction(0.0); // test start point as closest\r\n this.announceSolutionFraction(1.0); // test end point as closest\r\n if (numStrokes < 1)\r\n numStrokes = 1;\r\n const df = 1.0 / numStrokes;\r\n for (let i = 0; i <= numStrokes; i++) {\r\n const fraction = Geometry.interpolate(fraction0, i * df, fraction1);\r\n cp.fractionToPointAndDerivative(fraction, this._workRay);\r\n this.announceRay(fraction, this._workRay);\r\n }\r\n }\r\n private announceCandidate(cp: CurvePrimitive, fraction: number, point: Point3d) {\r\n const distance = this._spacePoint.distance(point);\r\n if (this._closestPoint && distance > this._closestPoint.a)\r\n return;\r\n this._closestPoint = CurveLocationDetail.createCurveFractionPoint(cp, fraction, point, this._closestPoint);\r\n this._closestPoint.a = distance;\r\n if (this._parentCurvePrimitive !== undefined)\r\n this._closestPoint.curve = this._parentCurvePrimitive;\r\n }\r\n public announceSegmentInterval(\r\n cp: CurvePrimitive, point0: Point3d, point1: Point3d, _numStrokes: number, fraction0: number, fraction1: number,\r\n ): void {\r\n let localFraction = this._spacePoint.fractionOfProjectionToLine(point0, point1, 0.0);\r\n // only consider extending the segment if the immediate caller says we are at endpoints\r\n if (!this._extend)\r\n localFraction = Geometry.clampToStartEnd(localFraction, 0.0, 1.0);\r\n else {\r\n if (fraction0 !== 0.0)\r\n localFraction = Math.max(localFraction, 0.0);\r\n if (fraction1 !== 1.0)\r\n localFraction = Math.min(localFraction, 1.0);\r\n }\r\n this._workPoint = point0.interpolate(localFraction, point1);\r\n const globalFraction = Geometry.interpolate(fraction0, localFraction, fraction1);\r\n this.announceCandidate(cp, globalFraction, this._workPoint);\r\n }\r\n /**\r\n * Given a function `f` and (unordered) fractions `a` and `b`, search for and announce a root of `f` in this\r\n * fractional interval.\r\n * * This method searches for a root of `f` if and only if the stroke segment defined by `(a, f(a))` and\r\n * `(b, f(b))` has a root. This is a HEURISTIC: given continuous `f` between `a` and `b`, a root of the stroke\r\n * segment implies a root of `f`, but not vice-versa. Therefore, if the strokes are not sufficiently dense,\r\n * this method can miss a root of `f`.\r\n */\r\n private searchInterval() {\r\n if (this._functionA * this._functionB > 0)\r\n return; // stroke segment has no root; ASSUME the function has no root either\r\n if (this._functionA === 0)\r\n this.announceSolutionFraction(this._fractionA);\r\n if (this._functionB === 0)\r\n this.announceSolutionFraction(this._fractionB);\r\n // by the Intermediate Value Theorem, a root lies between fractionA and fractionB; use Newton to find it.\r\n if (this._functionA * this._functionB < 0) {\r\n const fraction = Geometry.inverseInterpolate(this._fractionA, this._functionA, this._fractionB, this._functionB);\r\n if (fraction) {\r\n this._newtonSolver.setX(fraction);\r\n if (this._newtonSolver.runIterations())\r\n this.announceSolutionFraction(this._newtonSolver.getX());\r\n }\r\n }\r\n }\r\n private announceSolutionFraction(fraction: number) {\r\n if (this._curve)\r\n this.announceCandidate(this._curve, fraction, this._curve.fractionToPoint(fraction));\r\n }\r\n /**\r\n * Evaluate the univariate real-valued function for which we are finding roots.\r\n * * For finding the closest point to curve X from point Q, this function is `f(t) := Q-X(t) dot X'(t)`.\r\n * * Either `pointAndDerivative` must be defined, or both `fraction` and `curve`.\r\n * @param pointAndDerivative pre-evaluated curve\r\n * @param fraction fraction at which to evaluate `curve`\r\n * @param curve curve to evaluate at `fraction`\r\n */\r\n private evaluateFunction(pointAndDerivative?: Ray3d, fraction?: number, curve?: CurvePrimitive): number | undefined {\r\n if (pointAndDerivative)\r\n this._workRay.setFrom(pointAndDerivative);\r\n else if (fraction !== undefined && curve)\r\n this._workRay = curve.fractionToPointAndDerivative(fraction, this._workRay);\r\n else\r\n return undefined;\r\n return this._workRay.dotProductToPoint(this._spacePoint);\r\n }\r\n public evaluate(fraction: number): boolean {\r\n let curve = this._curve;\r\n if (this._parentCurvePrimitive)\r\n curve = this._parentCurvePrimitive;\r\n const value = this.evaluateFunction(undefined, fraction, curve);\r\n if (value === undefined)\r\n return false;\r\n this.currentF = value;\r\n return true;\r\n }\r\n private announceRay(fraction: number, data: Ray3d): void {\r\n const value = this.evaluateFunction(data);\r\n assert(value !== undefined, \"expect defined because evaluateFunction never returns undefined for input Ray3d\");\r\n this._functionB = value;\r\n this._fractionB = fraction;\r\n if (this._numThisCurve++ > 0) // after the first stroke point, a stroke segment is defined, so we have an interval\r\n this.searchInterval();\r\n this._functionA = this._functionB;\r\n this._fractionA = this._fractionB;\r\n }\r\n public announcePointTangent(point: Point3d, fraction: number, tangent: Vector3d) {\r\n this._workRay.set(point, tangent);\r\n this.announceRay(fraction, this._workRay);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"ClosestPointStrokeHandler.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/ClosestPointStrokeHandler.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,OAAO,EAAY,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,sCAAsC,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAA+B,MAAM,oBAAoB,CAAC;AACtG,OAAO,EAAE,mBAAmB,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AI,CAAC,qBAAqB,CAAC;QACrC,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,SAAS,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;QAChE,IAAI,KAAK,KAAK,SAAS;YACrB,OAAO,KAAK,CAAC;QACf,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB,OAAO,IAAI,CAAC;IACd,CAAC;IACO,WAAW,CAAC,QAAgB,EAAE,IAAW;QAC/C,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAC1C,MAAM,CAAC,KAAK,KAAK,SAAS,EAAE,iFAAiF,CAAC,CAAC;QAC/G,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QACxB,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAC;QAC3B,IAAI,IAAI,CAAC,aAAa,EAAE,GAAG,CAAC,EAAE,oFAAoF;YAChH,IAAI,CAAC,cAAc,EAAE,CAAC;QACxB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAClC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;IACpC,CAAC;IACM,oBAAoB,CAAC,KAAc,EAAE,QAAgB,EAAE,OAAiB;QAC7E,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAClC,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC5C,CAAC;CACF","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/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { Geometry } from \"../../Geometry\";\r\nimport { IStrokeHandler } from \"../../geometry3d/GeometryHandler\";\r\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\r\nimport { Newton1dUnboundedApproximateDerivative } from \"../../numerics/Newton\";\r\nimport { SmallSystem } from \"../../numerics/SmallSystem\";\r\nimport { CurveExtendMode, CurveExtendOptions, VariantCurveExtendParameter } from \"../CurveExtendMode\";\r\nimport { CurveLocationDetail } from \"../CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\nimport { NewtonRtoRStrokeHandler } from \"./NewtonRtoRStrokeHandler\";\r\n\r\n/**\r\n * Context for searching for the closest point to a CurvePrimitive.\r\n * @internal\r\n */\r\nexport class ClosestPointStrokeHandler extends NewtonRtoRStrokeHandler implements IStrokeHandler {\r\n private _curve: CurvePrimitive | undefined;\r\n private _closestPoint: CurveLocationDetail | undefined;\r\n private _spacePoint: Point3d;\r\n private _extend: VariantCurveExtendParameter;\r\n private _xyOnly: boolean;\r\n // fraction and function value on one side of an interval that may bracket a root\r\n private _fractionA: number = 0;\r\n private _functionA: number = 0;\r\n // fraction and function value on the other side of an interval that may bracket a root\r\n private _fractionB: number = 0;\r\n private _functionB: number = 0;\r\n private _numThisCurve: number = 0;\r\n // scratch vars to use within methods\r\n private _workPoint: Point3d;\r\n private _workRay: Ray3d;\r\n private _newtonSolver: Newton1dUnboundedApproximateDerivative;\r\n /** Constructor */\r\n public constructor(spacePoint: Point3d, extend?: VariantCurveExtendParameter, result?: CurveLocationDetail, xyOnly?: boolean) {\r\n super();\r\n this._spacePoint = spacePoint;\r\n this._workPoint = Point3d.create();\r\n this._workRay = Ray3d.createZero();\r\n this._closestPoint = result;\r\n if (this._closestPoint)\r\n this._closestPoint.a = Geometry.largeCoordinateResult\r\n this._extend = extend ?? false;\r\n this._xyOnly = xyOnly ?? false;\r\n this.startCurvePrimitive(undefined);\r\n this._newtonSolver = new Newton1dUnboundedApproximateDerivative(this);\r\n }\r\n public claimResult(): CurveLocationDetail | undefined {\r\n if (this._closestPoint) {\r\n this._newtonSolver.setX(this._closestPoint.fraction);\r\n this._curve = this._closestPoint.curve;\r\n if (this._newtonSolver.runIterations()) {\r\n let fraction = this._newtonSolver.getX();\r\n fraction = CurveExtendOptions.correctFraction(this._extend, fraction);\r\n this.announceSolutionFraction(fraction);\r\n }\r\n }\r\n return this._closestPoint;\r\n }\r\n public needPrimaryGeometryForStrokes() {\r\n return true;\r\n }\r\n public startCurvePrimitive(curve: CurvePrimitive | undefined) {\r\n this._curve = curve;\r\n this._fractionA = 0.0;\r\n this._numThisCurve = 0;\r\n this._functionA = 0.0;\r\n }\r\n public endCurvePrimitive() {\r\n }\r\n public announceIntervalForUniformStepStrokes(\r\n cp: CurvePrimitive, numStrokes: number, fraction0: number, fraction1: number,\r\n ): void {\r\n this.startCurvePrimitive(cp);\r\n this.announceSolutionFraction(0.0); // test start point as closest\r\n this.announceSolutionFraction(1.0); // test end point as closest\r\n if (numStrokes < 1)\r\n numStrokes = 1;\r\n const df = 1.0 / numStrokes;\r\n for (let i = 0; i <= numStrokes; i++) {\r\n const fraction = Geometry.interpolate(fraction0, i * df, fraction1);\r\n cp.fractionToPointAndDerivative(fraction, this._workRay);\r\n this.announceRay(fraction, this._workRay);\r\n }\r\n }\r\n private announceCandidate(cp: CurvePrimitive, fraction: number, point: Point3d) {\r\n const distance = this._xyOnly ? this._spacePoint.distanceXY(point) : this._spacePoint.distance(point);\r\n if (this._closestPoint && distance > this._closestPoint.a)\r\n return;\r\n this._closestPoint = CurveLocationDetail.createCurveFractionPoint(cp, fraction, point, this._closestPoint);\r\n this._closestPoint.a = distance;\r\n if (this._parentCurvePrimitive !== undefined)\r\n this._closestPoint.curve = this._parentCurvePrimitive;\r\n }\r\n public announceSegmentInterval(\r\n cp: CurvePrimitive, point0: Point3d, point1: Point3d, _numStrokes: number, fraction0: number, fraction1: number,\r\n ): void {\r\n let localFraction = 0;\r\n if (this._xyOnly)\r\n localFraction = SmallSystem.lineSegment3dXYClosestPointUnbounded(point0, point1, this._spacePoint) ?? 0;\r\n else\r\n localFraction = this._spacePoint.fractionOfProjectionToLine(point0, point1, 0.0);\r\n // only consider segment extension at a parent curve endpoint, i.e. when fraction0 is 0 or fraction1 is 1\r\n const extend0 = (fraction0 === 0) ? CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(this._extend, 0) : CurveExtendMode.None;\r\n const extend1 = (fraction1 === 1) ? CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(this._extend, 1) : CurveExtendMode.None;\r\n localFraction = CurveExtendOptions.correctFraction([extend0, extend1], localFraction);\r\n this._workPoint = point0.interpolate(localFraction, point1);\r\n const globalFraction = Geometry.interpolate(fraction0, localFraction, fraction1);\r\n this.announceCandidate(cp, globalFraction, this._workPoint);\r\n }\r\n /**\r\n * Given a function `f` and (unordered) fractions `a` and `b`, search for and announce a root of `f` in this\r\n * fractional interval.\r\n * * This method searches for a root of `f` if and only if the stroke segment defined by `(a, f(a))` and\r\n * `(b, f(b))` has a root. This is a HEURISTIC: given continuous `f` between `a` and `b`, a root of the stroke\r\n * segment implies a root of `f`, but not vice-versa. Therefore, if the strokes are not sufficiently dense,\r\n * this method can miss a root of `f`.\r\n */\r\n private searchInterval() {\r\n if (this._functionA * this._functionB > 0)\r\n return; // stroke segment has no root; ASSUME the function has no root either\r\n if (this._functionA === 0)\r\n this.announceSolutionFraction(this._fractionA);\r\n if (this._functionB === 0)\r\n this.announceSolutionFraction(this._fractionB);\r\n // by the Intermediate Value Theorem, a root lies between fractionA and fractionB; use Newton to find it.\r\n if (this._functionA * this._functionB < 0) {\r\n const fraction = Geometry.inverseInterpolate(this._fractionA, this._functionA, this._fractionB, this._functionB);\r\n if (fraction) {\r\n this._newtonSolver.setX(fraction);\r\n if (this._newtonSolver.runIterations())\r\n this.announceSolutionFraction(this._newtonSolver.getX());\r\n }\r\n }\r\n }\r\n private announceSolutionFraction(fraction: number) {\r\n if (this._curve)\r\n this.announceCandidate(this._curve, fraction, this._curve.fractionToPoint(fraction));\r\n }\r\n /**\r\n * Evaluate the univariate real-valued function for which we are finding roots.\r\n * * For finding the closest point to curve X from point Q, this function is `f(t) := Q-X(t) dot X'(t)`.\r\n * * Either `pointAndDerivative` must be defined, or both `fraction` and `curve`.\r\n * @param pointAndDerivative pre-evaluated curve\r\n * @param fraction fraction at which to evaluate `curve`\r\n * @param curve curve to evaluate at `fraction`\r\n */\r\n private evaluateFunction(pointAndDerivative?: Ray3d, fraction?: number, curve?: CurvePrimitive): number | undefined {\r\n if (pointAndDerivative)\r\n this._workRay.setFrom(pointAndDerivative);\r\n else if (fraction !== undefined && curve)\r\n this._workRay = curve.fractionToPointAndDerivative(fraction, this._workRay);\r\n else\r\n return undefined;\r\n if (this._xyOnly)\r\n return this._workRay.dotProductToPointXY(this._spacePoint);\r\n else\r\n return this._workRay.dotProductToPoint(this._spacePoint);\r\n }\r\n public evaluate(fraction: number): boolean {\r\n let curve = this._curve;\r\n if (this._parentCurvePrimitive)\r\n curve = this._parentCurvePrimitive;\r\n const value = this.evaluateFunction(undefined, fraction, curve);\r\n if (value === undefined)\r\n return false;\r\n this.currentF = value;\r\n return true;\r\n }\r\n private announceRay(fraction: number, data: Ray3d): void {\r\n const value = this.evaluateFunction(data);\r\n assert(value !== undefined, \"expect defined because evaluateFunction never returns undefined for input Ray3d\");\r\n this._functionB = value;\r\n this._fractionB = fraction;\r\n if (this._numThisCurve++ > 0) // after the first stroke point, a stroke segment is defined, so we have an interval\r\n this.searchInterval();\r\n this._functionA = this._functionB;\r\n this._fractionA = this._fractionB;\r\n }\r\n public announcePointTangent(point: Point3d, fraction: number, tangent: Vector3d) {\r\n this._workRay.set(point, tangent);\r\n this.announceRay(fraction, this._workRay);\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Curve
|
|
3
|
+
*/
|
|
4
|
+
import { RecurseToCurvesGeometryHandler } from "../../geometry3d/GeometryHandler";
|
|
5
|
+
import { Matrix3d } from "../../geometry3d/Matrix3d";
|
|
6
|
+
import { Point3d } from "../../geometry3d/Point3dVector3d";
|
|
7
|
+
import { Arc3d } from "../Arc3d";
|
|
8
|
+
import { CurvePrimitive } from "../CurvePrimitive";
|
|
9
|
+
type TangencyPointCollector = (spacePoint: Point3d, curve: CurvePrimitive, fraction: number) => any;
|
|
10
|
+
/**
|
|
11
|
+
* Accumulator context for searching for lines tangent to curved geometry.
|
|
12
|
+
* LIMITED IMPLEMENTATION 3/2025
|
|
13
|
+
* * Only Arc3d implements its handler
|
|
14
|
+
* * Arc3d calculation works with the projection of the space point into the plane of the arc.
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export declare class PointToCurveTangentHandler extends RecurseToCurvesGeometryHandler {
|
|
18
|
+
spacePoint: Point3d;
|
|
19
|
+
collector: TangencyPointCollector;
|
|
20
|
+
extendArcs: boolean;
|
|
21
|
+
worldToView: Matrix3d | undefined;
|
|
22
|
+
constructor(spacePoint: Point3d, collector: TangencyPointCollector, extendArcs: boolean | undefined, viewMatrix: Matrix3d | undefined);
|
|
23
|
+
handleArc3d(g: Arc3d): void;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=PointToCurveTangentHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PointToCurveTangentHandler.d.ts","sourceRoot":"","sources":["../../../../src/curve/internalContexts/PointToCurveTangentHandler.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,OAAO,EAAY,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,KAAK,sBAAsB,GAAG,CAAC,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,KAAK,GAAG,CAAC;AACpG;;;;;;GAMG;AACH,qBAAa,0BAA2B,SAAQ,8BAA8B;IACrE,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,sBAAsB,CAAC;IAClC,UAAU,EAAE,OAAO,CAAC;IAEpB,WAAW,EAAE,QAAQ,GAAG,SAAS,CAAC;gBAEvC,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,sBAAsB,EAAE,UAAU,EAAE,OAAO,YAAQ,EAAE,UAAU,EAAE,QAAQ,GAAG,SAAS;IASvG,WAAW,CAAC,CAAC,EAAE,KAAK;CA0CrC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
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 { RecurseToCurvesGeometryHandler } from "../../geometry3d/GeometryHandler";
|
|
9
|
+
import { Matrix3d } from "../../geometry3d/Matrix3d";
|
|
10
|
+
import { Vector3d } from "../../geometry3d/Point3dVector3d";
|
|
11
|
+
/**
|
|
12
|
+
* Accumulator context for searching for lines tangent to curved geometry.
|
|
13
|
+
* LIMITED IMPLEMENTATION 3/2025
|
|
14
|
+
* * Only Arc3d implements its handler
|
|
15
|
+
* * Arc3d calculation works with the projection of the space point into the plane of the arc.
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
export class PointToCurveTangentHandler extends RecurseToCurvesGeometryHandler {
|
|
19
|
+
spacePoint;
|
|
20
|
+
collector;
|
|
21
|
+
extendArcs;
|
|
22
|
+
// if available, do the tangency as viewed in the xy plane AFTER multiplying vectors by this matrix
|
|
23
|
+
worldToView;
|
|
24
|
+
constructor(spacePoint, collector, extendArcs = false, viewMatrix) {
|
|
25
|
+
super();
|
|
26
|
+
this.spacePoint = spacePoint;
|
|
27
|
+
this.collector = collector;
|
|
28
|
+
this.extendArcs = extendArcs;
|
|
29
|
+
this.worldToView = viewMatrix;
|
|
30
|
+
}
|
|
31
|
+
handleArc3d(g) {
|
|
32
|
+
const centerToPoint = Vector3d.createStartEnd(g.centerRef, this.spacePoint);
|
|
33
|
+
let localCenterToPoint;
|
|
34
|
+
if (this.worldToView) {
|
|
35
|
+
// Convert the vector spacePoint into the arc's default system in which
|
|
36
|
+
// U vector is column 0
|
|
37
|
+
// V vector is column 1
|
|
38
|
+
// worldToView row 2 is column 2
|
|
39
|
+
const arcToView = Matrix3d.createColumns(g.matrixRef.getColumn(0), g.matrixRef.getColumn(1), this.worldToView.getRow(2));
|
|
40
|
+
localCenterToPoint = arcToView.multiplyInverse(centerToPoint);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
// Convert the vector spacePoint into the arc's default system in which
|
|
44
|
+
// U vector is column 0
|
|
45
|
+
// V vector is column 1
|
|
46
|
+
// their cross product (or maybe a scale of it) is column 2.
|
|
47
|
+
localCenterToPoint = g.matrixRef.multiplyInverse(centerToPoint);
|
|
48
|
+
}
|
|
49
|
+
if (localCenterToPoint === undefined)
|
|
50
|
+
return;
|
|
51
|
+
// localCenterToPoint is measured in the (de-skewed and descaled!) coordinate system of the
|
|
52
|
+
// arc U and V axes. That is, the arc is now a unit circle.
|
|
53
|
+
// Angle alpha is from the local x axis to localCenterToPoint.
|
|
54
|
+
// Angle beta is from that to the tangency points.
|
|
55
|
+
// The inverse transformation preserves parameter angle in the ellipse sweep.
|
|
56
|
+
if (localCenterToPoint !== undefined) {
|
|
57
|
+
const distanceSquaredXYToPoint = localCenterToPoint.magnitudeSquaredXY();
|
|
58
|
+
if (distanceSquaredXYToPoint <= 1.0) {
|
|
59
|
+
// the point is inside the ellipse
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
const distanceToTangency = Math.sqrt(distanceSquaredXYToPoint - 1.0);
|
|
63
|
+
const alpha = Math.atan2(localCenterToPoint.y, localCenterToPoint.x);
|
|
64
|
+
const beta = Math.atan2(distanceToTangency, 1);
|
|
65
|
+
for (const theta of [alpha + beta, alpha - beta]) {
|
|
66
|
+
const fraction = g.sweep.radiansToPositivePeriodicFraction(theta);
|
|
67
|
+
if (this.extendArcs || fraction <= 1.0)
|
|
68
|
+
this.collector(this.spacePoint, g, fraction);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=PointToCurveTangentHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PointToCurveTangentHandler.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/PointToCurveTangentHandler.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAW,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAKrE;;;;;;GAMG;AACH,MAAM,OAAO,0BAA2B,SAAQ,8BAA8B;IACrE,UAAU,CAAU;IACpB,SAAS,CAAyB;IAClC,UAAU,CAAU;IAC3B,mGAAmG;IAC5F,WAAW,CAAuB;IACzC,YACE,UAAmB,EAAE,SAAiC,EAAE,aAAsB,KAAK,EAAE,UAAgC;QAErH,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAChC,CAAC;IAEe,WAAW,CAAC,CAAQ;QAClC,MAAM,aAAa,GAAG,QAA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AAC;gBAC/C,KAAK,MAAM,KAAK,IAAI,CAAC,KAAK,GAAG,IAAI,EAAE,KAAK,GAAG,IAAI,CAAC,EAAE,CAAC;oBACjD,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,iCAAiC,CAAC,KAAK,CAAC,CAAC;oBAClE,IAAI,IAAI,CAAC,UAAU,IAAI,QAAQ,IAAI,GAAG;wBACpC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAC;gBACjD,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;CACF","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/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { RecurseToCurvesGeometryHandler } from \"../../geometry3d/GeometryHandler\";\r\nimport { Matrix3d } from \"../../geometry3d/Matrix3d\";\r\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { Arc3d } from \"../Arc3d\";\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\n\r\ntype TangencyPointCollector = (spacePoint: Point3d, curve: CurvePrimitive, fraction: number) => any;\r\n/**\r\n * Accumulator context for searching for lines tangent to curved geometry.\r\n * LIMITED IMPLEMENTATION 3/2025\r\n * * Only Arc3d implements its handler\r\n * * Arc3d calculation works with the projection of the space point into the plane of the arc.\r\n * @internal\r\n */\r\nexport class PointToCurveTangentHandler extends RecurseToCurvesGeometryHandler {\r\n public spacePoint: Point3d;\r\n public collector: TangencyPointCollector;\r\n public extendArcs: boolean;\r\n // if available, do the tangency as viewed in the xy plane AFTER multiplying vectors by this matrix\r\n public worldToView: Matrix3d | undefined;\r\n public constructor(\r\n spacePoint: Point3d, collector: TangencyPointCollector, extendArcs: boolean = false, viewMatrix: Matrix3d | undefined,\r\n ) {\r\n super();\r\n this.spacePoint = spacePoint;\r\n this.collector = collector;\r\n this.extendArcs = extendArcs;\r\n this.worldToView = viewMatrix;\r\n }\r\n\r\n public override handleArc3d(g: Arc3d) {\r\n const centerToPoint = Vector3d.createStartEnd(g.centerRef, this.spacePoint);\r\n let localCenterToPoint: Vector3d | undefined;\r\n if (this.worldToView) {\r\n // Convert the vector spacePoint into the arc's default system in which\r\n // U vector is column 0\r\n // V vector is column 1\r\n // worldToView row 2 is column 2\r\n const arcToView = Matrix3d.createColumns(\r\n g.matrixRef.getColumn(0), g.matrixRef.getColumn(1), this.worldToView.getRow(2),\r\n );\r\n localCenterToPoint = arcToView.multiplyInverse(centerToPoint);\r\n } else {\r\n // Convert the vector spacePoint into the arc's default system in which\r\n // U vector is column 0\r\n // V vector is column 1\r\n // their cross product (or maybe a scale of it) is column 2.\r\n localCenterToPoint = g.matrixRef.multiplyInverse(centerToPoint);\r\n }\r\n if (localCenterToPoint === undefined)\r\n return;\r\n // localCenterToPoint is measured in the (de-skewed and descaled!) coordinate system of the\r\n // arc U and V axes. That is, the arc is now a unit circle.\r\n // Angle alpha is from the local x axis to localCenterToPoint.\r\n // Angle beta is from that to the tangency points.\r\n // The inverse transformation preserves parameter angle in the ellipse sweep.\r\n if (localCenterToPoint !== undefined) {\r\n const distanceSquaredXYToPoint = localCenterToPoint.magnitudeSquaredXY();\r\n if (distanceSquaredXYToPoint <= 1.0) {\r\n // the point is inside the ellipse\r\n } else {\r\n const distanceToTangency = Math.sqrt(distanceSquaredXYToPoint - 1.0)\r\n const alpha = Math.atan2(localCenterToPoint.y, localCenterToPoint.x);\r\n const beta = Math.atan2(distanceToTangency, 1);\r\n for (const theta of [alpha + beta, alpha - beta]) {\r\n const fraction = g.sweep.radiansToPositivePeriodicFraction(theta);\r\n if (this.extendArcs || fraction <= 1.0)\r\n this.collector(this.spacePoint, g, fraction);\r\n }\r\n }\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module CartesianGeometry
|
|
3
|
+
*/
|
|
4
|
+
import { XAndY } from "../../../geometry3d/XYZProps";
|
|
5
|
+
import { ImplicitCurve2d, ImplicitGeometryMarkup } from "./ImplicitCurve2d";
|
|
6
|
+
import { UnboundedCircle2dByCenterAndRadius } from "./UnboundedCircle2d";
|
|
7
|
+
import { UnboundedLine2dByPointAndNormal } from "./UnboundedLine2d";
|
|
8
|
+
/**
|
|
9
|
+
* Static methods for special case circle and line tangent constructions.
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export declare class ConstrainedImplicitCurve2d {
|
|
13
|
+
/**
|
|
14
|
+
* Return all (i.e., up to 4) circles that are tangent to 3 given lines.
|
|
15
|
+
* @param lineA first line
|
|
16
|
+
* @param lineB second line
|
|
17
|
+
* @param lineC third line
|
|
18
|
+
*/
|
|
19
|
+
static circlesTangentLLL(lineA: UnboundedLine2dByPointAndNormal, lineB: UnboundedLine2dByPointAndNormal, lineC: UnboundedLine2dByPointAndNormal): ImplicitGeometryMarkup<UnboundedCircle2dByCenterAndRadius>[] | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Return all (i.e., up to 2) unbounded lines perpendicular to a line and tangent to a circle.
|
|
22
|
+
* @param line the line
|
|
23
|
+
* @param circle the circle
|
|
24
|
+
*/
|
|
25
|
+
static linesPerpLTangentC(line: UnboundedLine2dByPointAndNormal, circle: UnboundedCircle2dByCenterAndRadius): ImplicitGeometryMarkup<UnboundedLine2dByPointAndNormal>[] | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Return all (i.e., 4) variants of the line perpendicular to 2 circles (line between centers, with ends at crossing
|
|
28
|
+
* points on respective circles).
|
|
29
|
+
* @param circleA first circle
|
|
30
|
+
* @param circleB second circle
|
|
31
|
+
*/
|
|
32
|
+
static linesPerpCPerpC(circleA: UnboundedCircle2dByCenterAndRadius, circleB: UnboundedCircle2dByCenterAndRadius): ImplicitGeometryMarkup<UnboundedLine2dByPointAndNormal>[] | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Return all (i.e., up to 2) unbounded lines perpendicular to a line and a circle.
|
|
35
|
+
* @param line the line
|
|
36
|
+
* @param circle the circle
|
|
37
|
+
*/
|
|
38
|
+
static linesPerpLPerpC(line: UnboundedLine2dByPointAndNormal, circle: UnboundedCircle2dByCenterAndRadius): ImplicitGeometryMarkup<UnboundedLine2dByPointAndNormal>[] | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Return all (i.e., up to 4) unbounded lines perpendicular to a circle and tangent to a circle.
|
|
41
|
+
* Note that multiple colinear lines are returned tagged with diametrically opposing points of circleA.
|
|
42
|
+
* @param circleA first circle (for perpendicular constraint)
|
|
43
|
+
* @param circleB second circle (for tangent constraint)
|
|
44
|
+
*/
|
|
45
|
+
static linesPerpCTangentC(circleA: UnboundedCircle2dByCenterAndRadius, circleB: UnboundedCircle2dByCenterAndRadius): ImplicitGeometryMarkup<UnboundedLine2dByPointAndNormal>[] | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Return all (i.e., up to 4) unbounded lines tangent to 2 circles.
|
|
48
|
+
* * There are 4 lines if there is neither intersection nor containment between the circles
|
|
49
|
+
* * There are 2 lines if the circles intersect
|
|
50
|
+
* * THere are no lines if the one circle is entirely inside the other.
|
|
51
|
+
* @param circleA first circle
|
|
52
|
+
* @param circleB second circle
|
|
53
|
+
*/
|
|
54
|
+
static linesTangentCC(circleA: UnboundedCircle2dByCenterAndRadius, circleB: UnboundedCircle2dByCenterAndRadius): ImplicitGeometryMarkup<UnboundedLine2dByPointAndNormal>[] | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Return all (i.e., up to 8) circles tangent to two lines and a circle.
|
|
57
|
+
* * There are 8 circles if the circle contains the intersection of the lines.
|
|
58
|
+
* * There are 2 circles if the circle is completely contained in one quadrant bounded by the two lines.
|
|
59
|
+
* * There are 2 circles if the circle intersects one ray outward from the intersection.
|
|
60
|
+
* * There are 4 circles if the circle intersects two of the outward rays.
|
|
61
|
+
*/
|
|
62
|
+
static circlesTangentLLC(lineA: UnboundedLine2dByPointAndNormal, lineB: UnboundedLine2dByPointAndNormal, circle: UnboundedCircle2dByCenterAndRadius): ImplicitGeometryMarkup<UnboundedCircle2dByCenterAndRadius>[] | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* Return all (i.e., up to 4) circles tangent to 2 circles and a line.
|
|
65
|
+
* @param circleA first circle
|
|
66
|
+
* @param circleB second circle
|
|
67
|
+
* @param line the line
|
|
68
|
+
*/
|
|
69
|
+
static circlesTangentCCL(circleA: UnboundedCircle2dByCenterAndRadius, circleB: UnboundedCircle2dByCenterAndRadius, line: UnboundedLine2dByPointAndNormal): ImplicitGeometryMarkup<UnboundedCircle2dByCenterAndRadius>[] | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Special case CCC tangent construction when inputs are colinear.
|
|
72
|
+
* @param circleA first input circle
|
|
73
|
+
* @param circleB second input circle
|
|
74
|
+
* @param circleC third input circle
|
|
75
|
+
* @param rA signed radius for circleA
|
|
76
|
+
* @param rB signed radius for circleB
|
|
77
|
+
* @param rC signed radius for circleC
|
|
78
|
+
* @param result pre-initialized array to which tangent circle markup will be added.
|
|
79
|
+
*/
|
|
80
|
+
private static solveColinearCCCTangents;
|
|
81
|
+
/**
|
|
82
|
+
* Return all (i.e., up to 8) circles tangent to 3 circles.
|
|
83
|
+
* @param circles the three input circles
|
|
84
|
+
*/
|
|
85
|
+
private static circlesTangentCCCThisOrder;
|
|
86
|
+
/**
|
|
87
|
+
* Return all (i.e., up to 8) circles tangent to 3 circles.
|
|
88
|
+
* @param circleA first circle
|
|
89
|
+
* @param circleB second circle
|
|
90
|
+
* @param circleC third circle
|
|
91
|
+
*/
|
|
92
|
+
static circlesTangentCCC(circleA: UnboundedCircle2dByCenterAndRadius, circleB: UnboundedCircle2dByCenterAndRadius, circleC: UnboundedCircle2dByCenterAndRadius): ImplicitGeometryMarkup<UnboundedCircle2dByCenterAndRadius>[] | undefined;
|
|
93
|
+
/**
|
|
94
|
+
* Return an unbounded line with the midpoint between pointA and pointB as its reference point
|
|
95
|
+
* and the unit vector from pointA towards pointB as its normal.
|
|
96
|
+
* @param pointA first point
|
|
97
|
+
* @param pointB second point
|
|
98
|
+
* @returns unbounded line, or undefined if pointA and pointB are coincident.
|
|
99
|
+
*/
|
|
100
|
+
static bisector(pointA: XAndY, pointB: XAndY): UnboundedLine2dByPointAndNormal | undefined;
|
|
101
|
+
/**
|
|
102
|
+
* Compute circles of specified radius tangent to each of the lines
|
|
103
|
+
* * There are normally 4 circles
|
|
104
|
+
* * The undefined case occurs when the lines are parallel.
|
|
105
|
+
* @param lineA first line
|
|
106
|
+
* @param lineB second line
|
|
107
|
+
* @param radius radius of tangent circles
|
|
108
|
+
* @returns array of circles with annotated tangencies. returns undefined if lines are parallel.
|
|
109
|
+
*/
|
|
110
|
+
static circlesTangentLLR(lineA: UnboundedLine2dByPointAndNormal, lineB: UnboundedLine2dByPointAndNormal, radius: number): ImplicitGeometryMarkup<UnboundedCircle2dByCenterAndRadius>[] | undefined;
|
|
111
|
+
/**
|
|
112
|
+
* Compute circles of specified radius tangent to both a line and an arc
|
|
113
|
+
* * There can be 0 to 8 circles
|
|
114
|
+
* * The undefined case occurs when the smallest distance from circle to line exceeds radius.
|
|
115
|
+
* @param circleA the circle
|
|
116
|
+
* @param lineB the line
|
|
117
|
+
* @param radius radius of tangent circles
|
|
118
|
+
* @returns array of circles with annotated tangencies
|
|
119
|
+
*/
|
|
120
|
+
static circlesTangentCLR(circleA: UnboundedCircle2dByCenterAndRadius, lineB: UnboundedLine2dByPointAndNormal, radius: number): ImplicitGeometryMarkup<UnboundedCircle2dByCenterAndRadius>[] | undefined;
|
|
121
|
+
/**
|
|
122
|
+
* Compute circles of specified radius tangent to both circles
|
|
123
|
+
* * There can be 0 to 8 circles
|
|
124
|
+
* * The undefined case is when the smallest distance between the circles exceeds the requested radius.
|
|
125
|
+
* @param circleA the first circle
|
|
126
|
+
* @param circleB the second circle
|
|
127
|
+
* @param radius radius of tangent circles
|
|
128
|
+
* @returns array of circles with annotated tangencies
|
|
129
|
+
*/
|
|
130
|
+
static circlesTangentCCR(circleA: UnboundedCircle2dByCenterAndRadius, circleB: UnboundedCircle2dByCenterAndRadius, radius: number): ImplicitGeometryMarkup<UnboundedCircle2dByCenterAndRadius>[] | undefined;
|
|
131
|
+
/**
|
|
132
|
+
* Construct basis vectors for hyperbola or ellipse whose points are equidistant from tangencies with
|
|
133
|
+
* circleA and circleB.
|
|
134
|
+
* * If the curve is a hyperbola, the equation is
|
|
135
|
+
* X = center + vectorU * sec(theta) + vectorV * tan(theta)
|
|
136
|
+
* * If the curve is an ellipse, the equation is
|
|
137
|
+
* X = center + vectorU * cos(theta) + vectorV * sin(theta)
|
|
138
|
+
* @param circleA first circle
|
|
139
|
+
* @param circleB second circle
|
|
140
|
+
*/
|
|
141
|
+
static medialCurveCircleCircle(circleA: UnboundedCircle2dByCenterAndRadius, circleB: UnboundedCircle2dByCenterAndRadius): ImplicitCurve2d | undefined;
|
|
142
|
+
/**
|
|
143
|
+
* Construct parabolas whose points are equidistant from tangencies with
|
|
144
|
+
* circleA and circleB.
|
|
145
|
+
* * Note that if th e circle has non-zero radius there are two parabolas based on
|
|
146
|
+
* tangencies on near or far side of the circle.
|
|
147
|
+
* @param line the line
|
|
148
|
+
* @param circle the circle
|
|
149
|
+
*/
|
|
150
|
+
static medialCurveLineCircle(line: UnboundedLine2dByPointAndNormal, circle: UnboundedCircle2dByCenterAndRadius): ImplicitCurve2d[] | undefined;
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=ConstrainedImplicitCurve2d.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConstrainedImplicitCurve2d.d.ts","sourceRoot":"","sources":["../../../../../src/curve/internalContexts/geometry2d/ConstrainedImplicitCurve2d.ts"],"names":[],"mappings":"AAIA;;EAEE;AAMF,OAAO,EAAE,KAAK,EA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