@itwin/core-geometry 5.14.3 → 5.15.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/curve/CurveExtendMode.d.ts.map +1 -1
- package/lib/cjs/curve/CurveExtendMode.js +10 -15
- package/lib/cjs/curve/CurveExtendMode.js.map +1 -1
- package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
- package/lib/cjs/curve/CurveLocationDetail.js +16 -1
- package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
- package/lib/cjs/geometry3d/AngleSweep.d.ts +27 -3
- package/lib/cjs/geometry3d/AngleSweep.d.ts.map +1 -1
- package/lib/cjs/geometry3d/AngleSweep.js +39 -7
- package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
- package/lib/esm/curve/CurveExtendMode.d.ts.map +1 -1
- package/lib/esm/curve/CurveExtendMode.js +10 -15
- package/lib/esm/curve/CurveExtendMode.js.map +1 -1
- package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
- package/lib/esm/curve/CurveLocationDetail.js +16 -1
- package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
- package/lib/esm/geometry3d/AngleSweep.d.ts +27 -3
- package/lib/esm/geometry3d/AngleSweep.d.ts.map +1 -1
- package/lib/esm/geometry3d/AngleSweep.js +38 -6
- package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log - @itwin/core-geometry
|
|
2
2
|
|
|
3
|
-
This log was last generated on Mon, 12 Oct 2026 17:
|
|
3
|
+
This log was last generated on Mon, 12 Oct 2026 17:39:12 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
## 5.14.3
|
|
6
6
|
Mon, 12 Oct 2026 17:37:54 GMT
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurveExtendMode.d.ts","sourceRoot":"","sources":["../../../src/curve/CurveExtendMode.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"CurveExtendMode.d.ts","sourceRoot":"","sources":["../../../src/curve/CurveExtendMode.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,UAAU,EAA4B,MAAM,0BAA0B,CAAC;AAEhF;;;;GAIG;AACH,oBAAY,eAAe;IACzB,4BAA4B;IAC5B,IAAI,IAAI;IACR,qEAAqE;IACrE,SAAS,IAAI;IACb,8CAA8C;IAC9C,OAAO,IAAI;CACZ;AACD;;;GAGG;AACH,qBAAa,kBAAkB;IAC7B;;;;;;OAMG;WACW,mDAAmD,CAC/D,KAAK,EAAE,2BAA2B,GAAG,SAAS,EAAE,QAAQ,EAAE,CAAC,GAAG,CAAC,GAC9D,eAAe;IAUlB;;;;;OAKG;WACW,eAAe,CAAC,WAAW,EAAE,2BAA2B,GAAG,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;IAa7G;;;;;;;;;OASG;WACW,kCAAkC,CAC9C,WAAW,EAAE,2BAA2B,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GACvF;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE;IAkBzC,gFAAgF;WAClE,6BAA6B,CACzC,WAAW,EAAE,2BAA2B,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GACvF,MAAM;CAGV;AACD;;;;;GAKG;AACH,MAAM,MAAM,2BAA2B,GAAG,OAAO,GAAG,eAAe,GAAG,eAAe,EAAE,CAAC"}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.CurveExtendOptions = exports.CurveExtendMode = void 0;
|
|
11
11
|
const Geometry_1 = require("../Geometry");
|
|
12
|
+
const AngleSweep_1 = require("../geometry3d/AngleSweep");
|
|
12
13
|
/**
|
|
13
14
|
* Enumeration of condition for extending a curve beyond start or end point.
|
|
14
15
|
* * Not all CurvePrimitives support these modes.
|
|
@@ -76,27 +77,21 @@ class CurveExtendOptions {
|
|
|
76
77
|
* the sweep extended per `extendParam`.
|
|
77
78
|
*/
|
|
78
79
|
static resolveRadiansToValidSweepFraction(extendParam, radians, sweep) {
|
|
79
|
-
|
|
80
|
-
let fraction = sweep.radiansToSignedPeriodicFraction(radians);
|
|
80
|
+
let fraction = sweep.radiansToSignedPeriodicFraction(radians, 0, AngleSweep_1.ExteriorFractionSelector.Closer);
|
|
81
81
|
let isValid = true;
|
|
82
|
-
if (!
|
|
83
|
-
const fractionPeriod = sweep.fractionPeriod();
|
|
82
|
+
if (!Geometry_1.Geometry.isIn01(fraction)) {
|
|
84
83
|
const mode0 = CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extendParam, 0);
|
|
85
84
|
const mode1 = CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extendParam, 1);
|
|
86
|
-
if (mode0
|
|
87
|
-
if (mode1 === CurveExtendMode.None) { // only extend to negative
|
|
88
|
-
if (fraction > 1.0)
|
|
89
|
-
fraction -= fractionPeriod;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
else if (mode1 !== CurveExtendMode.None) { // only extend to positive
|
|
93
|
-
if (fraction < 0.0)
|
|
94
|
-
fraction += fractionPeriod;
|
|
95
|
-
}
|
|
96
|
-
else { // no extension allowed
|
|
85
|
+
if (mode0 === CurveExtendMode.None && mode1 === CurveExtendMode.None) {
|
|
97
86
|
fraction = Geometry_1.Geometry.clamp(fraction, 0, 1);
|
|
98
87
|
isValid = false;
|
|
99
88
|
}
|
|
89
|
+
else if (mode1 === CurveExtendMode.None && mode0 !== CurveExtendMode.None) {
|
|
90
|
+
fraction = sweep.radiansToSignedPeriodicFraction(radians, 0, AngleSweep_1.ExteriorFractionSelector.Negative);
|
|
91
|
+
}
|
|
92
|
+
else if (mode0 === CurveExtendMode.None && mode1 !== CurveExtendMode.None) {
|
|
93
|
+
fraction = sweep.radiansToSignedPeriodicFraction(radians, 0, AngleSweep_1.ExteriorFractionSelector.Positive);
|
|
94
|
+
}
|
|
100
95
|
}
|
|
101
96
|
return { fraction, isValid };
|
|
102
97
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurveExtendMode.js","sourceRoot":"","sources":["../../../src/curve/CurveExtendMode.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,0CAAuC;
|
|
1
|
+
{"version":3,"file":"CurveExtendMode.js","sourceRoot":"","sources":["../../../src/curve/CurveExtendMode.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,0CAAuC;AACvC,yDAAgF;AAEhF;;;;GAIG;AACH,IAAY,eAOX;AAPD,WAAY,eAAe;IACzB,4BAA4B;IAC5B,qDAAQ,CAAA;IACR,qEAAqE;IACrE,+DAAa,CAAA;IACb,8CAA8C;IAC9C,2DAAW,CAAA;AACb,CAAC,EAPW,eAAe,+BAAf,eAAe,QAO1B;AACD;;;GAGG;AACH,MAAa,kBAAkB;IAC7B;;;;;;OAMG;IACI,MAAM,CAAC,mDAAmD,CAC/D,KAA8C,EAAE,QAAe;QAE/D,KAAK,KAAK,KAAK,CAAC;QAChB,IAAI,KAAK,KAAK,KAAK;YACjB,OAAO,eAAe,CAAC,IAAI,CAAC;QAC9B,IAAI,KAAK,KAAK,IAAI;YAChB,OAAO,eAAe,CAAC,OAAO,CAAC;QACjC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;YACtB,OAAO,KAAK,CAAC,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC;QAC1E,OAAO,KAAK,CAAC;IACf,CAAC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K,CAAC;YAClB,CAAC;iBAAM,IAAI,KAAK,KAAK,eAAe,CAAC,IAAI,IAAI,KAAK,KAAK,eAAe,CAAC,IAAI,EAAE,CAAC;gBAC5E,QAAQ,GAAG,KAAK,CAAC,+BAA+B,CAAC,OAAO,EAAE,CAAC,EAAE,qCAAwB,CAAC,QAAQ,CAAC,CAAC;YAClG,CAAC;iBAAM,IAAI,KAAK,KAAK,eAAe,CAAC,IAAI,IAAI,KAAK,KAAK,eAAe,CAAC,IAAI,EAAE,CAAC;gBAC5E,QAAQ,GAAG,KAAK,CAAC,+BAA+B,CAAC,OAAO,EAAE,CAAC,EAAE,qCAAwB,CAAC,QAAQ,CAAC,CAAC;YAClG,CAAC;QACH,CAAC;QACH,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;IAC7B,CAAC;IAED,gFAAgF;IACzE,MAAM,CAAC,6BAA6B,CACzC,WAAoD,EAAE,OAAe,EAAE,KAAiB;QAExF,OAAO,IAAI,CAAC,kCAAkC,CAAC,WAAW,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC;IACvF,CAAC;CACF;AA3ED,gDA2EC","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 { Geometry } from \"../Geometry\";\r\nimport { AngleSweep, ExteriorFractionSelector } from \"../geometry3d/AngleSweep\";\r\n\r\n/**\r\n * Enumeration of condition for extending a curve beyond start or end point.\r\n * * Not all CurvePrimitives support these modes.\r\n * @public\r\n */\r\nexport enum CurveExtendMode {\r\n /** No extension allowed. */\r\n None = 0,\r\n /** Extend along continuation of the end tangent. Not implemented. */\r\n OnTangent = 1,\r\n /** Extend along continuation of the curve. */\r\n OnCurve = 2,\r\n}\r\n/**\r\n * Logic for deciding how a curve may be extended for closest point or intersection searches.\r\n * @public\r\n */\r\nexport class CurveExtendOptions {\r\n /**\r\n * Given a `VariantCurveExtendParameter`, isolate the particular CurveExtendMode in effect at an end.\r\n * * Return `CurveExtendMode.None` if `param === false`.\r\n * * Return `CurveExtendMode.OnCurve` if `param === true`.\r\n * * Return the param if it is a single CurveExtendMode.\r\n * * Return dereferenced array at entry `endIndex` if the param is an array of CurveExtendMode.\r\n */\r\n public static resolveVariantCurveExtendParameterToCurveExtendMode(\r\n param: VariantCurveExtendParameter | undefined, endIndex: 0 | 1,\r\n ): CurveExtendMode {\r\n param ??= false;\r\n if (param === false)\r\n return CurveExtendMode.None;\r\n if (param === true)\r\n return CurveExtendMode.OnCurve;\r\n if (Array.isArray(param))\r\n return param.length > endIndex ? param[endIndex] : CurveExtendMode.None;\r\n return param;\r\n }\r\n /**\r\n * Correct fraction to be within [0,1].\r\n * * If fraction is in [0,1] return it unchanged.\r\n * * If fraction is less than 0 use `extendParam` to decide whether to return it unchanged, or to return 0.\r\n * * If fraction is greater than 1 use `extendParam` to decide whether to return it unchanged, or to return 1.\r\n */\r\n public static correctFraction(extendParam: VariantCurveExtendParameter | undefined, fraction: number): number {\r\n extendParam ??= false;\r\n if (fraction < 0) {\r\n const mode = CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extendParam, 0);\r\n if (mode === CurveExtendMode.None)\r\n fraction = 0.0;\r\n } else if (fraction > 1.0) {\r\n const mode = CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extendParam, 1);\r\n if (mode === CurveExtendMode.None)\r\n fraction = 1.0;\r\n }\r\n return fraction;\r\n }\r\n /**\r\n * Adjust a radians value to an angle sweep, extending beyond or clamping to [0,1] according to `extendParam`:\r\n * * If `radians` is within the sweep, convert it to a fraction of the sweep.\r\n * * If `radians` is outside the sweep and `extendParam` does not allow extension at both ends, adjust the fraction:\r\n * * fraction below 0 if `extendParam` allows extension only at start\r\n * * fraction above 1 if `extendParam` allows extension only at end\r\n * * fraction clamped to [0,1] if `extendParam` disallows extension at both ends\r\n * @returns adjusted fraction of sweep, and a boolean indicating whether it is valid, i.e. whether `radians` lies in\r\n * the sweep extended per `extendParam`.\r\n */\r\n public static resolveRadiansToValidSweepFraction(\r\n extendParam: VariantCurveExtendParameter | undefined, radians: number, sweep: AngleSweep,\r\n ): { fraction: number, isValid: boolean } {\r\n let fraction = sweep.radiansToSignedPeriodicFraction(radians, 0, ExteriorFractionSelector.Closer);\r\n let isValid = true;\r\n if (!Geometry.isIn01(fraction)) {\r\n const mode0 = CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extendParam, 0);\r\n const mode1 = CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extendParam, 1);\r\n if (mode0 === CurveExtendMode.None && mode1 === CurveExtendMode.None) {\r\n fraction = Geometry.clamp(fraction, 0, 1);\r\n isValid = false;\r\n } else if (mode1 === CurveExtendMode.None && mode0 !== CurveExtendMode.None) {\r\n fraction = sweep.radiansToSignedPeriodicFraction(radians, 0, ExteriorFractionSelector.Negative);\r\n } else if (mode0 === CurveExtendMode.None && mode1 !== CurveExtendMode.None) {\r\n fraction = sweep.radiansToSignedPeriodicFraction(radians, 0, ExteriorFractionSelector.Positive);\r\n }\r\n }\r\n return { fraction, isValid };\r\n }\r\n\r\n /** Call [[resolveRadiansToValidSweepFraction]] and return only the fraction. */\r\n public static resolveRadiansToSweepFraction(\r\n extendParam: VariantCurveExtendParameter | undefined, radians: number, sweep: AngleSweep,\r\n ): number {\r\n return this.resolveRadiansToValidSweepFraction(extendParam, radians, sweep).fraction;\r\n }\r\n}\r\n/**\r\n * Variant options for extending a curve.\r\n * * Useful for specifying either a single boolean/`CurveExtendMode` option applicable to both ends of the curve,\r\n * or an array of options, the first entry of which applies to the curve start; the second, to curve end.\r\n * @public\r\n */\r\nexport type VariantCurveExtendParameter = boolean | CurveExtendMode | CurveExtendMode[];\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"C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GAAE,MAAqC,EAC/C,MAAM,GAAE,OAAe,EACvB,0BAA0B,GAAE,OAAe,GAC1C,iBAAiB,CAAC,uBAAuB,CAAC;IAgC7C;;;;;OAKG;WACW,oBAAoB,CAChC,QAAQ,GAAE,MAAqC,EAC/C,MAAM,GAAE,OAAe,GACtB,iBAAiB,CAAC,uBAAuB,CAAC;CAW9C;AAED;;;;GAIG;AACH,qBAAa,4BAA4B;IACvC,8BAA8B;IACvB,KAAK,EAAE,mBAAmB,EAAE,CAAC;IACpC,+BAA+B;IACxB,KAAK,EAAE,mBAAmB,EAAE,CAAC;;CAKrC"}
|
|
@@ -365,7 +365,22 @@ class CurveLocationDetail {
|
|
|
365
365
|
if (detailA) {
|
|
366
366
|
if (!detailB)
|
|
367
367
|
return detailA;
|
|
368
|
-
|
|
368
|
+
// tiebreakers (exact comparison!)
|
|
369
|
+
if (detailA.a === detailB.a) {
|
|
370
|
+
// prefer interior to exterior
|
|
371
|
+
const isInteriorA = Geometry_1.Geometry.isIn01(detailA.fraction);
|
|
372
|
+
const isInteriorB = Geometry_1.Geometry.isIn01(detailB.fraction);
|
|
373
|
+
if (isInteriorA && !isInteriorB)
|
|
374
|
+
return detailA;
|
|
375
|
+
if (!isInteriorA && isInteriorB)
|
|
376
|
+
return detailB;
|
|
377
|
+
if (!isInteriorA && !isInteriorB) { // prefer exterior closer to [0,1]
|
|
378
|
+
const distFrom01A = detailA.fraction < 0 ? -detailA.fraction : detailA.fraction - 1;
|
|
379
|
+
const distFrom01B = detailB.fraction < 0 ? -detailB.fraction : detailB.fraction - 1;
|
|
380
|
+
return (distFrom01A <= distFrom01B) ? detailA : detailB;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
return detailA.a < detailB.a ? detailA : detailB;
|
|
369
384
|
}
|
|
370
385
|
return detailB;
|
|
371
386
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurveLocationDetail.js","sourceRoot":"","sources":["../../../src/curve/CurveLocationDetail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AC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC;QAC3C,CAAC,CAAC;IACJ,CAAC;CACF;AA7JD,0DA6JC;AAED;;;;GAIG;AACH,MAAa,4BAA4B;IACvC,8BAA8B;IACvB,KAAK,CAAwB;IACpC,+BAA+B;IACxB,KAAK,CAAwB;IACpC;QACE,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;IAClB,CAAC;CACF;AATD,oEASC","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\nimport { assert, OrderedComparator } from \"@itwin/core-bentley\";\r\nimport { Geometry, ICloneable } from \"../Geometry\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Ray3d } from \"../geometry3d/Ray3d\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { XYAndZ } from \"../geometry3d/XYZProps\";\r\nimport { CurvePrimitive } from \"./CurvePrimitive\";\r\n\r\n/**\r\n * An enumeration of special conditions being described by a CurveLocationDetail.\r\n * @public\r\n */\r\nexport enum CurveIntervalRole {\r\n /** This point is an isolated point NOT at a primary vertex. */\r\n isolated = 0,\r\n /** This point is an isolated vertex hit */\r\n isolatedAtVertex = 1,\r\n /** This is the beginning of an interval */\r\n intervalStart = 10,\r\n /** This is an interior point of an interval. */\r\n intervalInterior = 11,\r\n /** This is the end of an interval */\r\n intervalEnd = 12,\r\n}\r\n\r\n/**\r\n * Return code for CurvePrimitive method `moveSignedDistanceFromFraction`\r\n * @public\r\n */\r\nexport enum CurveSearchStatus {\r\n /** Unimplemented or zero length curve */\r\n error,\r\n /** Complete success of search */\r\n success = 1,\r\n /** Search ended prematurely (e.g. at incomplete distance moved) at start or end of curve */\r\n stoppedAtBoundary = 2,\r\n}\r\n\r\n/**\r\n * Use to update a cloneable object when source and/or prior result are possibly undefined.\r\n * * Any undefined source returns undefined.\r\n * * For defined source, reuse optional result if available.\r\n * @param source optional source\r\n * @param result optional result\r\n */\r\nfunction optionalUpdate<T extends ICloneable<T>>(source: T | undefined, result: T | undefined): T | undefined {\r\n return source ? source.clone(result) : undefined;\r\n}\r\n\r\n/**\r\n * CurveLocationDetail carries point and parameter data about a point evaluated on a curve.\r\n * * These are returned by a variety of queries.\r\n * * Particular contents can vary among the queries.\r\n * @public\r\n */\r\nexport class CurveLocationDetail {\r\n /** The curve being evaluated. */\r\n public curve?: CurvePrimitive;\r\n /** Optional ray. */\r\n public ray?: Ray3d;\r\n /** The fractional position along the curve. */\r\n public fraction: number;\r\n /** Detail condition of the role this point has in some context. */\r\n public intervalRole?: CurveIntervalRole;\r\n /** The point on the curve. */\r\n public point: Point3d;\r\n /** A vector (e.g. tangent vector) in context. */\r\n public vectorInCurveLocationDetail?: Vector3d;\r\n /** A context-specific numeric value (e.g., a distance). */\r\n public a: number;\r\n /**\r\n * Optional CurveLocationDetail with more detail of location. For instance, a detail for fractional position\r\n * within a CurveChainWithDistanceIndex returns fraction and distance along the chain as its primary data and\r\n * further detail of the particular curve within the chain in the childDetail.\r\n */\r\n public childDetail?: CurveLocationDetail;\r\n /**\r\n * A status indicator for certain searches.\r\n * * e.g., CurvePrimitive.moveSignedDistanceFromFraction.\r\n */\r\n public curveSearchStatus?: CurveSearchStatus;\r\n /** (Optional) second fraction, e.g. end of interval of coincident curves. */\r\n public fraction1?: number;\r\n /** (Optional) second point, e.g. end of interval of coincident curves. */\r\n public point1?: Point3d;\r\n /** A context-specific temporary point, e.g. for intermediate calculations. */\r\n public pointQ: Point3d;\r\n /** Constructor */\r\n public constructor() {\r\n this.pointQ = Point3d.createZero();\r\n this.fraction = 0;\r\n this.point = Point3d.createZero();\r\n this.a = 0.0;\r\n }\r\n /** Set the (optional) intervalRole field. */\r\n public setIntervalRole(value: CurveIntervalRole): void {\r\n this.intervalRole = value;\r\n }\r\n /** Set the `fraction` and `point`, using direct assignment (capture!) to `point`. */\r\n public captureFractionPoint(fraction: number, point: Point3d): void {\r\n this.fraction = fraction;\r\n this.point = point;\r\n }\r\n /** Set the (optional) `fraction1` and `point1`, using direct assignment (capture!) to `point1`. */\r\n public captureFraction1Point1(fraction1: number, point1: Point3d): void {\r\n this.fraction1 = fraction1;\r\n this.point1 = point1;\r\n }\r\n /** Test if this pair has fraction1 defined. */\r\n public get hasFraction1(): boolean {\r\n return this.fraction1 !== undefined;\r\n }\r\n /** Test if this detail defines an interval. Preferable to [[CurveLocationDetail.hasFraction1]]. */\r\n public isInterval(): this is { fraction1: number, point1: Point3d } {\r\n return this.fraction1 !== undefined && this.point1 !== undefined;\r\n }\r\n /** Test if this is an isolated point. This is true if intervalRole is any of (undefined, isolated, isolatedAtVertex). */\r\n public get isIsolated(): boolean {\r\n return this.intervalRole === undefined\r\n || this.intervalRole === CurveIntervalRole.isolated\r\n || this.intervalRole === CurveIntervalRole.isolatedAtVertex;\r\n }\r\n /** Return the fraction delta. (0 if no fraction1). */\r\n public get fractionDelta(): number {\r\n return this.fraction1 !== undefined ? this.fraction1 - this.fraction : 0.0;\r\n }\r\n /**\r\n * If (fraction1, point1) are defined, make them the primary (and only) data.\r\n * * No action if undefined.\r\n */\r\n public collapseToEnd() {\r\n if (this.fraction1 !== undefined)\r\n this.fraction = this.fraction1;\r\n if (this.point1)\r\n this.point = this.point1;\r\n this.collapseToStart();\r\n }\r\n /** Make (fraction, point) the primary (and only) data. */\r\n public collapseToStart() {\r\n this.fraction1 = undefined;\r\n this.point1 = undefined;\r\n }\r\n /**\r\n * Return a complete copy, WITH CAVEATS.\r\n * * curve member is copied as a reference.\r\n * * point and vector members are cloned.\r\n */\r\n public clone(result?: CurveLocationDetail): CurveLocationDetail {\r\n if (result === this)\r\n return result;\r\n result = result ? result : new CurveLocationDetail();\r\n result.curve = this.curve;\r\n result.fraction = this.fraction;\r\n result.fraction1 = this.fraction1;\r\n result.point1 = optionalUpdate<Point3d>(this.point1, result.point1);\r\n result.point.setFromPoint3d(this.point);\r\n result.vectorInCurveLocationDetail = optionalUpdate<Vector3d>(this.vectorInCurveLocationDetail, result.vectorInCurveLocationDetail);\r\n result.a = this.a;\r\n result.childDetail = optionalUpdate<CurveLocationDetail>(this.childDetail, result.childDetail);\r\n result.curveSearchStatus = this.curveSearchStatus;\r\n return result;\r\n }\r\n /**\r\n * Updated in this instance.\r\n * * Note that if caller omits `vector` and `a`, those fields are updated to the call-list defaults (NOT left as-is)\r\n * * point and vector updates are by data copy (not capture of pointers).\r\n * @param fraction (required) fraction to install.\r\n * @param point (required) point to install.\r\n * @param vector (optional) vector to install.\r\n * @param a (optional) numeric value to install.\r\n */\r\n public setFP(fraction: number, point: XYAndZ, vector?: Vector3d, a: number = 0.0): void {\r\n this.fraction = fraction;\r\n this.point.setFromPoint3d(point);\r\n this.vectorInCurveLocationDetail = optionalUpdate<Vector3d>(vector, this.vectorInCurveLocationDetail);\r\n this.a = a;\r\n }\r\n /**\r\n * Updated in this instance.\r\n * * Note that if caller omits a`, that field is updated to the call-list default (NOT left as-is)\r\n * * point and vector updates are by data copy (not capture of the ray members).\r\n * @param fraction (required) fraction to install.\r\n * @param ray (required) point and vector to install.\r\n * @param a (optional) numeric value to install.\r\n */\r\n public setFR(fraction: number, ray: Ray3d, a: number = 0): void {\r\n return this.setFP(fraction, ray.origin, ray.direction, a);\r\n }\r\n /** Set the CurvePrimitive pointer, leaving all other properties untouched. */\r\n public setCurve(curve: CurvePrimitive) {\r\n this.curve = curve;\r\n }\r\n /** Record the distance from the CurveLocationDetail's point to the parameter point. */\r\n public setDistanceTo(point: XYAndZ) {\r\n this.a = this.point.distance(point);\r\n }\r\n /** Create with a CurvePrimitive pointer but no coordinate data. */\r\n public static create(curve?: CurvePrimitive, result?: CurveLocationDetail): CurveLocationDetail {\r\n result = result ? result : new CurveLocationDetail();\r\n result.curve = curve;\r\n return result;\r\n }\r\n /** Create a new detail using CurvePrimitive pointer, fraction, and point coordinates. */\r\n public static createCurveFractionPoint(\r\n curve: CurvePrimitive | undefined, fraction: number, point: XYAndZ, result?: CurveLocationDetail,\r\n ): CurveLocationDetail {\r\n result = result ? result : new CurveLocationDetail();\r\n result.curve = curve;\r\n result.fraction = fraction;\r\n result.point.setFromPoint3d(point);\r\n result.vectorInCurveLocationDetail = undefined;\r\n result.a = 0.0;\r\n result.childDetail = undefined;\r\n result.curveSearchStatus = undefined;\r\n return result;\r\n }\r\n /** Create a new detail with only ray, fraction, and point. */\r\n public static createRayFractionPoint(\r\n ray: Ray3d, fraction: number, point: XYAndZ, result?: CurveLocationDetail,\r\n ): CurveLocationDetail {\r\n result = result ? result : new CurveLocationDetail();\r\n result.fraction = fraction;\r\n result.ray = ray;\r\n result.point.setFromPoint3d(point);\r\n return result;\r\n }\r\n /** Create with CurvePrimitive pointer, fraction, and point coordinates. */\r\n public static createCurveFractionPointDistanceCurveSearchStatus(\r\n curve: CurvePrimitive | undefined,\r\n fraction: number,\r\n point: XYAndZ,\r\n distance: number,\r\n status: CurveSearchStatus,\r\n result?: CurveLocationDetail,\r\n ): CurveLocationDetail {\r\n result = result ? result : new CurveLocationDetail();\r\n result.curve = curve;\r\n result.fraction = fraction;\r\n result.point.setFromPoint3d(point);\r\n result.vectorInCurveLocationDetail = undefined;\r\n result.a = distance;\r\n result.childDetail = undefined;\r\n result.curveSearchStatus = status;\r\n return result;\r\n }\r\n /** Create with curveSearchStatus affected by allowExtension. */\r\n public static createConditionalMoveSignedDistance(\r\n allowExtension: boolean,\r\n curve: CurvePrimitive,\r\n startFraction: number,\r\n endFraction: number,\r\n requestedSignedDistance: number,\r\n result?: CurveLocationDetail,\r\n ): CurveLocationDetail {\r\n let a = requestedSignedDistance;\r\n let status = CurveSearchStatus.success;\r\n if (!allowExtension && !Geometry.isIn01(endFraction)) {\r\n // cap the movement at the endpoint\r\n if (endFraction < 0.0) {\r\n a = - curve.curveLengthBetweenFractions(startFraction, 0.0);\r\n endFraction = 0.0;\r\n status = CurveSearchStatus.stoppedAtBoundary;\r\n } else if (endFraction > 1.0) {\r\n endFraction = 1.0;\r\n a = curve.curveLengthBetweenFractions(startFraction, 1.0);\r\n status = CurveSearchStatus.stoppedAtBoundary;\r\n }\r\n }\r\n result = result ? result : new CurveLocationDetail();\r\n result.curve = curve;\r\n result.fraction = endFraction;\r\n curve.fractionToPoint(endFraction, result.point);\r\n result.vectorInCurveLocationDetail = undefined;\r\n result.a = a;\r\n result.childDetail = undefined;\r\n result.curveSearchStatus = status;\r\n return result;\r\n }\r\n /** Create with CurvePrimitive pointer and fraction for evaluation. */\r\n public static createCurveEvaluatedFraction(\r\n curve: CurvePrimitive, fraction: number, result?: CurveLocationDetail,\r\n ): CurveLocationDetail {\r\n result = result ? result : new CurveLocationDetail();\r\n result.curve = curve;\r\n result.fraction = fraction;\r\n curve.fractionToPoint(fraction, result.point);\r\n result.vectorInCurveLocationDetail = undefined;\r\n result.a = 0.0;\r\n result.childDetail = undefined;\r\n result.curveSearchStatus = undefined;\r\n return result;\r\n }\r\n /** Create with CurvePrimitive pointer and fraction for evaluation. */\r\n public static createCurveEvaluatedFractionPointAndDerivative(\r\n curve: CurvePrimitive, fraction: number, result?: CurveLocationDetail,\r\n ): CurveLocationDetail {\r\n result = result ? result : new CurveLocationDetail();\r\n result.curve = curve;\r\n result.fraction = fraction;\r\n const ray = curve.fractionToPointAndDerivative(fraction);\r\n result.point.setFromPoint3d(ray.origin);\r\n result.vectorInCurveLocationDetail = ray.direction;\r\n result.a = 0.0;\r\n result.childDetail = undefined;\r\n result.curveSearchStatus = undefined;\r\n return result;\r\n }\r\n /** Create with CurvePrimitive pointer and 2 fractions for evaluation. */\r\n public static createCurveEvaluatedFractionFraction(\r\n curve: CurvePrimitive, fraction0: number, fraction1: number, result?: CurveLocationDetail,\r\n ): CurveLocationDetail {\r\n result = result ? result : new CurveLocationDetail();\r\n result.curve = curve;\r\n result.fraction = fraction0;\r\n curve.fractionToPoint(fraction0, result.point);\r\n result.fraction1 = fraction1;\r\n result.point1 = curve.fractionToPoint(fraction1, result.point1);\r\n result.vectorInCurveLocationDetail = undefined;\r\n result.a = 0.0;\r\n result.childDetail = undefined;\r\n result.curveSearchStatus = undefined;\r\n return result;\r\n }\r\n /** Create with CurvePrimitive pointer, fraction, and point coordinates. */\r\n public static createCurveFractionPointDistance(\r\n curve: CurvePrimitive,\r\n fraction: number,\r\n point: XYAndZ,\r\n a: number,\r\n result?: CurveLocationDetail,\r\n ): CurveLocationDetail {\r\n result = result ? result : new CurveLocationDetail();\r\n result.curve = curve;\r\n result.fraction = fraction;\r\n result.point.setFromPoint3d(point);\r\n result.vectorInCurveLocationDetail = undefined;\r\n result.a = a;\r\n result.childDetail = undefined;\r\n result.curveSearchStatus = undefined;\r\n return result;\r\n }\r\n /**\r\n * Update or create if closer than current contents.\r\n * @param curve candidate curve\r\n * @param fraction candidate fraction\r\n * @param point candidate point\r\n * @param a candidate distance\r\n * @returns true if the given distance is smaller (and hence this detail was updated)\r\n */\r\n public updateIfCloserCurveFractionPointDistance(\r\n curve: CurvePrimitive, fraction: number, point: XYAndZ, a: number,\r\n ): boolean {\r\n if (this.a < a)\r\n return false;\r\n CurveLocationDetail.createCurveFractionPointDistance(curve, fraction, point, a, this);\r\n return true;\r\n }\r\n /**\r\n * Exchange the (fraction,fraction1) and (point, point1) pairs.\r\n * * (Skip each swap if its \"1\" value is undefined)\r\n */\r\n public swapFractionsAndPoints(): void {\r\n if (this.fraction1 !== undefined) {\r\n const f = this.fraction;\r\n this.fraction = this.fraction1;\r\n this.fraction1 = f;\r\n }\r\n if (this.point1 !== undefined) {\r\n const p = this.point;\r\n this.point = this.point1;\r\n this.point1 = p;\r\n }\r\n }\r\n /**\r\n * Return the fraction where `f` falls between `fraction` and `fraction1`.\r\n * * If the fractions are too close or `fraction1` is undefined, `defaultFraction` is returned.\r\n */\r\n public inverseInterpolateFraction(f: number, defaultFraction: number = 0): number {\r\n if (this.fraction1 === undefined)\r\n return defaultFraction;\r\n const a = Geometry.inverseInterpolate01(this.fraction, this.fraction1, f);\r\n if (a === undefined)\r\n return defaultFraction;\r\n return a;\r\n }\r\n /**\r\n * Return the detail with smaller `a` value -- detailA returned if equal.\r\n * @param detailA first candidate\r\n * @param detailB second candidate\r\n */\r\n public static chooseSmallerA(\r\n detailA: CurveLocationDetail | undefined, detailB: CurveLocationDetail | undefined,\r\n ): CurveLocationDetail | undefined {\r\n if (detailA) {\r\n if (!detailB)\r\n return detailA;\r\n return detailA.a <= detailB.a ? detailA : detailB;\r\n }\r\n return detailB;\r\n }\r\n /**\r\n * Compare only the curve and fraction of this detail with `other`.\r\n * @param fractionTol optional relative tolerance for comparing fractions with [[Geometry.isAlmostEqualNumber]].\r\n */\r\n public isSameCurveAndFraction(other: CurveLocationDetail | { curve: CurvePrimitive, fraction: number }, fractionTol?: number): boolean {\r\n return this.curve === other.curve && Geometry.isAlmostEqualNumber(this.fraction, other.fraction, fractionTol);\r\n }\r\n /**\r\n * Transform the detail in place.\r\n * * All numerical properties are transformed directly, except:\r\n * * when `curve` is defined, `point` and `point1` are reset by evaluating the transformed curve at `fraction` and `fraction1`\r\n * * these properties are untouched: `a`, `fraction`, `fraction1`, `pointQ`\r\n * @param transform the transform to apply\r\n * @return true if and only if the transformation was successful. If false, the instance is in an indeterminate\r\n * state and should not be used.\r\n */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n if (this.curve && !this.curve.tryTransformInPlace(transform))\r\n return false;\r\n if (this.ray)\r\n this.ray.transformInPlace(transform);\r\n if (this.curve)\r\n this.curve.fractionToPoint(this.fraction, this.point);\r\n else\r\n transform.multiplyXYAndZInPlace(this.point);\r\n if (this.vectorInCurveLocationDetail)\r\n transform.multiplyVectorInPlace(this.vectorInCurveLocationDetail);\r\n if (this.childDetail && this.childDetail !== this && !this.childDetail.tryTransformInPlace(transform))\r\n return false;\r\n if (this.point1) {\r\n if (this.curve && this.fraction1)\r\n this.curve.fractionToPoint(this.fraction1, this.point1);\r\n else\r\n transform.multiplyXYAndZInPlace(this.point1);\r\n }\r\n return true;\r\n }\r\n}\r\n\r\n/**\r\n * Enumeration of configurations for intersections and min/max distance-between-curve\r\n * @public\r\n */\r\nexport enum CurveCurveApproachType {\r\n /** Intersection at a single point */\r\n Intersection = 0,\r\n /** Distinct points on the two curves, with each curve's tangent perpendicular to the chord between the points */\r\n PerpendicularChord = 1,\r\n /** Completely coincident geometry */\r\n CoincidentGeometry = 2,\r\n /** Completely parallel geometry. */\r\n ParallelGeometry = 3,\r\n}\r\n\r\n/**\r\n * A pair of CurveLocationDetail.\r\n * @public\r\n */\r\nexport class CurveLocationDetailPair {\r\n /** The first of the two details. */\r\n public detailA: CurveLocationDetail;\r\n /** The second of the two details. */\r\n public detailB: CurveLocationDetail;\r\n /**\r\n * Enumeration of how the detail pairs relate.\r\n * * This is set only by certain closeApproach calculations.\r\n */\r\n public approachType?: CurveCurveApproachType;\r\n\r\n public constructor(detailA?: CurveLocationDetail, detailB?: CurveLocationDetail) {\r\n this.detailA = detailA ? detailA : new CurveLocationDetail();\r\n this.detailB = detailB ? detailB : new CurveLocationDetail();\r\n }\r\n /** Create a curve detail pair using references to two CurveLocationDetails */\r\n public static createCapture(\r\n detailA: CurveLocationDetail, detailB: CurveLocationDetail, result?: CurveLocationDetailPair,\r\n ): CurveLocationDetailPair {\r\n result = result ? result : new CurveLocationDetailPair();\r\n result.detailA = detailA;\r\n result.detailB = detailB;\r\n return result;\r\n }\r\n /**\r\n * Create a curve detail pair using references to two CurveLocationDetails.\r\n * * optionally install in reversed positions\r\n */\r\n public static createCaptureOptionalReverse(\r\n detailA: CurveLocationDetail, detailB: CurveLocationDetail, reversed: boolean, result?: CurveLocationDetailPair,\r\n ): CurveLocationDetailPair {\r\n result = result ? result : new CurveLocationDetailPair();\r\n if (reversed) {\r\n result.detailA = detailA;\r\n result.detailB = detailB;\r\n\r\n } else {\r\n result.detailA = detailA;\r\n result.detailB = detailB;\r\n }\r\n return result;\r\n }\r\n /** Make a deep copy of this CurveLocationDetailPair */\r\n public clone(result?: CurveLocationDetailPair): CurveLocationDetailPair {\r\n result = result ? result : new CurveLocationDetailPair();\r\n result.detailA = this.detailA.clone();\r\n result.detailB = this.detailB.clone();\r\n result.approachType = this.approachType;\r\n return result;\r\n }\r\n /** Swap the details of A, B */\r\n public swapDetails() {\r\n const q = this.detailA;\r\n this.detailA = this.detailB;\r\n this.detailB = q;\r\n }\r\n /**\r\n * Mutate the input array by removing the second of two adjacent duplicate pairs.\r\n * * Ignores details representing coincident intervals (e.g., for which `fraction1` is defined).\r\n * * Comparison is performed by [[CurveLocationDetail.isSameCurveAndFraction]].\r\n * * No sorting is performed.\r\n * @param pairs array to de-duplicate in place\r\n * @param index0 look for duplicates in the tail of the array starting at index0\r\n * @return reference to input array\r\n * @internal\r\n */\r\n public static removeAdjacentDuplicates(pairs: CurveLocationDetailPair[], index0: number = 0): CurveLocationDetailPair[] {\r\n return pairs.flatMap(\r\n (pair: CurveLocationDetailPair, i: number, arr: CurveLocationDetailPair[]) => {\r\n if (i >= index0 && i > 0) {\r\n if (!pair.detailA.hasFraction1 && !pair.detailB.hasFraction1) {\r\n if (pair.detailA.isSameCurveAndFraction(arr[i - 1].detailA)) {\r\n if (pair.detailB.isSameCurveAndFraction(arr[i - 1].detailB)) {\r\n return []; // remove the i_th pair\r\n }\r\n }\r\n }\r\n }\r\n return [pair]; // preserve the i_th pair\r\n },\r\n );\r\n }\r\n /**\r\n * Transform the details in place.\r\n * @param transform the transform to apply\r\n * @return true if and only if the transformation was successful on both details.\r\n * If false, the instance is in an indeterminate state and should not be used.\r\n */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n return this.detailA.tryTransformInPlace(transform) && this.detailB.tryTransformInPlace(transform);\r\n }\r\n /**\r\n * Return a pair comparator useful for sorting an array of detail pairs by their fractions.\r\n * * Comparison assumes detailA curves are the same and detailB curves are the same.\r\n * * Comparison checks for equality of pair fractions, then of pair points, then sorts by detailA.fraction, then detailB.fraction.\r\n * @param fractionTol tolerance for comparing fractions. Default value [[Geometry.smallFraction]].\r\n * @param pointTol tolerance for comparing points, used if fractions are distinct. Default value [[Geometry.smallMetricDistance]].\r\n * @param xyOnly whether to perform point comparisons in xy only. Default is false (compare 3D points).\r\n * @param equateClosedCurveFractions whether to equate fractions 0 and 1 for physically closed curves. Default is false.\r\n */\r\n public static comparePairsByFractions(\r\n fractionTol: number = Geometry.smallFraction,\r\n pointTol: number = Geometry.smallMetricDistance,\r\n xyOnly: boolean = false,\r\n equateClosedCurveFractions: boolean = false,\r\n ): OrderedComparator<CurveLocationDetailPair> {\r\n return (p0: CurveLocationDetailPair, p1: CurveLocationDetailPair): number => {\r\n assert(() => p0.detailA.curve === p1.detailA.curve && p0.detailB.curve === p1.detailB.curve, \"pairs are compatible\");\r\n const curveA = p0.detailA.curve;\r\n const curveB = p0.detailB.curve;\r\n let fraction0A = p0.detailA.fraction;\r\n let fraction0B = p0.detailB.fraction;\r\n let fraction1A = p1.detailA.fraction;\r\n let fraction1B = p1.detailB.fraction;\r\n if (equateClosedCurveFractions) {\r\n if (curveA?.isPhysicallyClosedCurve(pointTol, xyOnly)) {\r\n if (Geometry.isAlmostEqualEitherNumber(p0.detailA.fraction, 0, 1, fractionTol))\r\n fraction0A = 0;\r\n if (Geometry.isAlmostEqualEitherNumber(p1.detailA.fraction, 0, 1, fractionTol))\r\n fraction1A = 0;\r\n }\r\n if (curveB?.isPhysicallyClosedCurve(pointTol, xyOnly)) {\r\n if (Geometry.isAlmostEqualEitherNumber(p0.detailB.fraction, 0, 1, fractionTol))\r\n fraction0B = 0;\r\n if (Geometry.isAlmostEqualEitherNumber(p1.detailB.fraction, 0, 1, fractionTol))\r\n fraction1B = 0;\r\n }\r\n }\r\n const sameFractionsA = Geometry.isAlmostEqualNumber(fraction0A, fraction1A, fractionTol);\r\n if (sameFractionsA && Geometry.isAlmostEqualNumber(fraction0B, fraction1B, fractionTol))\r\n return 0;\r\n const samePointsA = xyOnly ? p0.detailA.point.isAlmostEqualXY(p1.detailA.point, pointTol) : p0.detailA.point.isAlmostEqual(p1.detailA.point, pointTol);\r\n if (samePointsA && (xyOnly ? p0.detailB.point.isAlmostEqualXY(p1.detailB.point, pointTol) : p0.detailB.point.isAlmostEqual(p1.detailB.point, pointTol)))\r\n return 0;\r\n return sameFractionsA ? fraction0B - fraction1B : fraction0A - fraction1A;\r\n };\r\n }\r\n /**\r\n * Return a pair comparator useful for sorting an array of detail pairs by their points.\r\n * * Comparison sorts the points lexicographically, `detailA.point` first, then `detailB.point`.\r\n * @param pointTol tolerance for comparing points. Default value [[Geometry.smallMetricDistance]].\r\n * @param xyOnly whether to perform point comparisons in xy only. Default is false (compare 3D points).\r\n */\r\n public static comparePairsByPoints(\r\n pointTol: number = Geometry.smallMetricDistance,\r\n xyOnly: boolean = false,\r\n ): OrderedComparator<CurveLocationDetailPair> {\r\n return (p0: CurveLocationDetailPair, p1: CurveLocationDetailPair): number => {\r\n const comparePoints = xyOnly ? Geometry.compareXY(pointTol) : Geometry.compareXYZ(pointTol);\r\n const compareA = comparePoints(p0.detailA.point, p1.detailA.point);\r\n const compareB = comparePoints(p0.detailB.point, p1.detailB.point);\r\n const samePointsA = compareA === 0;\r\n if (samePointsA && compareB === 0)\r\n return 0;\r\n return samePointsA ? compareB : compareA;\r\n };\r\n }\r\n}\r\n\r\n/**\r\n * Data bundle for a pair of arrays of CurveLocationDetail structures.\r\n * @deprecated in 4.2.0 - might be removed in next major version. Use CurveLocationDetailPair[] instead.\r\n * @public\r\n */\r\nexport class CurveLocationDetailArrayPair {\r\n /** First array of details. */\r\n public dataA: CurveLocationDetail[];\r\n /** Second array of details. */\r\n public dataB: CurveLocationDetail[];\r\n public constructor() {\r\n this.dataA = [];\r\n this.dataB = [];\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"CurveLocationDetail.js","sourceRoot":"","sources":["../../../src/curve/CurveLocationDetail.ts"],"names":[],"mappings":";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CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;gBACrJ,OAAO,CAAC,CAAC;YACX,OAAO,cAAc,CAAC,CAAC,CAAC,UAAU,GAAG,UAAU,CAAC,CAAC,CAAC,UAAU,GAAG,UAAU,CAAC;QAC5E,CAAC,CAAC;IACJ,CAAC;IACD;;;;;OAKG;IACI,MAAM,CAAC,oBAAoB,CAChC,WAAmB,mBAAQ,CAAC,mBAAmB,EAC/C,SAAkB,KAAK;QAEvB,OAAO,CAAC,EAA2B,EAAE,EAA2B,EAAU,EAAE;YAC1E,MAAM,aAAa,GAAG,MAAM,CAAC,CAAC,CAAC,mBAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,mBAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;YAC5F,MAAM,QAAQ,GAAG,aAAa,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YACnE,MAAM,QAAQ,GAAG,aAAa,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YACnE,MAAM,WAAW,GAAG,QAAQ,KAAK,CAAC,CAAC;YACnC,IAAI,WAAW,IAAI,QAAQ,KAAK,CAAC;gBAC/B,OAAO,CAAC,CAAC;YACX,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC;QAC3C,CAAC,CAAC;IACJ,CAAC;CACF;AA7JD,0DA6JC;AAED;;;;GAIG;AACH,MAAa,4BAA4B;IACvC,8BAA8B;IACvB,KAAK,CAAwB;IACpC,+BAA+B;IACxB,KAAK,CAAwB;IACpC;QACE,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;IAClB,CAAC;CACF;AATD,oEASC","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\nimport { assert, OrderedComparator } from \"@itwin/core-bentley\";\r\nimport { Geometry, ICloneable } from \"../Geometry\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Ray3d } from \"../geometry3d/Ray3d\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { XYAndZ } from \"../geometry3d/XYZProps\";\r\nimport { CurvePrimitive } from \"./CurvePrimitive\";\r\n\r\n/**\r\n * An enumeration of special conditions being described by a CurveLocationDetail.\r\n * @public\r\n */\r\nexport enum CurveIntervalRole {\r\n /** This point is an isolated point NOT at a primary vertex. */\r\n isolated = 0,\r\n /** This point is an isolated vertex hit */\r\n isolatedAtVertex = 1,\r\n /** This is the beginning of an interval */\r\n intervalStart = 10,\r\n /** This is an interior point of an interval. */\r\n intervalInterior = 11,\r\n /** This is the end of an interval */\r\n intervalEnd = 12,\r\n}\r\n\r\n/**\r\n * Return code for CurvePrimitive method `moveSignedDistanceFromFraction`\r\n * @public\r\n */\r\nexport enum CurveSearchStatus {\r\n /** Unimplemented or zero length curve */\r\n error,\r\n /** Complete success of search */\r\n success = 1,\r\n /** Search ended prematurely (e.g. at incomplete distance moved) at start or end of curve */\r\n stoppedAtBoundary = 2,\r\n}\r\n\r\n/**\r\n * Use to update a cloneable object when source and/or prior result are possibly undefined.\r\n * * Any undefined source returns undefined.\r\n * * For defined source, reuse optional result if available.\r\n * @param source optional source\r\n * @param result optional result\r\n */\r\nfunction optionalUpdate<T extends ICloneable<T>>(source: T | undefined, result: T | undefined): T | undefined {\r\n return source ? source.clone(result) : undefined;\r\n}\r\n\r\n/**\r\n * CurveLocationDetail carries point and parameter data about a point evaluated on a curve.\r\n * * These are returned by a variety of queries.\r\n * * Particular contents can vary among the queries.\r\n * @public\r\n */\r\nexport class CurveLocationDetail {\r\n /** The curve being evaluated. */\r\n public curve?: CurvePrimitive;\r\n /** Optional ray. */\r\n public ray?: Ray3d;\r\n /** The fractional position along the curve. */\r\n public fraction: number;\r\n /** Detail condition of the role this point has in some context. */\r\n public intervalRole?: CurveIntervalRole;\r\n /** The point on the curve. */\r\n public point: Point3d;\r\n /** A vector (e.g. tangent vector) in context. */\r\n public vectorInCurveLocationDetail?: Vector3d;\r\n /** A context-specific numeric value (e.g., a distance). */\r\n public a: number;\r\n /**\r\n * Optional CurveLocationDetail with more detail of location. For instance, a detail for fractional position\r\n * within a CurveChainWithDistanceIndex returns fraction and distance along the chain as its primary data and\r\n * further detail of the particular curve within the chain in the childDetail.\r\n */\r\n public childDetail?: CurveLocationDetail;\r\n /**\r\n * A status indicator for certain searches.\r\n * * e.g., CurvePrimitive.moveSignedDistanceFromFraction.\r\n */\r\n public curveSearchStatus?: CurveSearchStatus;\r\n /** (Optional) second fraction, e.g. end of interval of coincident curves. */\r\n public fraction1?: number;\r\n /** (Optional) second point, e.g. end of interval of coincident curves. */\r\n public point1?: Point3d;\r\n /** A context-specific temporary point, e.g. for intermediate calculations. */\r\n public pointQ: Point3d;\r\n /** Constructor */\r\n public constructor() {\r\n this.pointQ = Point3d.createZero();\r\n this.fraction = 0;\r\n this.point = Point3d.createZero();\r\n this.a = 0.0;\r\n }\r\n /** Set the (optional) intervalRole field. */\r\n public setIntervalRole(value: CurveIntervalRole): void {\r\n this.intervalRole = value;\r\n }\r\n /** Set the `fraction` and `point`, using direct assignment (capture!) to `point`. */\r\n public captureFractionPoint(fraction: number, point: Point3d): void {\r\n this.fraction = fraction;\r\n this.point = point;\r\n }\r\n /** Set the (optional) `fraction1` and `point1`, using direct assignment (capture!) to `point1`. */\r\n public captureFraction1Point1(fraction1: number, point1: Point3d): void {\r\n this.fraction1 = fraction1;\r\n this.point1 = point1;\r\n }\r\n /** Test if this pair has fraction1 defined. */\r\n public get hasFraction1(): boolean {\r\n return this.fraction1 !== undefined;\r\n }\r\n /** Test if this detail defines an interval. Preferable to [[CurveLocationDetail.hasFraction1]]. */\r\n public isInterval(): this is { fraction1: number, point1: Point3d } {\r\n return this.fraction1 !== undefined && this.point1 !== undefined;\r\n }\r\n /** Test if this is an isolated point. This is true if intervalRole is any of (undefined, isolated, isolatedAtVertex). */\r\n public get isIsolated(): boolean {\r\n return this.intervalRole === undefined\r\n || this.intervalRole === CurveIntervalRole.isolated\r\n || this.intervalRole === CurveIntervalRole.isolatedAtVertex;\r\n }\r\n /** Return the fraction delta. (0 if no fraction1). */\r\n public get fractionDelta(): number {\r\n return this.fraction1 !== undefined ? this.fraction1 - this.fraction : 0.0;\r\n }\r\n /**\r\n * If (fraction1, point1) are defined, make them the primary (and only) data.\r\n * * No action if undefined.\r\n */\r\n public collapseToEnd() {\r\n if (this.fraction1 !== undefined)\r\n this.fraction = this.fraction1;\r\n if (this.point1)\r\n this.point = this.point1;\r\n this.collapseToStart();\r\n }\r\n /** Make (fraction, point) the primary (and only) data. */\r\n public collapseToStart() {\r\n this.fraction1 = undefined;\r\n this.point1 = undefined;\r\n }\r\n /**\r\n * Return a complete copy, WITH CAVEATS.\r\n * * curve member is copied as a reference.\r\n * * point and vector members are cloned.\r\n */\r\n public clone(result?: CurveLocationDetail): CurveLocationDetail {\r\n if (result === this)\r\n return result;\r\n result = result ? result : new CurveLocationDetail();\r\n result.curve = this.curve;\r\n result.fraction = this.fraction;\r\n result.fraction1 = this.fraction1;\r\n result.point1 = optionalUpdate<Point3d>(this.point1, result.point1);\r\n result.point.setFromPoint3d(this.point);\r\n result.vectorInCurveLocationDetail = optionalUpdate<Vector3d>(this.vectorInCurveLocationDetail, result.vectorInCurveLocationDetail);\r\n result.a = this.a;\r\n result.childDetail = optionalUpdate<CurveLocationDetail>(this.childDetail, result.childDetail);\r\n result.curveSearchStatus = this.curveSearchStatus;\r\n return result;\r\n }\r\n /**\r\n * Updated in this instance.\r\n * * Note that if caller omits `vector` and `a`, those fields are updated to the call-list defaults (NOT left as-is)\r\n * * point and vector updates are by data copy (not capture of pointers).\r\n * @param fraction (required) fraction to install.\r\n * @param point (required) point to install.\r\n * @param vector (optional) vector to install.\r\n * @param a (optional) numeric value to install.\r\n */\r\n public setFP(fraction: number, point: XYAndZ, vector?: Vector3d, a: number = 0.0): void {\r\n this.fraction = fraction;\r\n this.point.setFromPoint3d(point);\r\n this.vectorInCurveLocationDetail = optionalUpdate<Vector3d>(vector, this.vectorInCurveLocationDetail);\r\n this.a = a;\r\n }\r\n /**\r\n * Updated in this instance.\r\n * * Note that if caller omits a`, that field is updated to the call-list default (NOT left as-is)\r\n * * point and vector updates are by data copy (not capture of the ray members).\r\n * @param fraction (required) fraction to install.\r\n * @param ray (required) point and vector to install.\r\n * @param a (optional) numeric value to install.\r\n */\r\n public setFR(fraction: number, ray: Ray3d, a: number = 0): void {\r\n return this.setFP(fraction, ray.origin, ray.direction, a);\r\n }\r\n /** Set the CurvePrimitive pointer, leaving all other properties untouched. */\r\n public setCurve(curve: CurvePrimitive) {\r\n this.curve = curve;\r\n }\r\n /** Record the distance from the CurveLocationDetail's point to the parameter point. */\r\n public setDistanceTo(point: XYAndZ) {\r\n this.a = this.point.distance(point);\r\n }\r\n /** Create with a CurvePrimitive pointer but no coordinate data. */\r\n public static create(curve?: CurvePrimitive, result?: CurveLocationDetail): CurveLocationDetail {\r\n result = result ? result : new CurveLocationDetail();\r\n result.curve = curve;\r\n return result;\r\n }\r\n /** Create a new detail using CurvePrimitive pointer, fraction, and point coordinates. */\r\n public static createCurveFractionPoint(\r\n curve: CurvePrimitive | undefined, fraction: number, point: XYAndZ, result?: CurveLocationDetail,\r\n ): CurveLocationDetail {\r\n result = result ? result : new CurveLocationDetail();\r\n result.curve = curve;\r\n result.fraction = fraction;\r\n result.point.setFromPoint3d(point);\r\n result.vectorInCurveLocationDetail = undefined;\r\n result.a = 0.0;\r\n result.childDetail = undefined;\r\n result.curveSearchStatus = undefined;\r\n return result;\r\n }\r\n /** Create a new detail with only ray, fraction, and point. */\r\n public static createRayFractionPoint(\r\n ray: Ray3d, fraction: number, point: XYAndZ, result?: CurveLocationDetail,\r\n ): CurveLocationDetail {\r\n result = result ? result : new CurveLocationDetail();\r\n result.fraction = fraction;\r\n result.ray = ray;\r\n result.point.setFromPoint3d(point);\r\n return result;\r\n }\r\n /** Create with CurvePrimitive pointer, fraction, and point coordinates. */\r\n public static createCurveFractionPointDistanceCurveSearchStatus(\r\n curve: CurvePrimitive | undefined,\r\n fraction: number,\r\n point: XYAndZ,\r\n distance: number,\r\n status: CurveSearchStatus,\r\n result?: CurveLocationDetail,\r\n ): CurveLocationDetail {\r\n result = result ? result : new CurveLocationDetail();\r\n result.curve = curve;\r\n result.fraction = fraction;\r\n result.point.setFromPoint3d(point);\r\n result.vectorInCurveLocationDetail = undefined;\r\n result.a = distance;\r\n result.childDetail = undefined;\r\n result.curveSearchStatus = status;\r\n return result;\r\n }\r\n /** Create with curveSearchStatus affected by allowExtension. */\r\n public static createConditionalMoveSignedDistance(\r\n allowExtension: boolean,\r\n curve: CurvePrimitive,\r\n startFraction: number,\r\n endFraction: number,\r\n requestedSignedDistance: number,\r\n result?: CurveLocationDetail,\r\n ): CurveLocationDetail {\r\n let a = requestedSignedDistance;\r\n let status = CurveSearchStatus.success;\r\n if (!allowExtension && !Geometry.isIn01(endFraction)) {\r\n // cap the movement at the endpoint\r\n if (endFraction < 0.0) {\r\n a = - curve.curveLengthBetweenFractions(startFraction, 0.0);\r\n endFraction = 0.0;\r\n status = CurveSearchStatus.stoppedAtBoundary;\r\n } else if (endFraction > 1.0) {\r\n endFraction = 1.0;\r\n a = curve.curveLengthBetweenFractions(startFraction, 1.0);\r\n status = CurveSearchStatus.stoppedAtBoundary;\r\n }\r\n }\r\n result = result ? result : new CurveLocationDetail();\r\n result.curve = curve;\r\n result.fraction = endFraction;\r\n curve.fractionToPoint(endFraction, result.point);\r\n result.vectorInCurveLocationDetail = undefined;\r\n result.a = a;\r\n result.childDetail = undefined;\r\n result.curveSearchStatus = status;\r\n return result;\r\n }\r\n /** Create with CurvePrimitive pointer and fraction for evaluation. */\r\n public static createCurveEvaluatedFraction(\r\n curve: CurvePrimitive, fraction: number, result?: CurveLocationDetail,\r\n ): CurveLocationDetail {\r\n result = result ? result : new CurveLocationDetail();\r\n result.curve = curve;\r\n result.fraction = fraction;\r\n curve.fractionToPoint(fraction, result.point);\r\n result.vectorInCurveLocationDetail = undefined;\r\n result.a = 0.0;\r\n result.childDetail = undefined;\r\n result.curveSearchStatus = undefined;\r\n return result;\r\n }\r\n /** Create with CurvePrimitive pointer and fraction for evaluation. */\r\n public static createCurveEvaluatedFractionPointAndDerivative(\r\n curve: CurvePrimitive, fraction: number, result?: CurveLocationDetail,\r\n ): CurveLocationDetail {\r\n result = result ? result : new CurveLocationDetail();\r\n result.curve = curve;\r\n result.fraction = fraction;\r\n const ray = curve.fractionToPointAndDerivative(fraction);\r\n result.point.setFromPoint3d(ray.origin);\r\n result.vectorInCurveLocationDetail = ray.direction;\r\n result.a = 0.0;\r\n result.childDetail = undefined;\r\n result.curveSearchStatus = undefined;\r\n return result;\r\n }\r\n /** Create with CurvePrimitive pointer and 2 fractions for evaluation. */\r\n public static createCurveEvaluatedFractionFraction(\r\n curve: CurvePrimitive, fraction0: number, fraction1: number, result?: CurveLocationDetail,\r\n ): CurveLocationDetail {\r\n result = result ? result : new CurveLocationDetail();\r\n result.curve = curve;\r\n result.fraction = fraction0;\r\n curve.fractionToPoint(fraction0, result.point);\r\n result.fraction1 = fraction1;\r\n result.point1 = curve.fractionToPoint(fraction1, result.point1);\r\n result.vectorInCurveLocationDetail = undefined;\r\n result.a = 0.0;\r\n result.childDetail = undefined;\r\n result.curveSearchStatus = undefined;\r\n return result;\r\n }\r\n /** Create with CurvePrimitive pointer, fraction, and point coordinates. */\r\n public static createCurveFractionPointDistance(\r\n curve: CurvePrimitive,\r\n fraction: number,\r\n point: XYAndZ,\r\n a: number,\r\n result?: CurveLocationDetail,\r\n ): CurveLocationDetail {\r\n result = result ? result : new CurveLocationDetail();\r\n result.curve = curve;\r\n result.fraction = fraction;\r\n result.point.setFromPoint3d(point);\r\n result.vectorInCurveLocationDetail = undefined;\r\n result.a = a;\r\n result.childDetail = undefined;\r\n result.curveSearchStatus = undefined;\r\n return result;\r\n }\r\n /**\r\n * Update or create if closer than current contents.\r\n * @param curve candidate curve\r\n * @param fraction candidate fraction\r\n * @param point candidate point\r\n * @param a candidate distance\r\n * @returns true if the given distance is smaller (and hence this detail was updated)\r\n */\r\n public updateIfCloserCurveFractionPointDistance(\r\n curve: CurvePrimitive, fraction: number, point: XYAndZ, a: number,\r\n ): boolean {\r\n if (this.a < a)\r\n return false;\r\n CurveLocationDetail.createCurveFractionPointDistance(curve, fraction, point, a, this);\r\n return true;\r\n }\r\n /**\r\n * Exchange the (fraction,fraction1) and (point, point1) pairs.\r\n * * (Skip each swap if its \"1\" value is undefined)\r\n */\r\n public swapFractionsAndPoints(): void {\r\n if (this.fraction1 !== undefined) {\r\n const f = this.fraction;\r\n this.fraction = this.fraction1;\r\n this.fraction1 = f;\r\n }\r\n if (this.point1 !== undefined) {\r\n const p = this.point;\r\n this.point = this.point1;\r\n this.point1 = p;\r\n }\r\n }\r\n /**\r\n * Return the fraction where `f` falls between `fraction` and `fraction1`.\r\n * * If the fractions are too close or `fraction1` is undefined, `defaultFraction` is returned.\r\n */\r\n public inverseInterpolateFraction(f: number, defaultFraction: number = 0): number {\r\n if (this.fraction1 === undefined)\r\n return defaultFraction;\r\n const a = Geometry.inverseInterpolate01(this.fraction, this.fraction1, f);\r\n if (a === undefined)\r\n return defaultFraction;\r\n return a;\r\n }\r\n /**\r\n * Return the detail with smaller `a` value -- detailA returned if equal.\r\n * @param detailA first candidate\r\n * @param detailB second candidate\r\n */\r\n public static chooseSmallerA(\r\n detailA: CurveLocationDetail | undefined, detailB: CurveLocationDetail | undefined,\r\n ): CurveLocationDetail | undefined {\r\n if (detailA) {\r\n if (!detailB)\r\n return detailA;\r\n // tiebreakers (exact comparison!)\r\n if (detailA.a === detailB.a) {\r\n // prefer interior to exterior\r\n const isInteriorA = Geometry.isIn01(detailA.fraction);\r\n const isInteriorB = Geometry.isIn01(detailB.fraction);\r\n if (isInteriorA && !isInteriorB)\r\n return detailA;\r\n if (!isInteriorA && isInteriorB)\r\n return detailB;\r\n if (!isInteriorA && !isInteriorB) { // prefer exterior closer to [0,1]\r\n const distFrom01A = detailA.fraction < 0 ? -detailA.fraction : detailA.fraction - 1;\r\n const distFrom01B = detailB.fraction < 0 ? -detailB.fraction : detailB.fraction - 1;\r\n return (distFrom01A <= distFrom01B) ? detailA : detailB;\r\n }\r\n }\r\n return detailA.a < detailB.a ? detailA : detailB;\r\n }\r\n return detailB;\r\n }\r\n /**\r\n * Compare only the curve and fraction of this detail with `other`.\r\n * @param fractionTol optional relative tolerance for comparing fractions with [[Geometry.isAlmostEqualNumber]].\r\n */\r\n public isSameCurveAndFraction(other: CurveLocationDetail | { curve: CurvePrimitive, fraction: number }, fractionTol?: number): boolean {\r\n return this.curve === other.curve && Geometry.isAlmostEqualNumber(this.fraction, other.fraction, fractionTol);\r\n }\r\n /**\r\n * Transform the detail in place.\r\n * * All numerical properties are transformed directly, except:\r\n * * when `curve` is defined, `point` and `point1` are reset by evaluating the transformed curve at `fraction` and `fraction1`\r\n * * these properties are untouched: `a`, `fraction`, `fraction1`, `pointQ`\r\n * @param transform the transform to apply\r\n * @return true if and only if the transformation was successful. If false, the instance is in an indeterminate\r\n * state and should not be used.\r\n */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n if (this.curve && !this.curve.tryTransformInPlace(transform))\r\n return false;\r\n if (this.ray)\r\n this.ray.transformInPlace(transform);\r\n if (this.curve)\r\n this.curve.fractionToPoint(this.fraction, this.point);\r\n else\r\n transform.multiplyXYAndZInPlace(this.point);\r\n if (this.vectorInCurveLocationDetail)\r\n transform.multiplyVectorInPlace(this.vectorInCurveLocationDetail);\r\n if (this.childDetail && this.childDetail !== this && !this.childDetail.tryTransformInPlace(transform))\r\n return false;\r\n if (this.point1) {\r\n if (this.curve && this.fraction1)\r\n this.curve.fractionToPoint(this.fraction1, this.point1);\r\n else\r\n transform.multiplyXYAndZInPlace(this.point1);\r\n }\r\n return true;\r\n }\r\n}\r\n\r\n/**\r\n * Enumeration of configurations for intersections and min/max distance-between-curve\r\n * @public\r\n */\r\nexport enum CurveCurveApproachType {\r\n /** Intersection at a single point */\r\n Intersection = 0,\r\n /** Distinct points on the two curves, with each curve's tangent perpendicular to the chord between the points */\r\n PerpendicularChord = 1,\r\n /** Completely coincident geometry */\r\n CoincidentGeometry = 2,\r\n /** Completely parallel geometry. */\r\n ParallelGeometry = 3,\r\n}\r\n\r\n/**\r\n * A pair of CurveLocationDetail.\r\n * @public\r\n */\r\nexport class CurveLocationDetailPair {\r\n /** The first of the two details. */\r\n public detailA: CurveLocationDetail;\r\n /** The second of the two details. */\r\n public detailB: CurveLocationDetail;\r\n /**\r\n * Enumeration of how the detail pairs relate.\r\n * * This is set only by certain closeApproach calculations.\r\n */\r\n public approachType?: CurveCurveApproachType;\r\n\r\n public constructor(detailA?: CurveLocationDetail, detailB?: CurveLocationDetail) {\r\n this.detailA = detailA ? detailA : new CurveLocationDetail();\r\n this.detailB = detailB ? detailB : new CurveLocationDetail();\r\n }\r\n /** Create a curve detail pair using references to two CurveLocationDetails */\r\n public static createCapture(\r\n detailA: CurveLocationDetail, detailB: CurveLocationDetail, result?: CurveLocationDetailPair,\r\n ): CurveLocationDetailPair {\r\n result = result ? result : new CurveLocationDetailPair();\r\n result.detailA = detailA;\r\n result.detailB = detailB;\r\n return result;\r\n }\r\n /**\r\n * Create a curve detail pair using references to two CurveLocationDetails.\r\n * * optionally install in reversed positions\r\n */\r\n public static createCaptureOptionalReverse(\r\n detailA: CurveLocationDetail, detailB: CurveLocationDetail, reversed: boolean, result?: CurveLocationDetailPair,\r\n ): CurveLocationDetailPair {\r\n result = result ? result : new CurveLocationDetailPair();\r\n if (reversed) {\r\n result.detailA = detailA;\r\n result.detailB = detailB;\r\n\r\n } else {\r\n result.detailA = detailA;\r\n result.detailB = detailB;\r\n }\r\n return result;\r\n }\r\n /** Make a deep copy of this CurveLocationDetailPair */\r\n public clone(result?: CurveLocationDetailPair): CurveLocationDetailPair {\r\n result = result ? result : new CurveLocationDetailPair();\r\n result.detailA = this.detailA.clone();\r\n result.detailB = this.detailB.clone();\r\n result.approachType = this.approachType;\r\n return result;\r\n }\r\n /** Swap the details of A, B */\r\n public swapDetails() {\r\n const q = this.detailA;\r\n this.detailA = this.detailB;\r\n this.detailB = q;\r\n }\r\n /**\r\n * Mutate the input array by removing the second of two adjacent duplicate pairs.\r\n * * Ignores details representing coincident intervals (e.g., for which `fraction1` is defined).\r\n * * Comparison is performed by [[CurveLocationDetail.isSameCurveAndFraction]].\r\n * * No sorting is performed.\r\n * @param pairs array to de-duplicate in place\r\n * @param index0 look for duplicates in the tail of the array starting at index0\r\n * @return reference to input array\r\n * @internal\r\n */\r\n public static removeAdjacentDuplicates(pairs: CurveLocationDetailPair[], index0: number = 0): CurveLocationDetailPair[] {\r\n return pairs.flatMap(\r\n (pair: CurveLocationDetailPair, i: number, arr: CurveLocationDetailPair[]) => {\r\n if (i >= index0 && i > 0) {\r\n if (!pair.detailA.hasFraction1 && !pair.detailB.hasFraction1) {\r\n if (pair.detailA.isSameCurveAndFraction(arr[i - 1].detailA)) {\r\n if (pair.detailB.isSameCurveAndFraction(arr[i - 1].detailB)) {\r\n return []; // remove the i_th pair\r\n }\r\n }\r\n }\r\n }\r\n return [pair]; // preserve the i_th pair\r\n },\r\n );\r\n }\r\n /**\r\n * Transform the details in place.\r\n * @param transform the transform to apply\r\n * @return true if and only if the transformation was successful on both details.\r\n * If false, the instance is in an indeterminate state and should not be used.\r\n */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n return this.detailA.tryTransformInPlace(transform) && this.detailB.tryTransformInPlace(transform);\r\n }\r\n /**\r\n * Return a pair comparator useful for sorting an array of detail pairs by their fractions.\r\n * * Comparison assumes detailA curves are the same and detailB curves are the same.\r\n * * Comparison checks for equality of pair fractions, then of pair points, then sorts by detailA.fraction, then detailB.fraction.\r\n * @param fractionTol tolerance for comparing fractions. Default value [[Geometry.smallFraction]].\r\n * @param pointTol tolerance for comparing points, used if fractions are distinct. Default value [[Geometry.smallMetricDistance]].\r\n * @param xyOnly whether to perform point comparisons in xy only. Default is false (compare 3D points).\r\n * @param equateClosedCurveFractions whether to equate fractions 0 and 1 for physically closed curves. Default is false.\r\n */\r\n public static comparePairsByFractions(\r\n fractionTol: number = Geometry.smallFraction,\r\n pointTol: number = Geometry.smallMetricDistance,\r\n xyOnly: boolean = false,\r\n equateClosedCurveFractions: boolean = false,\r\n ): OrderedComparator<CurveLocationDetailPair> {\r\n return (p0: CurveLocationDetailPair, p1: CurveLocationDetailPair): number => {\r\n assert(() => p0.detailA.curve === p1.detailA.curve && p0.detailB.curve === p1.detailB.curve, \"pairs are compatible\");\r\n const curveA = p0.detailA.curve;\r\n const curveB = p0.detailB.curve;\r\n let fraction0A = p0.detailA.fraction;\r\n let fraction0B = p0.detailB.fraction;\r\n let fraction1A = p1.detailA.fraction;\r\n let fraction1B = p1.detailB.fraction;\r\n if (equateClosedCurveFractions) {\r\n if (curveA?.isPhysicallyClosedCurve(pointTol, xyOnly)) {\r\n if (Geometry.isAlmostEqualEitherNumber(p0.detailA.fraction, 0, 1, fractionTol))\r\n fraction0A = 0;\r\n if (Geometry.isAlmostEqualEitherNumber(p1.detailA.fraction, 0, 1, fractionTol))\r\n fraction1A = 0;\r\n }\r\n if (curveB?.isPhysicallyClosedCurve(pointTol, xyOnly)) {\r\n if (Geometry.isAlmostEqualEitherNumber(p0.detailB.fraction, 0, 1, fractionTol))\r\n fraction0B = 0;\r\n if (Geometry.isAlmostEqualEitherNumber(p1.detailB.fraction, 0, 1, fractionTol))\r\n fraction1B = 0;\r\n }\r\n }\r\n const sameFractionsA = Geometry.isAlmostEqualNumber(fraction0A, fraction1A, fractionTol);\r\n if (sameFractionsA && Geometry.isAlmostEqualNumber(fraction0B, fraction1B, fractionTol))\r\n return 0;\r\n const samePointsA = xyOnly ? p0.detailA.point.isAlmostEqualXY(p1.detailA.point, pointTol) : p0.detailA.point.isAlmostEqual(p1.detailA.point, pointTol);\r\n if (samePointsA && (xyOnly ? p0.detailB.point.isAlmostEqualXY(p1.detailB.point, pointTol) : p0.detailB.point.isAlmostEqual(p1.detailB.point, pointTol)))\r\n return 0;\r\n return sameFractionsA ? fraction0B - fraction1B : fraction0A - fraction1A;\r\n };\r\n }\r\n /**\r\n * Return a pair comparator useful for sorting an array of detail pairs by their points.\r\n * * Comparison sorts the points lexicographically, `detailA.point` first, then `detailB.point`.\r\n * @param pointTol tolerance for comparing points. Default value [[Geometry.smallMetricDistance]].\r\n * @param xyOnly whether to perform point comparisons in xy only. Default is false (compare 3D points).\r\n */\r\n public static comparePairsByPoints(\r\n pointTol: number = Geometry.smallMetricDistance,\r\n xyOnly: boolean = false,\r\n ): OrderedComparator<CurveLocationDetailPair> {\r\n return (p0: CurveLocationDetailPair, p1: CurveLocationDetailPair): number => {\r\n const comparePoints = xyOnly ? Geometry.compareXY(pointTol) : Geometry.compareXYZ(pointTol);\r\n const compareA = comparePoints(p0.detailA.point, p1.detailA.point);\r\n const compareB = comparePoints(p0.detailB.point, p1.detailB.point);\r\n const samePointsA = compareA === 0;\r\n if (samePointsA && compareB === 0)\r\n return 0;\r\n return samePointsA ? compareB : compareA;\r\n };\r\n }\r\n}\r\n\r\n/**\r\n * Data bundle for a pair of arrays of CurveLocationDetail structures.\r\n * @deprecated in 4.2.0 - might be removed in next major version. Use CurveLocationDetailPair[] instead.\r\n * @public\r\n */\r\nexport class CurveLocationDetailArrayPair {\r\n /** First array of details. */\r\n public dataA: CurveLocationDetail[];\r\n /** Second array of details. */\r\n public dataB: CurveLocationDetail[];\r\n public constructor() {\r\n this.dataA = [];\r\n this.dataB = [];\r\n }\r\n}\r\n"]}
|
|
@@ -4,6 +4,21 @@
|
|
|
4
4
|
import { AngleSweepProps, BeJSONFunctions } from "../Geometry";
|
|
5
5
|
import { Angle } from "./Angle";
|
|
6
6
|
import { GrowableFloat64Array } from "./GrowableFloat64Array";
|
|
7
|
+
/**
|
|
8
|
+
* Selector for how to convert an angle outside of a sweep to an exterior fraction.
|
|
9
|
+
* @see [[AngleSweep.radiansToSignedPeriodicFractionStartEnd]], [[AngleSweep.angleToSignedPeriodicFraction]], [[AngleSweep.radiansToSignedPeriodicFraction]]
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export declare enum ExteriorFractionSelector {
|
|
13
|
+
/** Request [[Positive]] or [[Negative]] based on input sign. */
|
|
14
|
+
SameSign = -1,
|
|
15
|
+
/** Request positive exterior fraction within one period of 1. */
|
|
16
|
+
Positive = 0,
|
|
17
|
+
/** Request negative exterior fraction within one period of 0. */
|
|
18
|
+
Negative = 1,
|
|
19
|
+
/** Request the period-shifted exterior fraction closest to [0,1]. */
|
|
20
|
+
Closer = 2
|
|
21
|
+
}
|
|
7
22
|
/**
|
|
8
23
|
* An `AngleSweep` is a pair of angles at start and end of an interval.
|
|
9
24
|
*
|
|
@@ -235,9 +250,12 @@ export declare class AngleSweep implements BeJSONFunctions {
|
|
|
235
250
|
* @param radians0 start angle of sweep (in radians)
|
|
236
251
|
* @param radians1 end angle of sweep (in radians)
|
|
237
252
|
* @param zeroSweepDefault return value when the sweep is empty (default 0)
|
|
253
|
+
* @param selector how to handle an angle outside of the sweep. Default value is
|
|
254
|
+
* [[ExteriorFractionSelector.SameSign]], to request a fraction with the same sign
|
|
255
|
+
* as the unbounded fraction `(radians - radians0) / (radians1 - radians0)`.
|
|
238
256
|
* @returns fraction, or `zeroSweepDefault` if the sweep is empty.
|
|
239
257
|
*/
|
|
240
|
-
static radiansToSignedPeriodicFractionStartEnd(radians: number, radians0: number, radians1: number, zeroSweepDefault?: number): number;
|
|
258
|
+
static radiansToSignedPeriodicFractionStartEnd(radians: number, radians0: number, radians1: number, zeroSweepDefault?: number, selector?: ExteriorFractionSelector): number;
|
|
241
259
|
/**
|
|
242
260
|
* Return the fractionalized position of the given angle (as radians) computed with consideration of
|
|
243
261
|
* 2PI period and with consideration of angle sweep direction (CW or CCW).
|
|
@@ -249,9 +267,12 @@ export declare class AngleSweep implements BeJSONFunctions {
|
|
|
249
267
|
* * allows period shift
|
|
250
268
|
* @param radians input angle (in radians)
|
|
251
269
|
* @param zeroSweepDefault return value when this sweep is empty (default 0)
|
|
270
|
+
* @param selector how to handle an angle outside of the sweep. Default value is
|
|
271
|
+
* [[ExteriorFractionSelector.SameSign]], to request a fraction with the same sign
|
|
272
|
+
* as the unbounded fraction `(radians - startRadians) / sweepRadians`.
|
|
252
273
|
* @returns fraction, or `zeroSweepDefault` if this sweep is empty.
|
|
253
274
|
*/
|
|
254
|
-
radiansToSignedPeriodicFraction(radians: number, zeroSweepDefault?: number): number;
|
|
275
|
+
radiansToSignedPeriodicFraction(radians: number, zeroSweepDefault?: number, selector?: ExteriorFractionSelector): number;
|
|
255
276
|
/**
|
|
256
277
|
* Return the fractionalized position of the given angle (as Angle) computed with consideration of
|
|
257
278
|
* 2PI period and with consideration of angle sweep direction (CW or CCW).
|
|
@@ -263,9 +284,12 @@ export declare class AngleSweep implements BeJSONFunctions {
|
|
|
263
284
|
* * allows period shift
|
|
264
285
|
* @param theta input angle
|
|
265
286
|
* @param zeroSweepDefault return value when this sweep is empty (default 0)
|
|
287
|
+
* @param selector how to handle an angle outside of the sweep. Default value is
|
|
288
|
+
* [[ExteriorFractionSelector.SameSign]], to request a fraction with the same sign
|
|
289
|
+
* as the fraction returned by `angleToUnboundedFraction(theta)`.
|
|
266
290
|
* @returns fraction, or `zeroSweepDefault` if this sweep is empty.
|
|
267
291
|
*/
|
|
268
|
-
angleToSignedPeriodicFraction(theta: Angle, zeroSweepDefault?: number): number;
|
|
292
|
+
angleToSignedPeriodicFraction(theta: Angle, zeroSweepDefault?: number, selector?: ExteriorFractionSelector): number;
|
|
269
293
|
/**
|
|
270
294
|
* Return the fractionalized position of the given radian angle with respect to the sweep.
|
|
271
295
|
* * The start angle returns fraction 0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AngleSweep.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/AngleSweep.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,eAAe,EAAY,MAAM,aAAa,CAAC;AACzE,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,UAAW,YAAW,eAAe;IAChD,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,SAAS,CAAS;IAC1B,iEAAiE;IACjE,IAAW,YAAY,WAEtB;IACD,+DAA+D;IAC/D,IAAW,UAAU,WAEpB;IACD,8DAA8D;IAC9D,IAAW,YAAY,WAEtB;IACD,iEAAiE;IACjE,IAAW,YAAY,WAEtB;IACD,+DAA+D;IAC/D,IAAW,UAAU,WAEpB;IACD,8DAA8D;IAC9D,IAAW,YAAY,WAEtB;IACD,sFAAsF;IACtF,IAAW,OAAO,YAEjB;IACD,8CAA8C;IAC9C,IAAW,UAAU,UAEpB;IACD,4CAA4C;IAC5C,IAAW,QAAQ,UAElB;IACD;;;;;OAKG;WACW,MAAM,CAAC,IAAI,CAAC,EAAE,UAAU,GAAG,KAAK,GAAG,UAAU;IAO3D;;;;;;;;;;OAUG;IACH,OAAO;IAIP;;;OAGG;IACI,kBAAkB,CAAC,YAAY,GAAE,MAAU,EAAE,UAAU,GAAE,MAAsB;IAQtF,uDAAuD;IAChD,kBAAkB,CAAC,YAAY,GAAE,MAAU,EAAE,UAAU,GAAE,MAAc;IAG9E;;;OAGG;WACW,qBAAqB,CAAC,YAAY,GAAE,MAAU,EAAE,UAAU,GAAE,MAAsB,EAAE,MAAM,CAAC,EAAE,UAAU,GAAG,UAAU;IAKlI,oG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I,GAAG;IAGpB;;;;;OAKG;IACI,6BAA6B,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,GAAE,MAAmC,GAAG,OAAO;IAKhH;;;;;OAKG;IACI,0BAA0B,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,GAAE,MAAmC,GAAG,OAAO;IAI7G;;;;;OAKG;IACI,aAAa,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO;CAGjD"}
|
|
@@ -7,9 +7,25 @@
|
|
|
7
7
|
* @module CartesianGeometry
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.AngleSweep = void 0;
|
|
10
|
+
exports.AngleSweep = exports.ExteriorFractionSelector = void 0;
|
|
11
11
|
const Geometry_1 = require("../Geometry");
|
|
12
12
|
const Angle_1 = require("./Angle");
|
|
13
|
+
/**
|
|
14
|
+
* Selector for how to convert an angle outside of a sweep to an exterior fraction.
|
|
15
|
+
* @see [[AngleSweep.radiansToSignedPeriodicFractionStartEnd]], [[AngleSweep.angleToSignedPeriodicFraction]], [[AngleSweep.radiansToSignedPeriodicFraction]]
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
var ExteriorFractionSelector;
|
|
19
|
+
(function (ExteriorFractionSelector) {
|
|
20
|
+
/** Request [[Positive]] or [[Negative]] based on input sign. */
|
|
21
|
+
ExteriorFractionSelector[ExteriorFractionSelector["SameSign"] = -1] = "SameSign";
|
|
22
|
+
/** Request positive exterior fraction within one period of 1. */
|
|
23
|
+
ExteriorFractionSelector[ExteriorFractionSelector["Positive"] = 0] = "Positive";
|
|
24
|
+
/** Request negative exterior fraction within one period of 0. */
|
|
25
|
+
ExteriorFractionSelector[ExteriorFractionSelector["Negative"] = 1] = "Negative";
|
|
26
|
+
/** Request the period-shifted exterior fraction closest to [0,1]. */
|
|
27
|
+
ExteriorFractionSelector[ExteriorFractionSelector["Closer"] = 2] = "Closer";
|
|
28
|
+
})(ExteriorFractionSelector || (exports.ExteriorFractionSelector = ExteriorFractionSelector = {}));
|
|
13
29
|
/**
|
|
14
30
|
* An `AngleSweep` is a pair of angles at start and end of an interval.
|
|
15
31
|
*
|
|
@@ -394,9 +410,12 @@ class AngleSweep {
|
|
|
394
410
|
* @param radians0 start angle of sweep (in radians)
|
|
395
411
|
* @param radians1 end angle of sweep (in radians)
|
|
396
412
|
* @param zeroSweepDefault return value when the sweep is empty (default 0)
|
|
413
|
+
* @param selector how to handle an angle outside of the sweep. Default value is
|
|
414
|
+
* [[ExteriorFractionSelector.SameSign]], to request a fraction with the same sign
|
|
415
|
+
* as the unbounded fraction `(radians - radians0) / (radians1 - radians0)`.
|
|
397
416
|
* @returns fraction, or `zeroSweepDefault` if the sweep is empty.
|
|
398
417
|
*/
|
|
399
|
-
static radiansToSignedPeriodicFractionStartEnd(radians, radians0, radians1, zeroSweepDefault = 0.0) {
|
|
418
|
+
static radiansToSignedPeriodicFractionStartEnd(radians, radians0, radians1, zeroSweepDefault = 0.0, selector = ExteriorFractionSelector.SameSign) {
|
|
400
419
|
const sweep = radians1 - radians0;
|
|
401
420
|
if (Angle_1.Angle.isAlmostEqualRadiansNoPeriodShift(0, sweep))
|
|
402
421
|
return zeroSweepDefault;
|
|
@@ -414,7 +433,14 @@ class AngleSweep {
|
|
|
414
433
|
return 1.0;
|
|
415
434
|
}
|
|
416
435
|
const fraction = (radians - radians0) / sweep;
|
|
417
|
-
|
|
436
|
+
let toNegativeFraction;
|
|
437
|
+
if (selector === ExteriorFractionSelector.Negative)
|
|
438
|
+
toNegativeFraction = true;
|
|
439
|
+
else if (selector === ExteriorFractionSelector.Positive)
|
|
440
|
+
toNegativeFraction = false;
|
|
441
|
+
else if (selector === ExteriorFractionSelector.SameSign)
|
|
442
|
+
toNegativeFraction = fraction < 0;
|
|
443
|
+
return this.fractionToSignedPeriodicFractionStartEnd(fraction, radians0, radians1, toNegativeFraction);
|
|
418
444
|
}
|
|
419
445
|
/**
|
|
420
446
|
* Return the fractionalized position of the given angle (as radians) computed with consideration of
|
|
@@ -427,10 +453,13 @@ class AngleSweep {
|
|
|
427
453
|
* * allows period shift
|
|
428
454
|
* @param radians input angle (in radians)
|
|
429
455
|
* @param zeroSweepDefault return value when this sweep is empty (default 0)
|
|
456
|
+
* @param selector how to handle an angle outside of the sweep. Default value is
|
|
457
|
+
* [[ExteriorFractionSelector.SameSign]], to request a fraction with the same sign
|
|
458
|
+
* as the unbounded fraction `(radians - startRadians) / sweepRadians`.
|
|
430
459
|
* @returns fraction, or `zeroSweepDefault` if this sweep is empty.
|
|
431
460
|
*/
|
|
432
|
-
radiansToSignedPeriodicFraction(radians, zeroSweepDefault = 0.0) {
|
|
433
|
-
return AngleSweep.radiansToSignedPeriodicFractionStartEnd(radians, this._radians0, this._radians1, zeroSweepDefault);
|
|
461
|
+
radiansToSignedPeriodicFraction(radians, zeroSweepDefault = 0.0, selector = ExteriorFractionSelector.SameSign) {
|
|
462
|
+
return AngleSweep.radiansToSignedPeriodicFractionStartEnd(radians, this._radians0, this._radians1, zeroSweepDefault, selector);
|
|
434
463
|
}
|
|
435
464
|
/**
|
|
436
465
|
* Return the fractionalized position of the given angle (as Angle) computed with consideration of
|
|
@@ -443,10 +472,13 @@ class AngleSweep {
|
|
|
443
472
|
* * allows period shift
|
|
444
473
|
* @param theta input angle
|
|
445
474
|
* @param zeroSweepDefault return value when this sweep is empty (default 0)
|
|
475
|
+
* @param selector how to handle an angle outside of the sweep. Default value is
|
|
476
|
+
* [[ExteriorFractionSelector.SameSign]], to request a fraction with the same sign
|
|
477
|
+
* as the fraction returned by `angleToUnboundedFraction(theta)`.
|
|
446
478
|
* @returns fraction, or `zeroSweepDefault` if this sweep is empty.
|
|
447
479
|
*/
|
|
448
|
-
angleToSignedPeriodicFraction(theta, zeroSweepDefault = 0.0) {
|
|
449
|
-
return this.radiansToSignedPeriodicFraction(theta.radians, zeroSweepDefault);
|
|
480
|
+
angleToSignedPeriodicFraction(theta, zeroSweepDefault = 0.0, selector = ExteriorFractionSelector.SameSign) {
|
|
481
|
+
return this.radiansToSignedPeriodicFraction(theta.radians, zeroSweepDefault, selector);
|
|
450
482
|
}
|
|
451
483
|
/**
|
|
452
484
|
* Return the fractionalized position of the given radian angle with respect to the sweep.
|