@itwin/core-geometry 5.15.0-dev.1 → 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 +30 -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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AngleSweep.js","sourceRoot":"","sources":["../../../src/geometry3d/AngleSweep.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,0CAAyE;AACzE,mCAAgC;AAGhC;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAa,UAAU;IACb,SAAS,CAAS;IAClB,SAAS,CAAS;IAC1B,iEAAiE;IACjE,IAAW,YAAY;QACrB,OAAO,aAAK,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,CAAC,sBAAsB;IACrD,CAAC;IACD,+CAA+C;IACxC,MAAM,CAAC,QAAQ,CAAC,IAAsB;QAC3C,MAAM,MAAM,GAAG,UAAU,CAAC,SAAS,EAAE,CAAC;QACtC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACzB,OAAO,MAAM,CAAC;IAChB,CAAC;IACD;;;OAGG;IACI,MAAM;QACX,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IAC9C,CAAC;IACD;;;;;OAKG;IACI,6BAA6B,CAAC,KAAiB,EAAE,YAAoB,mBAAQ,CAAC,iBAAiB;QACpG,OAAO,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC,KAAK,CAAC,oEAAoE;eACjG,aAAK,CAAC,oCAAoC,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC;eACtF,aAAK,CAAC,oCAAoC,CAAC,IAAI,CAAC,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;IACpG,CAAC;IACD;;;;;OAKG;IACI,0BAA0B,CAAC,KAAiB,EAAE,YAAoB,mBAAQ,CAAC,iBAAiB;QACjG,OAAO,aAAK,CAAC,iCAAiC,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC;eACrF,aAAK,CAAC,iCAAiC,CAAC,IAAI,CAAC,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;IACjG,CAAC;IACD;;;;;OAKG;IACI,aAAa,CAAC,KAAiB;QACpC,OAAO,IAAI,CAAC,0BAA0B,CAAC,KAAK,CAAC,CAAC;IAChD,CAAC;CACF;AAtjBD,gCAsjBC","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 CartesianGeometry\r\n */\r\n\r\nimport { AngleSweepProps, BeJSONFunctions, Geometry } from \"../Geometry\";\r\nimport { Angle } from \"./Angle\";\r\nimport { GrowableFloat64Array } from \"./GrowableFloat64Array\";\r\n\r\n/**\r\n * An `AngleSweep` is a pair of angles at start and end of an interval.\r\n *\r\n * * For stroking purposes, the \"included interval\" is all angles numerically reached\r\n * by `theta = start + f * (end - start)`, where `0 <= f <= 1`.\r\n * * This stroking formula is simple numbers -- 2PI shifts are not involved.\r\n * * 2PI shifts do become important in the reverse mapping of an angle to a fraction.\r\n * * Angles greater than 360 and less than 0 are fine as endpoints.\r\n * * An AngleSweep determines orientation only _in concert with a reference vector_, e.g., a plane normal like (0,0,1).\r\n * * Be careful reading orientation from an AngleSweep without a reference vector!\r\n * * If \"start < end\" the angles in the sweep proceed counterclockwise around the reference vector.\r\n * * If \"start > end\" the angles in the sweep proceed clockwise around the reference vector.\r\n * * (350,370) covers the same angles as (-10,10), and both sweeps are counterclockwise around the reference vector.\r\n * * (370,350) covers the same angles as (10,-10), and both sweeps are clockwise around the reference vector.\r\n * * (370,350) covers the same angles as (-10,10), but the sweeps have opposite orientation.\r\n * * Math details can be found at docs/learning/geometry/Angle.md .\r\n * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/AngleSweep .\r\n * @public\r\n */\r\nexport class AngleSweep implements BeJSONFunctions {\r\n private _radians0: number;\r\n private _radians1: number;\r\n /** Read-property for degrees at the start of this AngleSweep. */\r\n public get startDegrees() {\r\n return Angle.radiansToDegrees(this._radians0);\r\n }\r\n /** Read-property for degrees at the end of this AngleSweep. */\r\n public get endDegrees() {\r\n return Angle.radiansToDegrees(this._radians1);\r\n }\r\n /** Read-property for signed start-to-end sweep in degrees. */\r\n public get sweepDegrees() {\r\n return Angle.radiansToDegrees(this.sweepRadians);\r\n }\r\n /** Read-property for degrees at the start of this AngleSweep. */\r\n public get startRadians() {\r\n return this._radians0;\r\n }\r\n /** Read-property for degrees at the end of this AngleSweep. */\r\n public get endRadians() {\r\n return this._radians1;\r\n }\r\n /** Read-property for signed start-to-end sweep in radians. */\r\n public get sweepRadians() {\r\n return this._radians1 - this._radians0;\r\n }\r\n /** Whether the sweep angles are within smallAngle tolerance, without period shift. */\r\n public get isEmpty() {\r\n return Angle.isAlmostEqualRadiansNoPeriodShift(0, this.sweepRadians);\r\n }\r\n /** Return the (strongly typed) start angle */\r\n public get startAngle() {\r\n return Angle.createRadians(this._radians0);\r\n }\r\n /** Return the (strongly typed) end angle */\r\n public get endAngle() {\r\n return Angle.createRadians(this._radians1);\r\n }\r\n /**\r\n * Create a sweep as one of\r\n * * A clone of a given sweep\r\n * * 0 to given angle\r\n * * full circle if no arg given (sweep 0 to 360 degrees)\r\n */\r\n public static create(data?: AngleSweep | Angle): AngleSweep {\r\n if (data instanceof AngleSweep)\r\n return data.clone();\r\n if (data instanceof Angle)\r\n return new AngleSweep(0, data.radians);\r\n return AngleSweep.create360();\r\n }\r\n /**\r\n * (private) constructor with start and end angles in radians.\r\n * * Use explicitly named static methods to clarify intent and units of inputs:\r\n *\r\n * * createStartEndRadians (startRadians:number, endRadians:number)\r\n * * createStartEndDegrees (startDegrees:number, endDegrees:number)\r\n * * createStartEnd (startAngle:Angle, endAngle:Angle)\r\n * * createStartSweepRadians (startRadians:number, sweepRadians:number)\r\n * * createStartSweepDegrees (startDegrees:number, sweepDegrees:number)\r\n * * createStartSweep (startAngle:Angle, sweepAngle:Angle)\r\n */\r\n private constructor(startRadians: number = 0, endRadians: number = 0) {\r\n this._radians0 = startRadians;\r\n this._radians1 = endRadians;\r\n }\r\n /**\r\n * Directly set the start and end angles in radians\r\n * * If the difference between startRadians and endRadians is greater than 360, the function limits the angle sweep to 360.\r\n */\r\n public setStartEndRadians(startRadians: number = 0, endRadians: number = 2.0 * Math.PI) {\r\n const delta = endRadians - startRadians;\r\n if (Angle.isFullCircleRadians(delta)) {\r\n endRadians = startRadians + (delta > 0 ? 2.0 : -2.0) * Math.PI;\r\n }\r\n this._radians0 = startRadians;\r\n this._radians1 = endRadians;\r\n }\r\n /** Directly set the start and end angles in degrees */\r\n public setStartEndDegrees(startDegrees: number = 0, endDegrees: number = 360.0) {\r\n this.setStartEndRadians(Angle.degreesToRadians(startDegrees), Angle.degreesToRadians(endDegrees));\r\n }\r\n /**\r\n * Create an AngleSweep from start and end angles given in radians.\r\n * * If the difference between startRadians and endRadians is greater than 360, the function limits the angle sweep to 360.\r\n */\r\n public static createStartEndRadians(startRadians: number = 0, endRadians: number = 2.0 * Math.PI, result?: AngleSweep): AngleSweep {\r\n result = result ? result : new AngleSweep();\r\n result.setStartEndRadians(startRadians, endRadians);\r\n return result;\r\n }\r\n /** Return the AngleSweep obtained by adding `radians` to the start and end angles of this sweep. */\r\n public clonePlusRadians(radians: number): AngleSweep {\r\n return new AngleSweep(this._radians0 + radians, this._radians1 + radians);\r\n }\r\n /** Return the AngleSweep obtained by subtracting `radians` from the start and end angles of this sweep. */\r\n public cloneMinusRadians(radians: number): AngleSweep {\r\n return this.clonePlusRadians(-radians);\r\n }\r\n /** Create an AngleSweep from start and end angles given in degrees. */\r\n public static createStartEndDegrees(startDegrees: number = 0, endDegrees: number = 360, result?: AngleSweep): AngleSweep {\r\n return AngleSweep.createStartEndRadians(Angle.degreesToRadians(startDegrees), Angle.degreesToRadians(endDegrees), result);\r\n }\r\n /** Create an angle sweep from strongly typed start and end angles */\r\n public static createStartEnd(startAngle: Angle, endAngle: Angle, result?: AngleSweep): AngleSweep {\r\n result = result ? result : new AngleSweep();\r\n result.setStartEndRadians(startAngle.radians, endAngle.radians);\r\n return result;\r\n }\r\n /** Create an AngleSweep from start and end angles given in radians. */\r\n public static createStartSweepRadians(startRadians: number = 0, sweepRadians: number = Math.PI, result?: AngleSweep): AngleSweep {\r\n result = result ? result : new AngleSweep();\r\n result.setStartEndRadians(startRadians, startRadians + sweepRadians);\r\n return result;\r\n }\r\n /** Create an AngleSweep from start and sweep given in degrees. */\r\n public static createStartSweepDegrees(startDegrees: number = 0, sweepDegrees: number = 360, result?: AngleSweep): AngleSweep {\r\n return AngleSweep.createStartEndRadians(Angle.degreesToRadians(startDegrees), Angle.degreesToRadians(startDegrees + sweepDegrees), result);\r\n }\r\n /** Create an angle sweep with limits given as (strongly typed) angles for start and sweep */\r\n public static createStartSweep(startAngle: Angle, sweepAngle: Angle, result?: AngleSweep): AngleSweep {\r\n return AngleSweep.createStartSweepRadians(startAngle.radians, sweepAngle.radians, result);\r\n }\r\n /** Return a sweep with limits interpolated between this and other. */\r\n public interpolate(fraction: number, other: AngleSweep): AngleSweep {\r\n return new AngleSweep(\r\n Geometry.interpolate(this._radians0, fraction, other._radians0),\r\n Geometry.interpolate(this._radians1, fraction, other._radians1),\r\n );\r\n }\r\n /** Copy from other AngleSweep. */\r\n public setFrom(other: AngleSweep) {\r\n this._radians0 = other._radians0;\r\n this._radians1 = other._radians1;\r\n }\r\n /**\r\n * Create a full circle sweep (CCW).\r\n * @param startRadians start angle in radians. Defaults to 0.\r\n * @param result optional preallocated object to populate and return.\r\n */\r\n public static create360(startRadians?: number, result?: AngleSweep): AngleSweep {\r\n startRadians = startRadians ? startRadians : 0.0;\r\n const endRadians = startRadians + 2.0 * Math.PI;\r\n if (result) {\r\n result.setStartEndRadians(startRadians, endRadians);\r\n return result;\r\n }\r\n return new AngleSweep(startRadians, endRadians);\r\n }\r\n /** Create a sweep from the south pole to the north pole (-90 to +90). */\r\n public static createFullLatitude() {\r\n return AngleSweep.createStartEndRadians(-0.5 * Math.PI, 0.5 * Math.PI);\r\n }\r\n /** Reverse the start and end angle in place. */\r\n public reverseInPlace() {\r\n const tmp = this._radians0;\r\n this._radians0 = this._radians1;\r\n this._radians1 = tmp;\r\n }\r\n /**\r\n * Return a sweep for the \"other\" part of the circle.\r\n * @param reverseDirection true to move backwards (CW) from start to end, false to more forwards (CCW) from start to end.\r\n */\r\n public cloneComplement(reverseDirection: boolean = false, result?: AngleSweep): AngleSweep {\r\n const s = this.sweepRadians >= 0 ? 2.0 : -2.0;\r\n if (reverseDirection)\r\n return AngleSweep.createStartEndRadians(this.startRadians, this.endRadians - s * Math.PI, result);\r\n else\r\n return AngleSweep.createStartEndRadians(this.endRadians, this.startRadians + s * Math.PI, result);\r\n }\r\n /** Restrict start and end angles to the degree range [-90,+90]. */\r\n public capLatitudeInPlace(): void {\r\n const limit = 0.5 * Math.PI;\r\n this._radians0 = Geometry.clampToStartEnd(this._radians0, -limit, limit);\r\n this._radians1 = Geometry.clampToStartEnd(this._radians1, -limit, limit);\r\n }\r\n /**\r\n * Restrict [[sweepDegrees]] to the range [-360, 360].\r\n * The start angle and sign of the sweep angle are unchanged.\r\n */\r\n public clampToFullCircle(result?: AngleSweep): AngleSweep {\r\n result = result ?? new AngleSweep();\r\n const sweepRadians = Geometry.clampToStartEnd(this.sweepRadians, -Angle.pi2Radians, Angle.pi2Radians);\r\n result.setStartEndRadians(this._radians0, this._radians0 + sweepRadians);\r\n return result;\r\n }\r\n /** Ask if the sweep is counterclockwise, i.e. positive sweep. */\r\n public get isCCW(): boolean {\r\n return this._radians1 >= this._radians0;\r\n }\r\n /** Ask if the sweep is a full circle. */\r\n public get isFullCircle(): boolean {\r\n return Angle.isFullCircleRadians(this.sweepRadians);\r\n }\r\n /** Ask if the sweep is a full sweep from south pole to north pole. */\r\n public get isFullLatitudeSweep(): boolean {\r\n const a = Math.PI * 0.5;\r\n return Angle.isAlmostEqualRadiansNoPeriodShift(this._radians0, -a)\r\n && Angle.isAlmostEqualRadiansNoPeriodShift(this._radians1, a);\r\n }\r\n /** Return a clone of this sweep. */\r\n public clone(): AngleSweep {\r\n return new AngleSweep(this._radians0, this._radians1);\r\n }\r\n /** Convert fractional position in the sweep to radians. */\r\n public fractionToRadians(fraction: number): number {\r\n return fraction < 0.5 ?\r\n this._radians0 + fraction * this.sweepRadians :\r\n this._radians1 + (fraction - 1.0) * this.sweepRadians;\r\n }\r\n /** Convert fractional position in the sweep to strongly typed Angle object. */\r\n public fractionToAngle(fraction: number) {\r\n return Angle.createRadians(this.fractionToRadians(fraction));\r\n }\r\n /**\r\n * Return 2PI divided by the sweep radians.\r\n * * This is the number of fractional intervals required to cover a whole circle.\r\n * @returns period of the sweep, or 1 if sweep is empty.\r\n */\r\n public fractionPeriod(): number {\r\n return this.isEmpty ? 1.0 : Angle.pi2Radians / Math.abs(this.sweepRadians);\r\n }\r\n /**\r\n * Return the fractionalized position of the given angle (as Angle) computed without consideration of\r\n * 2PI period and without consideration of angle sweep direction (CW or CCW).\r\n * * the start angle is at fraction 0\r\n * * the end angle is at fraction 1\r\n * * interior angles are between 0 and 1\r\n * * negative fraction for angles \"before\" the start angle if start < end\r\n * * fraction larger than one for angles \"after\" the end angle if start < end\r\n * * fraction larger than one for angles \"before\" the start angle if start > end\r\n * * negative fraction for angles \"after\" the end angle if start > end\r\n * * does not allow period shift\r\n * @returns unbounded fraction, or 1 if sweep is empty.\r\n */\r\n public angleToUnboundedFraction(theta: Angle): number {\r\n return this.isEmpty ? 1.0 : (theta.radians - this._radians0) / this.sweepRadians;\r\n }\r\n\r\n /**\r\n * Convert a sweep fraction to the equivalent period-shifted fraction inside the sweep, or within one period of zero\r\n * on the desired side.\r\n * @param fraction fraction of the sweep.\r\n * @param radians0 start angle of sweep (in radians).\r\n * @param radians1 end angle of sweep (in radians).\r\n * @param toNegativeFraction exterior fraction handling:\r\n * * if true, return `fraction` period-shifted to within one period of the start\r\n * * if false, return `fraction` period-shifted to within one period of the end\r\n * * if undefined, return the period-shift of `fraction` closest in fraction space to [0,1].\r\n * @returns period-shifted fraction. If `fraction` is already in [0,1], or the sweep is empty, then `fraction` is\r\n * returned unchanged.\r\n */\r\n public static fractionToSignedPeriodicFractionStartEnd(fraction: number, radians0: number, radians1: number, toNegativeFraction?: boolean): number {\r\n const sweep = radians1 - radians0;\r\n if (Angle.isAlmostEqualRadiansNoPeriodShift(0, sweep))\r\n return fraction; // empty sweep\r\n if (Geometry.isIn01(fraction))\r\n return fraction;\r\n const period = Angle.pi2Radians / Math.abs(sweep);\r\n fraction = fraction % period; // period-shifted equivalent fraction closest to 0 with same sign as fraction\r\n if (fraction + period < 1)\r\n fraction += period; // it's really an interior fraction\r\n if (Geometry.isIn01(fraction))\r\n return fraction;\r\n if (toNegativeFraction === true)\r\n return fraction < 0 ? fraction : fraction - period;\r\n if (toNegativeFraction === false)\r\n return fraction > 1 ? fraction : fraction + period;\r\n const fractionDistFrom01 = fraction < 0 ? -fraction : fraction - 1;\r\n const fraction2 = fraction < 0 ? fraction + period : fraction - period; // period-shift with opposite sign\r\n const fraction2DistFrom01 = fraction2 < 0 ? -fraction2 : fraction2 - 1;\r\n return fractionDistFrom01 < fraction2DistFrom01 ? fraction : fraction2; // choose the period-shift closer to [0,1]\r\n }\r\n /**\r\n * Convert a sweep fraction to the equivalent period-shifted fraction inside this sweep, or within one period of\r\n * zero on the desired side.\r\n * @param fraction fraction of the sweep.\r\n * @param toNegativeFraction exterior fraction handling:\r\n * * if true, return `fraction` period-shifted to within one period of the start\r\n * * if false, return `fraction` period-shifted to within one period of the end\r\n * * if undefined, return the period-shift of `fraction` closest in fraction space to [0,1].\r\n * @returns period-shifted fraction. If `fraction` is already in [0,1], or the sweep is empty, then `fraction` is\r\n * returned unchanged.\r\n */\r\n public fractionToSignedPeriodicFraction(fraction: number, toNegativeFraction?: boolean): number {\r\n return AngleSweep.fractionToSignedPeriodicFractionStartEnd(fraction, this._radians0, this._radians1, toNegativeFraction);\r\n }\r\n\r\n /**\r\n * Return the fractionalized position of the given angle (as radians), computed with consideration of 2PI period.\r\n * * consider radians0 as `start` angle of the sweep and radians1 as `end` angle of the sweep\r\n * * the start angle is at fraction 0\r\n * * the end angle is at fraction 1\r\n * * interior angles are between 0 and 1\r\n * * all exterior angles are at fractions greater than 1\r\n * * allows period shift\r\n * @param radians input angle (in radians)\r\n * @param radians0 start angle of sweep (in radians)\r\n * @param radians1 end angle of sweep (in radians)\r\n * @param zeroSweepDefault return value when the sweep is empty (default 0)\r\n * @returns nonnegative fraction, or `zeroSweepDefault` if the sweep is empty.\r\n */\r\n public static radiansToPositivePeriodicFractionStartEnd(radians: number, radians0: number, radians1: number, zeroSweepDefault: number = 0.0): number {\r\n const zeroSweepMarker = Geometry.largeCoordinateResult;\r\n let fraction = this.radiansToSignedPeriodicFractionStartEnd(radians, radians0, radians1, zeroSweepMarker);\r\n if (fraction === zeroSweepMarker)\r\n return zeroSweepDefault;\r\n if (fraction < 0) {\r\n const period = Angle.pi2Radians / Math.abs(radians1 - radians0);\r\n fraction += period;\r\n }\r\n return fraction;\r\n }\r\n /**\r\n * Return the fractionalized position of the given angle (as radians), computed with consideration of 2PI period.\r\n * * the start angle is at fraction 0\r\n * * the end angle is at fraction 1\r\n * * interior angles are between 0 and 1\r\n * * all exterior angles are at fractions greater than 1\r\n * * allows period shift\r\n * @param radians input angle (in radians)\r\n * @param zeroSweepDefault return value when this sweep is empty (default 0)\r\n * @returns nonnegative fraction, or `zeroSweepDefault` if the sweep is empty.\r\n */\r\n public radiansToPositivePeriodicFraction(radians: number, zeroSweepDefault: number = 0.0): number {\r\n return AngleSweep.radiansToPositivePeriodicFractionStartEnd(radians, this._radians0, this._radians1, zeroSweepDefault);\r\n }\r\n /**\r\n * Return the fractionalized position of the given angle (as Angle), computed with consideration of 2PI period.\r\n * * the start angle is at fraction 0\r\n * * the end angle is at fraction 1\r\n * * interior angles are between 0 and 1\r\n * * all exterior angles are at fractions greater than 1\r\n * * allows period shift\r\n * @param theta input angle\r\n * @param zeroSweepDefault return value when this sweep is empty (default 0)\r\n * @returns nonnegative fraction, or `zeroSweepDefault` if the sweep is empty.\r\n */\r\n public angleToPositivePeriodicFraction(theta: Angle, zeroSweepDefault: number = 0.0): number {\r\n return this.radiansToPositivePeriodicFraction(theta.radians, zeroSweepDefault);\r\n }\r\n /**\r\n * Return the fractionalized position of the given array of angles (as radian), computed with consideration of 2PI period.\r\n * * fraction is always positive\r\n * * the start angle is at fraction 0\r\n * * the end angle is at fraction 1\r\n * * interior angles are between 0 and 1\r\n * * all exterior angles are at fractions greater than 1\r\n * * allows period shift\r\n */\r\n public radiansArrayToPositivePeriodicFractions(data: GrowableFloat64Array) {\r\n const n = data.length;\r\n for (let i = 0; i < n; i++) {\r\n data.reassign(i, this.radiansToPositivePeriodicFraction(data.atUncheckedIndex(i)));\r\n }\r\n }\r\n /**\r\n * Return the fractionalized position of the given angle (as radians) computed with consideration of\r\n * 2PI period and with consideration of angle sweep direction (CW or CCW).\r\n * * the start angle is at fraction 0\r\n * * the end angle is at fraction 1\r\n * * interior angles are between 0 and 1\r\n * * negative fraction for angles \"before\" the start angle\r\n * * fraction larger than one for angles \"after\" the end angle\r\n * * allows period shift\r\n * @param radians input angle (in radians)\r\n * @param radians0 start angle of sweep (in radians)\r\n * @param radians1 end angle of sweep (in radians)\r\n * @param zeroSweepDefault return value when the sweep is empty (default 0)\r\n * @returns fraction, or `zeroSweepDefault` if the sweep is empty.\r\n */\r\n public static radiansToSignedPeriodicFractionStartEnd(radians: number, radians0: number, radians1: number, zeroSweepDefault: number = 0.0): number {\r\n const sweep = radians1 - radians0;\r\n if (Angle.isAlmostEqualRadiansNoPeriodShift(0, sweep))\r\n return zeroSweepDefault;\r\n if (Angle.isAlmostEqualRadiansAllowPeriodShift(radians0, radians1)) {\r\n // for sweep = 2nPi !== 0, allow matching without period shift, else we never return 1.0\r\n if (Angle.isAlmostEqualRadiansNoPeriodShift(radians, radians0))\r\n return 0.0;\r\n if (Angle.isAlmostEqualRadiansNoPeriodShift(radians, radians1))\r\n return 1.0;\r\n } else {\r\n if (Angle.isAlmostEqualRadiansAllowPeriodShift(radians, radians0))\r\n return 0.0;\r\n if (Angle.isAlmostEqualRadiansAllowPeriodShift(radians, radians1))\r\n return 1.0;\r\n }\r\n const fraction = (radians - radians0) / sweep;\r\n return this.fractionToSignedPeriodicFractionStartEnd(fraction, radians0, radians1, fraction < 0);\r\n }\r\n /**\r\n * Return the fractionalized position of the given angle (as radians) computed with consideration of\r\n * 2PI period and with consideration of angle sweep direction (CW or CCW).\r\n * * the start angle is at fraction 0\r\n * * the end angle is at fraction 1\r\n * * interior angles are between 0 and 1\r\n * * negative fraction for angles \"before\" the start angle\r\n * * fraction larger than one for angles \"after\" the end angle\r\n * * allows period shift\r\n * @param radians input angle (in radians)\r\n * @param zeroSweepDefault return value when this sweep is empty (default 0)\r\n * @returns fraction, or `zeroSweepDefault` if this sweep is empty.\r\n */\r\n public radiansToSignedPeriodicFraction(radians: number, zeroSweepDefault: number = 0.0): number {\r\n return AngleSweep.radiansToSignedPeriodicFractionStartEnd(radians, this._radians0, this._radians1, zeroSweepDefault);\r\n }\r\n /**\r\n * Return the fractionalized position of the given angle (as Angle) computed with consideration of\r\n * 2PI period and with consideration of angle sweep direction (CW or CCW).\r\n * * the start angle is at fraction 0\r\n * * the end angle is at fraction 1\r\n * * interior angles are between 0 and 1\r\n * * negative fraction for angles \"before\" the start angle\r\n * * fraction larger than one for angles \"after\" the end angle\r\n * * allows period shift\r\n * @param theta input angle\r\n * @param zeroSweepDefault return value when this sweep is empty (default 0)\r\n * @returns fraction, or `zeroSweepDefault` if this sweep is empty.\r\n */\r\n public angleToSignedPeriodicFraction(theta: Angle, zeroSweepDefault: number = 0.0): number {\r\n return this.radiansToSignedPeriodicFraction(theta.radians, zeroSweepDefault);\r\n }\r\n\r\n /**\r\n * Return the fractionalized position of the given radian angle with respect to the sweep.\r\n * * The start angle returns fraction 0\r\n * * The end angle returns fraction 1\r\n * * Interior angles (and their multiples of 2PI) return fractions in [0,1].\r\n * * Exterior angles return fractions outside [0,1] according to `toNegativeFraction`.\r\n * @param radians input angle (in radians)\r\n * @param radians0 start angle of sweep (in radians)\r\n * @param radians1 end angle of sweep (in radians)\r\n * @param toNegativeFraction convert an exterior angle to a negative number (true), or to\r\n * a number greater than one (false, default). If false, this is just [[radiansToPositivePeriodicFractionStartEnd]].\r\n * @param zeroSweepDefault return value when the sweep is empty (default 0).\r\n * @returns fraction, or `zeroSweepDefault` if the sweep is empty\r\n */\r\n public static radiansToSignedFractionStartEnd(radians: number, radians0: number, radians1: number, toNegativeFraction: boolean = false, zeroSweepDefault: number = 0.0): number {\r\n const zeroSweepMarker = Geometry.largeCoordinateResult;\r\n let fraction = this.radiansToSignedPeriodicFractionStartEnd(radians, radians0, radians1, zeroSweepMarker);\r\n if (fraction === zeroSweepMarker)\r\n return zeroSweepDefault;\r\n if ((toNegativeFraction && fraction > 1) || (!toNegativeFraction && fraction < 0)) {\r\n let period = Angle.pi2Radians / Math.abs(radians1 - radians0);\r\n if (toNegativeFraction)\r\n period = -period;\r\n fraction += period;\r\n }\r\n return fraction;\r\n }\r\n /**\r\n * Return the fractionalized position of the given radian angle with respect to this sweep.\r\n * * The start angle returns fraction 0\r\n * * The end angle returns fraction 1\r\n * * Interior angles (and their multiples of 2PI) return fractions in [0,1].\r\n * * Exterior angles return fractions outside [0,1] according to `toNegativeFraction`.\r\n * @param radians input angle (in radians)\r\n * @param toNegativeFraction convert an exterior angle to a negative number (true), or to\r\n * a number greater than one (false, default). If false, this is just [[radiansToPositivePeriodicFraction]].\r\n * @param zeroSweepDefault return value when this sweep is empty (default 0).\r\n * @returns fraction, or `zeroSweepDefault` if this sweep is empty\r\n */\r\n public radiansToSignedFraction(radians: number, toNegativeFraction: boolean = false, zeroSweepDefault: number = 0.0): number {\r\n return AngleSweep.radiansToSignedFractionStartEnd(radians, this._radians0, this._radians1, toNegativeFraction, zeroSweepDefault);\r\n }\r\n /**\r\n * Return the fractionalized position of the given angle with respect to this sweep.\r\n * * The start angle returns fraction 0\r\n * * The end angle returns fraction 1\r\n * * Interior angles (and their multiples of 2PI) return fractions in [0,1].\r\n * * Exterior angles return fractions outside [0,1] according to `toNegativeFraction`.\r\n * @param theta input angle\r\n * @param toNegativeFraction convert an exterior angle to a negative number (true), or to\r\n * a number greater than one (false, default). If false, this is just [[angleToPositivePeriodicFraction]].\r\n * @param zeroSweepDefault return value when this sweep is empty (default 0).\r\n * @returns fraction, or `zeroSweepDefault` if this sweep is empty\r\n */\r\n public angleToSignedFraction(theta: Angle, toNegativeFraction: boolean = false, zeroSweepDefault: number = 0.0): number {\r\n return this.radiansToSignedFraction(theta.radians, toNegativeFraction, zeroSweepDefault);\r\n }\r\n\r\n /** Test if the given angle (as radians) is within sweep (between radians0 and radians1) */\r\n public static isRadiansInStartEnd(radians: number, radians0: number, radians1: number, allowPeriodShift: boolean = true): boolean {\r\n const delta0 = radians - radians0;\r\n const delta1 = radians - radians1;\r\n if (delta0 * delta1 <= 0.0)\r\n return true;\r\n if (radians0 === radians1)\r\n return allowPeriodShift ? Angle.isAlmostEqualRadiansAllowPeriodShift(radians, radians0) : Angle.isAlmostEqualRadiansNoPeriodShift(radians, radians0);\r\n return allowPeriodShift ? this.radiansToPositivePeriodicFractionStartEnd(radians, radians0, radians1, 1000.0) <= 1.0 : false;\r\n }\r\n /** Test if the given angle (as radians) is within sweep */\r\n public isRadiansInSweep(radians: number, allowPeriodShift: boolean = true): boolean {\r\n return AngleSweep.isRadiansInStartEnd(radians, this.startRadians, this.endRadians, allowPeriodShift);\r\n }\r\n /** Test if the given angle (as Angle) is within the sweep */\r\n public isAngleInSweep(angle: Angle): boolean {\r\n return this.isRadiansInSweep(angle.radians);\r\n }\r\n /**\r\n * Set this AngleSweep from various sources:\r\n * * if json is undefined, a full-circle sweep is returned.\r\n * * If json is an AngleSweep object, it is cloned\r\n * * If json is an array of 2 numbers, those numbers are start and end angles in degrees.\r\n * * If `json.degrees` is an array of 2 numbers, those numbers are start and end angles in degrees.\r\n * * If `json.radians` is an array of 2 numbers, those numbers are start and end angles in radians.\r\n * * Otherwise, a full-circle sweep is returned.\r\n */\r\n public setFromJSON(json?: any) {\r\n if (!json)\r\n this.setStartEndRadians(); // default full circle\r\n else if (json instanceof AngleSweep)\r\n this.setFrom(json);\r\n else if (Geometry.isNumberArray(json.degrees, 2))\r\n this.setStartEndDegrees(json.degrees[0], json.degrees[1]);\r\n else if (Geometry.isNumberArray(json.radians, 2))\r\n this.setStartEndRadians(json.radians[0], json.radians[1]);\r\n else if (Geometry.isNumberArray(json, 2))\r\n this.setStartEndDegrees(json[0], json[1]);\r\n else\r\n this.setStartEndRadians(); // default full circle\r\n }\r\n /** Create an AngleSweep from a json object. */\r\n public static fromJSON(json?: AngleSweepProps): AngleSweep {\r\n const result = AngleSweep.create360();\r\n result.setFromJSON(json);\r\n return result;\r\n }\r\n /**\r\n * Convert an AngleSweep to a JSON object.\r\n * @return {*} [startAngleInDegrees, endAngleInDegrees]\r\n */\r\n public toJSON(): any {\r\n return [this.startDegrees, this.endDegrees];\r\n }\r\n /**\r\n * Test if two angle sweeps match within the given tolerance.\r\n * * Period shifts are allowed, but orientations must be the same.\r\n * @param other sweep to compare to this instance\r\n * @param radianTol optional radian tolerance, default value `Geometry.smallAngleRadians`\r\n */\r\n public isAlmostEqualAllowPeriodShift(other: AngleSweep, radianTol: number = Geometry.smallAngleRadians): boolean {\r\n return this.isCCW === other.isCCW // this rules out equating opposite sweeps like [0,-100] and [0,260]\r\n && Angle.isAlmostEqualRadiansAllowPeriodShift(this._radians0, other._radians0, radianTol)\r\n && Angle.isAlmostEqualRadiansAllowPeriodShift(this.sweepRadians, other.sweepRadians, radianTol);\r\n }\r\n /**\r\n * Test if two angle sweeps match within the given tolerance.\r\n * * Period shifts are not allowed.\r\n * @param other sweep to compare to this instance\r\n * @param radianTol optional radian tolerance, default value `Geometry.smallAngleRadians`\r\n */\r\n public isAlmostEqualNoPeriodShift(other: AngleSweep, radianTol: number = Geometry.smallAngleRadians): boolean {\r\n return Angle.isAlmostEqualRadiansNoPeriodShift(this._radians0, other._radians0, radianTol)\r\n && Angle.isAlmostEqualRadiansNoPeriodShift(this.sweepRadians, other.sweepRadians, radianTol);\r\n }\r\n /**\r\n * Test if start and end angles match with radians tolerance.\r\n * * Period shifts are not allowed.\r\n * * This function is equivalent to isAlmostEqualNoPeriodShift. It is present for consistency with other classes.\r\n * However, it is recommended to use isAlmostEqualNoPeriodShift which has a clearer name.\r\n */\r\n public isAlmostEqual(other: AngleSweep): boolean {\r\n return this.isAlmostEqualNoPeriodShift(other);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"AngleSweep.js","sourceRoot":"","sources":["../../../src/geometry3d/AngleSweep.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,0CAAyE;AACzE,mCAAgC;AAGhC;;;;GAIG;AACH,IAAY,wBASX;AATD,WAAY,wBAAwB;IAClC,gEAAgE;IAChE,gFAAa,CAAA;IACb,iEAAiE;IACjE,+EAAY,CAAA;IACZ,iEAAiE;IACjE,+EAAY,CAAA;IACZ,qEAAqE;IACrE,2EAAU,CAAA;AACZ,CAAC,EATW,wBAAwB,wCAAxB,wBAAwB,QASnC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAa,UAAU;IACb,SAAS,CAAS;IAClB,SAAS,CAAS;IAC1B,iEAAiE;IACjE,IAAW,YAAY;QACrB,OAAO,aAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAChD,CAAC;IACD,+DAA+D;IAC/D,IAAW,UAAU;QACnB,OAAO,aAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAChD,CAAC;IACD,8DAA8D;IAC9D,IAAW,YAAY;QACrB,OAAO,aAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACnD,CAAC;IACD,iEAAiE;IACjE,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IACD,+DAA+D;IAC/D,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IACD,8DAA8D;IAC9D,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;IACzC,CAAC;IACD,sFAAsF;IACtF,IAAW,OAAO;QAChB,OAAO,aAAK,CAAC,iCAAiC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AAC;IAChB,CAAC;IACD;;;OAGG;IACI,MAAM;QACX,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IAC9C,CAAC;IACD;;;;;OAKG;IACI,6BAA6B,CAAC,KAAiB,EAAE,YAAoB,mBAAQ,CAAC,iBAAiB;QACpG,OAAO,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC,KAAK,CAAC,oEAAoE;eACjG,aAAK,CAAC,oCAAoC,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC;eACtF,aAAK,CAAC,oCAAoC,CAAC,IAAI,CAAC,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;IACpG,CAAC;IACD;;;;;OAKG;IACI,0BAA0B,CAAC,KAAiB,EAAE,YAAoB,mBAAQ,CAAC,iBAAiB;QACjG,OAAO,aAAK,CAAC,iCAAiC,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC;eACrF,aAAK,CAAC,iCAAiC,CAAC,IAAI,CAAC,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;IACjG,CAAC;IACD;;;;;OAKG;IACI,aAAa,CAAC,KAAiB;QACpC,OAAO,IAAI,CAAC,0BAA0B,CAAC,KAAK,CAAC,CAAC;IAChD,CAAC;CACF;AAplBD,gCAolBC","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 CartesianGeometry\r\n */\r\n\r\nimport { AngleSweepProps, BeJSONFunctions, Geometry } from \"../Geometry\";\r\nimport { Angle } from \"./Angle\";\r\nimport { GrowableFloat64Array } from \"./GrowableFloat64Array\";\r\n\r\n/**\r\n * Selector for how to convert an angle outside of a sweep to an exterior fraction.\r\n * @see [[AngleSweep.radiansToSignedPeriodicFractionStartEnd]], [[AngleSweep.angleToSignedPeriodicFraction]], [[AngleSweep.radiansToSignedPeriodicFraction]]\r\n * @public\r\n */\r\nexport enum ExteriorFractionSelector {\r\n /** Request [[Positive]] or [[Negative]] based on input sign. */\r\n SameSign = -1,\r\n /** Request positive exterior fraction within one period of 1. */\r\n Positive = 0,\r\n /** Request negative exterior fraction within one period of 0. */\r\n Negative = 1,\r\n /** Request the period-shifted exterior fraction closest to [0,1]. */\r\n Closer = 2,\r\n}\r\n\r\n/**\r\n * An `AngleSweep` is a pair of angles at start and end of an interval.\r\n *\r\n * * For stroking purposes, the \"included interval\" is all angles numerically reached\r\n * by `theta = start + f * (end - start)`, where `0 <= f <= 1`.\r\n * * This stroking formula is simple numbers -- 2PI shifts are not involved.\r\n * * 2PI shifts do become important in the reverse mapping of an angle to a fraction.\r\n * * Angles greater than 360 and less than 0 are fine as endpoints.\r\n * * An AngleSweep determines orientation only _in concert with a reference vector_, e.g., a plane normal like (0,0,1).\r\n * * Be careful reading orientation from an AngleSweep without a reference vector!\r\n * * If \"start < end\" the angles in the sweep proceed counterclockwise around the reference vector.\r\n * * If \"start > end\" the angles in the sweep proceed clockwise around the reference vector.\r\n * * (350,370) covers the same angles as (-10,10), and both sweeps are counterclockwise around the reference vector.\r\n * * (370,350) covers the same angles as (10,-10), and both sweeps are clockwise around the reference vector.\r\n * * (370,350) covers the same angles as (-10,10), but the sweeps have opposite orientation.\r\n * * Math details can be found at docs/learning/geometry/Angle.md .\r\n * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/AngleSweep .\r\n * @public\r\n */\r\nexport class AngleSweep implements BeJSONFunctions {\r\n private _radians0: number;\r\n private _radians1: number;\r\n /** Read-property for degrees at the start of this AngleSweep. */\r\n public get startDegrees() {\r\n return Angle.radiansToDegrees(this._radians0);\r\n }\r\n /** Read-property for degrees at the end of this AngleSweep. */\r\n public get endDegrees() {\r\n return Angle.radiansToDegrees(this._radians1);\r\n }\r\n /** Read-property for signed start-to-end sweep in degrees. */\r\n public get sweepDegrees() {\r\n return Angle.radiansToDegrees(this.sweepRadians);\r\n }\r\n /** Read-property for degrees at the start of this AngleSweep. */\r\n public get startRadians() {\r\n return this._radians0;\r\n }\r\n /** Read-property for degrees at the end of this AngleSweep. */\r\n public get endRadians() {\r\n return this._radians1;\r\n }\r\n /** Read-property for signed start-to-end sweep in radians. */\r\n public get sweepRadians() {\r\n return this._radians1 - this._radians0;\r\n }\r\n /** Whether the sweep angles are within smallAngle tolerance, without period shift. */\r\n public get isEmpty() {\r\n return Angle.isAlmostEqualRadiansNoPeriodShift(0, this.sweepRadians);\r\n }\r\n /** Return the (strongly typed) start angle */\r\n public get startAngle() {\r\n return Angle.createRadians(this._radians0);\r\n }\r\n /** Return the (strongly typed) end angle */\r\n public get endAngle() {\r\n return Angle.createRadians(this._radians1);\r\n }\r\n /**\r\n * Create a sweep as one of\r\n * * A clone of a given sweep\r\n * * 0 to given angle\r\n * * full circle if no arg given (sweep 0 to 360 degrees)\r\n */\r\n public static create(data?: AngleSweep | Angle): AngleSweep {\r\n if (data instanceof AngleSweep)\r\n return data.clone();\r\n if (data instanceof Angle)\r\n return new AngleSweep(0, data.radians);\r\n return AngleSweep.create360();\r\n }\r\n /**\r\n * (private) constructor with start and end angles in radians.\r\n * * Use explicitly named static methods to clarify intent and units of inputs:\r\n *\r\n * * createStartEndRadians (startRadians:number, endRadians:number)\r\n * * createStartEndDegrees (startDegrees:number, endDegrees:number)\r\n * * createStartEnd (startAngle:Angle, endAngle:Angle)\r\n * * createStartSweepRadians (startRadians:number, sweepRadians:number)\r\n * * createStartSweepDegrees (startDegrees:number, sweepDegrees:number)\r\n * * createStartSweep (startAngle:Angle, sweepAngle:Angle)\r\n */\r\n private constructor(startRadians: number = 0, endRadians: number = 0) {\r\n this._radians0 = startRadians;\r\n this._radians1 = endRadians;\r\n }\r\n /**\r\n * Directly set the start and end angles in radians\r\n * * If the difference between startRadians and endRadians is greater than 360, the function limits the angle sweep to 360.\r\n */\r\n public setStartEndRadians(startRadians: number = 0, endRadians: number = 2.0 * Math.PI) {\r\n const delta = endRadians - startRadians;\r\n if (Angle.isFullCircleRadians(delta)) {\r\n endRadians = startRadians + (delta > 0 ? 2.0 : -2.0) * Math.PI;\r\n }\r\n this._radians0 = startRadians;\r\n this._radians1 = endRadians;\r\n }\r\n /** Directly set the start and end angles in degrees */\r\n public setStartEndDegrees(startDegrees: number = 0, endDegrees: number = 360.0) {\r\n this.setStartEndRadians(Angle.degreesToRadians(startDegrees), Angle.degreesToRadians(endDegrees));\r\n }\r\n /**\r\n * Create an AngleSweep from start and end angles given in radians.\r\n * * If the difference between startRadians and endRadians is greater than 360, the function limits the angle sweep to 360.\r\n */\r\n public static createStartEndRadians(startRadians: number = 0, endRadians: number = 2.0 * Math.PI, result?: AngleSweep): AngleSweep {\r\n result = result ? result : new AngleSweep();\r\n result.setStartEndRadians(startRadians, endRadians);\r\n return result;\r\n }\r\n /** Return the AngleSweep obtained by adding `radians` to the start and end angles of this sweep. */\r\n public clonePlusRadians(radians: number): AngleSweep {\r\n return new AngleSweep(this._radians0 + radians, this._radians1 + radians);\r\n }\r\n /** Return the AngleSweep obtained by subtracting `radians` from the start and end angles of this sweep. */\r\n public cloneMinusRadians(radians: number): AngleSweep {\r\n return this.clonePlusRadians(-radians);\r\n }\r\n /** Create an AngleSweep from start and end angles given in degrees. */\r\n public static createStartEndDegrees(startDegrees: number = 0, endDegrees: number = 360, result?: AngleSweep): AngleSweep {\r\n return AngleSweep.createStartEndRadians(Angle.degreesToRadians(startDegrees), Angle.degreesToRadians(endDegrees), result);\r\n }\r\n /** Create an angle sweep from strongly typed start and end angles */\r\n public static createStartEnd(startAngle: Angle, endAngle: Angle, result?: AngleSweep): AngleSweep {\r\n result = result ? result : new AngleSweep();\r\n result.setStartEndRadians(startAngle.radians, endAngle.radians);\r\n return result;\r\n }\r\n /** Create an AngleSweep from start and end angles given in radians. */\r\n public static createStartSweepRadians(startRadians: number = 0, sweepRadians: number = Math.PI, result?: AngleSweep): AngleSweep {\r\n result = result ? result : new AngleSweep();\r\n result.setStartEndRadians(startRadians, startRadians + sweepRadians);\r\n return result;\r\n }\r\n /** Create an AngleSweep from start and sweep given in degrees. */\r\n public static createStartSweepDegrees(startDegrees: number = 0, sweepDegrees: number = 360, result?: AngleSweep): AngleSweep {\r\n return AngleSweep.createStartEndRadians(Angle.degreesToRadians(startDegrees), Angle.degreesToRadians(startDegrees + sweepDegrees), result);\r\n }\r\n /** Create an angle sweep with limits given as (strongly typed) angles for start and sweep */\r\n public static createStartSweep(startAngle: Angle, sweepAngle: Angle, result?: AngleSweep): AngleSweep {\r\n return AngleSweep.createStartSweepRadians(startAngle.radians, sweepAngle.radians, result);\r\n }\r\n /** Return a sweep with limits interpolated between this and other. */\r\n public interpolate(fraction: number, other: AngleSweep): AngleSweep {\r\n return new AngleSweep(\r\n Geometry.interpolate(this._radians0, fraction, other._radians0),\r\n Geometry.interpolate(this._radians1, fraction, other._radians1),\r\n );\r\n }\r\n /** Copy from other AngleSweep. */\r\n public setFrom(other: AngleSweep) {\r\n this._radians0 = other._radians0;\r\n this._radians1 = other._radians1;\r\n }\r\n /**\r\n * Create a full circle sweep (CCW).\r\n * @param startRadians start angle in radians. Defaults to 0.\r\n * @param result optional preallocated object to populate and return.\r\n */\r\n public static create360(startRadians?: number, result?: AngleSweep): AngleSweep {\r\n startRadians = startRadians ? startRadians : 0.0;\r\n const endRadians = startRadians + 2.0 * Math.PI;\r\n if (result) {\r\n result.setStartEndRadians(startRadians, endRadians);\r\n return result;\r\n }\r\n return new AngleSweep(startRadians, endRadians);\r\n }\r\n /** Create a sweep from the south pole to the north pole (-90 to +90). */\r\n public static createFullLatitude() {\r\n return AngleSweep.createStartEndRadians(-0.5 * Math.PI, 0.5 * Math.PI);\r\n }\r\n /** Reverse the start and end angle in place. */\r\n public reverseInPlace() {\r\n const tmp = this._radians0;\r\n this._radians0 = this._radians1;\r\n this._radians1 = tmp;\r\n }\r\n /**\r\n * Return a sweep for the \"other\" part of the circle.\r\n * @param reverseDirection true to move backwards (CW) from start to end, false to more forwards (CCW) from start to end.\r\n */\r\n public cloneComplement(reverseDirection: boolean = false, result?: AngleSweep): AngleSweep {\r\n const s = this.sweepRadians >= 0 ? 2.0 : -2.0;\r\n if (reverseDirection)\r\n return AngleSweep.createStartEndRadians(this.startRadians, this.endRadians - s * Math.PI, result);\r\n else\r\n return AngleSweep.createStartEndRadians(this.endRadians, this.startRadians + s * Math.PI, result);\r\n }\r\n /** Restrict start and end angles to the degree range [-90,+90]. */\r\n public capLatitudeInPlace(): void {\r\n const limit = 0.5 * Math.PI;\r\n this._radians0 = Geometry.clampToStartEnd(this._radians0, -limit, limit);\r\n this._radians1 = Geometry.clampToStartEnd(this._radians1, -limit, limit);\r\n }\r\n /**\r\n * Restrict [[sweepDegrees]] to the range [-360, 360].\r\n * The start angle and sign of the sweep angle are unchanged.\r\n */\r\n public clampToFullCircle(result?: AngleSweep): AngleSweep {\r\n result = result ?? new AngleSweep();\r\n const sweepRadians = Geometry.clampToStartEnd(this.sweepRadians, -Angle.pi2Radians, Angle.pi2Radians);\r\n result.setStartEndRadians(this._radians0, this._radians0 + sweepRadians);\r\n return result;\r\n }\r\n /** Ask if the sweep is counterclockwise, i.e. positive sweep. */\r\n public get isCCW(): boolean {\r\n return this._radians1 >= this._radians0;\r\n }\r\n /** Ask if the sweep is a full circle. */\r\n public get isFullCircle(): boolean {\r\n return Angle.isFullCircleRadians(this.sweepRadians);\r\n }\r\n /** Ask if the sweep is a full sweep from south pole to north pole. */\r\n public get isFullLatitudeSweep(): boolean {\r\n const a = Math.PI * 0.5;\r\n return Angle.isAlmostEqualRadiansNoPeriodShift(this._radians0, -a)\r\n && Angle.isAlmostEqualRadiansNoPeriodShift(this._radians1, a);\r\n }\r\n /** Return a clone of this sweep. */\r\n public clone(): AngleSweep {\r\n return new AngleSweep(this._radians0, this._radians1);\r\n }\r\n /** Convert fractional position in the sweep to radians. */\r\n public fractionToRadians(fraction: number): number {\r\n return fraction < 0.5 ?\r\n this._radians0 + fraction * this.sweepRadians :\r\n this._radians1 + (fraction - 1.0) * this.sweepRadians;\r\n }\r\n /** Convert fractional position in the sweep to strongly typed Angle object. */\r\n public fractionToAngle(fraction: number) {\r\n return Angle.createRadians(this.fractionToRadians(fraction));\r\n }\r\n /**\r\n * Return 2PI divided by the sweep radians.\r\n * * This is the number of fractional intervals required to cover a whole circle.\r\n * @returns period of the sweep, or 1 if sweep is empty.\r\n */\r\n public fractionPeriod(): number {\r\n return this.isEmpty ? 1.0 : Angle.pi2Radians / Math.abs(this.sweepRadians);\r\n }\r\n /**\r\n * Return the fractionalized position of the given angle (as Angle) computed without consideration of\r\n * 2PI period and without consideration of angle sweep direction (CW or CCW).\r\n * * the start angle is at fraction 0\r\n * * the end angle is at fraction 1\r\n * * interior angles are between 0 and 1\r\n * * negative fraction for angles \"before\" the start angle if start < end\r\n * * fraction larger than one for angles \"after\" the end angle if start < end\r\n * * fraction larger than one for angles \"before\" the start angle if start > end\r\n * * negative fraction for angles \"after\" the end angle if start > end\r\n * * does not allow period shift\r\n * @returns unbounded fraction, or 1 if sweep is empty.\r\n */\r\n public angleToUnboundedFraction(theta: Angle): number {\r\n return this.isEmpty ? 1.0 : (theta.radians - this._radians0) / this.sweepRadians;\r\n }\r\n\r\n /**\r\n * Convert a sweep fraction to the equivalent period-shifted fraction inside the sweep, or within one period of zero\r\n * on the desired side.\r\n * @param fraction fraction of the sweep.\r\n * @param radians0 start angle of sweep (in radians).\r\n * @param radians1 end angle of sweep (in radians).\r\n * @param toNegativeFraction exterior fraction handling:\r\n * * if true, return `fraction` period-shifted to within one period of the start\r\n * * if false, return `fraction` period-shifted to within one period of the end\r\n * * if undefined, return the period-shift of `fraction` closest in fraction space to [0,1].\r\n * @returns period-shifted fraction. If `fraction` is already in [0,1], or the sweep is empty, then `fraction` is\r\n * returned unchanged.\r\n */\r\n public static fractionToSignedPeriodicFractionStartEnd(fraction: number, radians0: number, radians1: number, toNegativeFraction?: boolean): number {\r\n const sweep = radians1 - radians0;\r\n if (Angle.isAlmostEqualRadiansNoPeriodShift(0, sweep))\r\n return fraction; // empty sweep\r\n if (Geometry.isIn01(fraction))\r\n return fraction;\r\n const period = Angle.pi2Radians / Math.abs(sweep);\r\n fraction = fraction % period; // period-shifted equivalent fraction closest to 0 with same sign as fraction\r\n if (fraction + period < 1)\r\n fraction += period; // it's really an interior fraction\r\n if (Geometry.isIn01(fraction))\r\n return fraction;\r\n if (toNegativeFraction === true)\r\n return fraction < 0 ? fraction : fraction - period;\r\n if (toNegativeFraction === false)\r\n return fraction > 1 ? fraction : fraction + period;\r\n const fractionDistFrom01 = fraction < 0 ? -fraction : fraction - 1;\r\n const fraction2 = fraction < 0 ? fraction + period : fraction - period; // period-shift with opposite sign\r\n const fraction2DistFrom01 = fraction2 < 0 ? -fraction2 : fraction2 - 1;\r\n return fractionDistFrom01 < fraction2DistFrom01 ? fraction : fraction2; // choose the period-shift closer to [0,1]\r\n }\r\n /**\r\n * Convert a sweep fraction to the equivalent period-shifted fraction inside this sweep, or within one period of\r\n * zero on the desired side.\r\n * @param fraction fraction of the sweep.\r\n * @param toNegativeFraction exterior fraction handling:\r\n * * if true, return `fraction` period-shifted to within one period of the start\r\n * * if false, return `fraction` period-shifted to within one period of the end\r\n * * if undefined, return the period-shift of `fraction` closest in fraction space to [0,1].\r\n * @returns period-shifted fraction. If `fraction` is already in [0,1], or the sweep is empty, then `fraction` is\r\n * returned unchanged.\r\n */\r\n public fractionToSignedPeriodicFraction(fraction: number, toNegativeFraction?: boolean): number {\r\n return AngleSweep.fractionToSignedPeriodicFractionStartEnd(fraction, this._radians0, this._radians1, toNegativeFraction);\r\n }\r\n\r\n /**\r\n * Return the fractionalized position of the given angle (as radians), computed with consideration of 2PI period.\r\n * * consider radians0 as `start` angle of the sweep and radians1 as `end` angle of the sweep\r\n * * the start angle is at fraction 0\r\n * * the end angle is at fraction 1\r\n * * interior angles are between 0 and 1\r\n * * all exterior angles are at fractions greater than 1\r\n * * allows period shift\r\n * @param radians input angle (in radians)\r\n * @param radians0 start angle of sweep (in radians)\r\n * @param radians1 end angle of sweep (in radians)\r\n * @param zeroSweepDefault return value when the sweep is empty (default 0)\r\n * @returns nonnegative fraction, or `zeroSweepDefault` if the sweep is empty.\r\n */\r\n public static radiansToPositivePeriodicFractionStartEnd(radians: number, radians0: number, radians1: number, zeroSweepDefault: number = 0.0): number {\r\n const zeroSweepMarker = Geometry.largeCoordinateResult;\r\n let fraction = this.radiansToSignedPeriodicFractionStartEnd(radians, radians0, radians1, zeroSweepMarker);\r\n if (fraction === zeroSweepMarker)\r\n return zeroSweepDefault;\r\n if (fraction < 0) {\r\n const period = Angle.pi2Radians / Math.abs(radians1 - radians0);\r\n fraction += period;\r\n }\r\n return fraction;\r\n }\r\n /**\r\n * Return the fractionalized position of the given angle (as radians), computed with consideration of 2PI period.\r\n * * the start angle is at fraction 0\r\n * * the end angle is at fraction 1\r\n * * interior angles are between 0 and 1\r\n * * all exterior angles are at fractions greater than 1\r\n * * allows period shift\r\n * @param radians input angle (in radians)\r\n * @param zeroSweepDefault return value when this sweep is empty (default 0)\r\n * @returns nonnegative fraction, or `zeroSweepDefault` if the sweep is empty.\r\n */\r\n public radiansToPositivePeriodicFraction(radians: number, zeroSweepDefault: number = 0.0): number {\r\n return AngleSweep.radiansToPositivePeriodicFractionStartEnd(radians, this._radians0, this._radians1, zeroSweepDefault);\r\n }\r\n /**\r\n * Return the fractionalized position of the given angle (as Angle), computed with consideration of 2PI period.\r\n * * the start angle is at fraction 0\r\n * * the end angle is at fraction 1\r\n * * interior angles are between 0 and 1\r\n * * all exterior angles are at fractions greater than 1\r\n * * allows period shift\r\n * @param theta input angle\r\n * @param zeroSweepDefault return value when this sweep is empty (default 0)\r\n * @returns nonnegative fraction, or `zeroSweepDefault` if the sweep is empty.\r\n */\r\n public angleToPositivePeriodicFraction(theta: Angle, zeroSweepDefault: number = 0.0): number {\r\n return this.radiansToPositivePeriodicFraction(theta.radians, zeroSweepDefault);\r\n }\r\n /**\r\n * Return the fractionalized position of the given array of angles (as radian), computed with consideration of 2PI period.\r\n * * fraction is always positive\r\n * * the start angle is at fraction 0\r\n * * the end angle is at fraction 1\r\n * * interior angles are between 0 and 1\r\n * * all exterior angles are at fractions greater than 1\r\n * * allows period shift\r\n */\r\n public radiansArrayToPositivePeriodicFractions(data: GrowableFloat64Array) {\r\n const n = data.length;\r\n for (let i = 0; i < n; i++) {\r\n data.reassign(i, this.radiansToPositivePeriodicFraction(data.atUncheckedIndex(i)));\r\n }\r\n }\r\n /**\r\n * Return the fractionalized position of the given angle (as radians) computed with consideration of\r\n * 2PI period and with consideration of angle sweep direction (CW or CCW).\r\n * * the start angle is at fraction 0\r\n * * the end angle is at fraction 1\r\n * * interior angles are between 0 and 1\r\n * * negative fraction for angles \"before\" the start angle\r\n * * fraction larger than one for angles \"after\" the end angle\r\n * * allows period shift\r\n * @param radians input angle (in radians)\r\n * @param radians0 start angle of sweep (in radians)\r\n * @param radians1 end angle of sweep (in radians)\r\n * @param zeroSweepDefault return value when the sweep is empty (default 0)\r\n * @param selector how to handle an angle outside of the sweep. Default value is\r\n * [[ExteriorFractionSelector.SameSign]], to request a fraction with the same sign\r\n * as the unbounded fraction `(radians - radians0) / (radians1 - radians0)`.\r\n * @returns fraction, or `zeroSweepDefault` if the sweep is empty.\r\n */\r\n public static radiansToSignedPeriodicFractionStartEnd(\r\n radians: number,\r\n radians0: number,\r\n radians1: number,\r\n zeroSweepDefault: number = 0.0,\r\n selector: ExteriorFractionSelector = ExteriorFractionSelector.SameSign\r\n ): number {\r\n const sweep = radians1 - radians0;\r\n if (Angle.isAlmostEqualRadiansNoPeriodShift(0, sweep))\r\n return zeroSweepDefault;\r\n if (Angle.isAlmostEqualRadiansAllowPeriodShift(radians0, radians1)) {\r\n // for sweep = 2nPi !== 0, allow matching without period shift, else we never return 1.0\r\n if (Angle.isAlmostEqualRadiansNoPeriodShift(radians, radians0))\r\n return 0.0;\r\n if (Angle.isAlmostEqualRadiansNoPeriodShift(radians, radians1))\r\n return 1.0;\r\n } else {\r\n if (Angle.isAlmostEqualRadiansAllowPeriodShift(radians, radians0))\r\n return 0.0;\r\n if (Angle.isAlmostEqualRadiansAllowPeriodShift(radians, radians1))\r\n return 1.0;\r\n }\r\n const fraction = (radians - radians0) / sweep;\r\n let toNegativeFraction: boolean | undefined;\r\n if (selector === ExteriorFractionSelector.Negative)\r\n toNegativeFraction = true;\r\n else if (selector === ExteriorFractionSelector.Positive)\r\n toNegativeFraction = false;\r\n else if (selector === ExteriorFractionSelector.SameSign)\r\n toNegativeFraction = fraction < 0;\r\n return this.fractionToSignedPeriodicFractionStartEnd(fraction, radians0, radians1, toNegativeFraction);\r\n }\r\n /**\r\n * Return the fractionalized position of the given angle (as radians) computed with consideration of\r\n * 2PI period and with consideration of angle sweep direction (CW or CCW).\r\n * * the start angle is at fraction 0\r\n * * the end angle is at fraction 1\r\n * * interior angles are between 0 and 1\r\n * * negative fraction for angles \"before\" the start angle\r\n * * fraction larger than one for angles \"after\" the end angle\r\n * * allows period shift\r\n * @param radians input angle (in radians)\r\n * @param zeroSweepDefault return value when this sweep is empty (default 0)\r\n * @param selector how to handle an angle outside of the sweep. Default value is\r\n * [[ExteriorFractionSelector.SameSign]], to request a fraction with the same sign\r\n * as the unbounded fraction `(radians - startRadians) / sweepRadians`.\r\n * @returns fraction, or `zeroSweepDefault` if this sweep is empty.\r\n */\r\n public radiansToSignedPeriodicFraction(\r\n radians: number,\r\n zeroSweepDefault: number = 0.0,\r\n selector: ExteriorFractionSelector = ExteriorFractionSelector.SameSign\r\n ): number {\r\n return AngleSweep.radiansToSignedPeriodicFractionStartEnd(radians, this._radians0, this._radians1, zeroSweepDefault, selector);\r\n }\r\n /**\r\n * Return the fractionalized position of the given angle (as Angle) computed with consideration of\r\n * 2PI period and with consideration of angle sweep direction (CW or CCW).\r\n * * the start angle is at fraction 0\r\n * * the end angle is at fraction 1\r\n * * interior angles are between 0 and 1\r\n * * negative fraction for angles \"before\" the start angle\r\n * * fraction larger than one for angles \"after\" the end angle\r\n * * allows period shift\r\n * @param theta input angle\r\n * @param zeroSweepDefault return value when this sweep is empty (default 0)\r\n * @param selector how to handle an angle outside of the sweep. Default value is\r\n * [[ExteriorFractionSelector.SameSign]], to request a fraction with the same sign\r\n * as the fraction returned by `angleToUnboundedFraction(theta)`.\r\n * @returns fraction, or `zeroSweepDefault` if this sweep is empty.\r\n */\r\n public angleToSignedPeriodicFraction(\r\n theta: Angle,\r\n zeroSweepDefault: number = 0.0,\r\n selector: ExteriorFractionSelector = ExteriorFractionSelector.SameSign\r\n ): number {\r\n return this.radiansToSignedPeriodicFraction(theta.radians, zeroSweepDefault, selector);\r\n }\r\n\r\n /**\r\n * Return the fractionalized position of the given radian angle with respect to the sweep.\r\n * * The start angle returns fraction 0\r\n * * The end angle returns fraction 1\r\n * * Interior angles (and their multiples of 2PI) return fractions in [0,1].\r\n * * Exterior angles return fractions outside [0,1] according to `toNegativeFraction`.\r\n * @param radians input angle (in radians)\r\n * @param radians0 start angle of sweep (in radians)\r\n * @param radians1 end angle of sweep (in radians)\r\n * @param toNegativeFraction convert an exterior angle to a negative number (true), or to\r\n * a number greater than one (false, default). If false, this is just [[radiansToPositivePeriodicFractionStartEnd]].\r\n * @param zeroSweepDefault return value when the sweep is empty (default 0).\r\n * @returns fraction, or `zeroSweepDefault` if the sweep is empty\r\n */\r\n public static radiansToSignedFractionStartEnd(radians: number, radians0: number, radians1: number, toNegativeFraction: boolean = false, zeroSweepDefault: number = 0.0): number {\r\n const zeroSweepMarker = Geometry.largeCoordinateResult;\r\n let fraction = this.radiansToSignedPeriodicFractionStartEnd(radians, radians0, radians1, zeroSweepMarker);\r\n if (fraction === zeroSweepMarker)\r\n return zeroSweepDefault;\r\n if ((toNegativeFraction && fraction > 1) || (!toNegativeFraction && fraction < 0)) {\r\n let period = Angle.pi2Radians / Math.abs(radians1 - radians0);\r\n if (toNegativeFraction)\r\n period = -period;\r\n fraction += period;\r\n }\r\n return fraction;\r\n }\r\n /**\r\n * Return the fractionalized position of the given radian angle with respect to this sweep.\r\n * * The start angle returns fraction 0\r\n * * The end angle returns fraction 1\r\n * * Interior angles (and their multiples of 2PI) return fractions in [0,1].\r\n * * Exterior angles return fractions outside [0,1] according to `toNegativeFraction`.\r\n * @param radians input angle (in radians)\r\n * @param toNegativeFraction convert an exterior angle to a negative number (true), or to\r\n * a number greater than one (false, default). If false, this is just [[radiansToPositivePeriodicFraction]].\r\n * @param zeroSweepDefault return value when this sweep is empty (default 0).\r\n * @returns fraction, or `zeroSweepDefault` if this sweep is empty\r\n */\r\n public radiansToSignedFraction(radians: number, toNegativeFraction: boolean = false, zeroSweepDefault: number = 0.0): number {\r\n return AngleSweep.radiansToSignedFractionStartEnd(radians, this._radians0, this._radians1, toNegativeFraction, zeroSweepDefault);\r\n }\r\n /**\r\n * Return the fractionalized position of the given angle with respect to this sweep.\r\n * * The start angle returns fraction 0\r\n * * The end angle returns fraction 1\r\n * * Interior angles (and their multiples of 2PI) return fractions in [0,1].\r\n * * Exterior angles return fractions outside [0,1] according to `toNegativeFraction`.\r\n * @param theta input angle\r\n * @param toNegativeFraction convert an exterior angle to a negative number (true), or to\r\n * a number greater than one (false, default). If false, this is just [[angleToPositivePeriodicFraction]].\r\n * @param zeroSweepDefault return value when this sweep is empty (default 0).\r\n * @returns fraction, or `zeroSweepDefault` if this sweep is empty\r\n */\r\n public angleToSignedFraction(theta: Angle, toNegativeFraction: boolean = false, zeroSweepDefault: number = 0.0): number {\r\n return this.radiansToSignedFraction(theta.radians, toNegativeFraction, zeroSweepDefault);\r\n }\r\n\r\n /** Test if the given angle (as radians) is within sweep (between radians0 and radians1) */\r\n public static isRadiansInStartEnd(radians: number, radians0: number, radians1: number, allowPeriodShift: boolean = true): boolean {\r\n const delta0 = radians - radians0;\r\n const delta1 = radians - radians1;\r\n if (delta0 * delta1 <= 0.0)\r\n return true;\r\n if (radians0 === radians1)\r\n return allowPeriodShift ? Angle.isAlmostEqualRadiansAllowPeriodShift(radians, radians0) : Angle.isAlmostEqualRadiansNoPeriodShift(radians, radians0);\r\n return allowPeriodShift ? this.radiansToPositivePeriodicFractionStartEnd(radians, radians0, radians1, 1000.0) <= 1.0 : false;\r\n }\r\n /** Test if the given angle (as radians) is within sweep */\r\n public isRadiansInSweep(radians: number, allowPeriodShift: boolean = true): boolean {\r\n return AngleSweep.isRadiansInStartEnd(radians, this.startRadians, this.endRadians, allowPeriodShift);\r\n }\r\n /** Test if the given angle (as Angle) is within the sweep */\r\n public isAngleInSweep(angle: Angle): boolean {\r\n return this.isRadiansInSweep(angle.radians);\r\n }\r\n /**\r\n * Set this AngleSweep from various sources:\r\n * * if json is undefined, a full-circle sweep is returned.\r\n * * If json is an AngleSweep object, it is cloned\r\n * * If json is an array of 2 numbers, those numbers are start and end angles in degrees.\r\n * * If `json.degrees` is an array of 2 numbers, those numbers are start and end angles in degrees.\r\n * * If `json.radians` is an array of 2 numbers, those numbers are start and end angles in radians.\r\n * * Otherwise, a full-circle sweep is returned.\r\n */\r\n public setFromJSON(json?: any) {\r\n if (!json)\r\n this.setStartEndRadians(); // default full circle\r\n else if (json instanceof AngleSweep)\r\n this.setFrom(json);\r\n else if (Geometry.isNumberArray(json.degrees, 2))\r\n this.setStartEndDegrees(json.degrees[0], json.degrees[1]);\r\n else if (Geometry.isNumberArray(json.radians, 2))\r\n this.setStartEndRadians(json.radians[0], json.radians[1]);\r\n else if (Geometry.isNumberArray(json, 2))\r\n this.setStartEndDegrees(json[0], json[1]);\r\n else\r\n this.setStartEndRadians(); // default full circle\r\n }\r\n /** Create an AngleSweep from a json object. */\r\n public static fromJSON(json?: AngleSweepProps): AngleSweep {\r\n const result = AngleSweep.create360();\r\n result.setFromJSON(json);\r\n return result;\r\n }\r\n /**\r\n * Convert an AngleSweep to a JSON object.\r\n * @return {*} [startAngleInDegrees, endAngleInDegrees]\r\n */\r\n public toJSON(): any {\r\n return [this.startDegrees, this.endDegrees];\r\n }\r\n /**\r\n * Test if two angle sweeps match within the given tolerance.\r\n * * Period shifts are allowed, but orientations must be the same.\r\n * @param other sweep to compare to this instance\r\n * @param radianTol optional radian tolerance, default value `Geometry.smallAngleRadians`\r\n */\r\n public isAlmostEqualAllowPeriodShift(other: AngleSweep, radianTol: number = Geometry.smallAngleRadians): boolean {\r\n return this.isCCW === other.isCCW // this rules out equating opposite sweeps like [0,-100] and [0,260]\r\n && Angle.isAlmostEqualRadiansAllowPeriodShift(this._radians0, other._radians0, radianTol)\r\n && Angle.isAlmostEqualRadiansAllowPeriodShift(this.sweepRadians, other.sweepRadians, radianTol);\r\n }\r\n /**\r\n * Test if two angle sweeps match within the given tolerance.\r\n * * Period shifts are not allowed.\r\n * @param other sweep to compare to this instance\r\n * @param radianTol optional radian tolerance, default value `Geometry.smallAngleRadians`\r\n */\r\n public isAlmostEqualNoPeriodShift(other: AngleSweep, radianTol: number = Geometry.smallAngleRadians): boolean {\r\n return Angle.isAlmostEqualRadiansNoPeriodShift(this._radians0, other._radians0, radianTol)\r\n && Angle.isAlmostEqualRadiansNoPeriodShift(this.sweepRadians, other.sweepRadians, radianTol);\r\n }\r\n /**\r\n * Test if start and end angles match with radians tolerance.\r\n * * Period shifts are not allowed.\r\n * * This function is equivalent to isAlmostEqualNoPeriodShift. It is present for consistency with other classes.\r\n * However, it is recommended to use isAlmostEqualNoPeriodShift which has a clearer name.\r\n */\r\n public isAlmostEqual(other: AngleSweep): boolean {\r\n return this.isAlmostEqualNoPeriodShift(other);\r\n }\r\n}\r\n"]}
|
|
@@ -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"}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* @module Curve
|
|
7
7
|
*/
|
|
8
8
|
import { Geometry } from "../Geometry";
|
|
9
|
+
import { ExteriorFractionSelector } from "../geometry3d/AngleSweep";
|
|
9
10
|
/**
|
|
10
11
|
* Enumeration of condition for extending a curve beyond start or end point.
|
|
11
12
|
* * Not all CurvePrimitives support these modes.
|
|
@@ -73,27 +74,21 @@ export class CurveExtendOptions {
|
|
|
73
74
|
* the sweep extended per `extendParam`.
|
|
74
75
|
*/
|
|
75
76
|
static resolveRadiansToValidSweepFraction(extendParam, radians, sweep) {
|
|
76
|
-
|
|
77
|
-
let fraction = sweep.radiansToSignedPeriodicFraction(radians);
|
|
77
|
+
let fraction = sweep.radiansToSignedPeriodicFraction(radians, 0, ExteriorFractionSelector.Closer);
|
|
78
78
|
let isValid = true;
|
|
79
|
-
if (!
|
|
80
|
-
const fractionPeriod = sweep.fractionPeriod();
|
|
79
|
+
if (!Geometry.isIn01(fraction)) {
|
|
81
80
|
const mode0 = CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extendParam, 0);
|
|
82
81
|
const mode1 = CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extendParam, 1);
|
|
83
|
-
if (mode0
|
|
84
|
-
if (mode1 === CurveExtendMode.None) { // only extend to negative
|
|
85
|
-
if (fraction > 1.0)
|
|
86
|
-
fraction -= fractionPeriod;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
else if (mode1 !== CurveExtendMode.None) { // only extend to positive
|
|
90
|
-
if (fraction < 0.0)
|
|
91
|
-
fraction += fractionPeriod;
|
|
92
|
-
}
|
|
93
|
-
else { // no extension allowed
|
|
82
|
+
if (mode0 === CurveExtendMode.None && mode1 === CurveExtendMode.None) {
|
|
94
83
|
fraction = Geometry.clamp(fraction, 0, 1);
|
|
95
84
|
isValid = false;
|
|
96
85
|
}
|
|
86
|
+
else if (mode1 === CurveExtendMode.None && mode0 !== CurveExtendMode.None) {
|
|
87
|
+
fraction = sweep.radiansToSignedPeriodicFraction(radians, 0, ExteriorFractionSelector.Negative);
|
|
88
|
+
}
|
|
89
|
+
else if (mode0 === CurveExtendMode.None && mode1 !== CurveExtendMode.None) {
|
|
90
|
+
fraction = sweep.radiansToSignedPeriodicFraction(radians, 0, ExteriorFractionSelector.Positive);
|
|
91
|
+
}
|
|
97
92
|
}
|
|
98
93
|
return { fraction, isValid };
|
|
99
94
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurveExtendMode.js","sourceRoot":"","sources":["../../../src/curve/CurveExtendMode.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"CurveExtendMode.js","sourceRoot":"","sources":["../../../src/curve/CurveExtendMode.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAc,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAEhF;;;;GAIG;AACH,MAAM,CAAN,IAAY,eAOX;AAPD,WAAY,eAAe;IACzB,4BAA4B;IAC5B,qDAAQ,CAAA;IACR,qEAAqE;IACrE,+DAAa,CAAA;IACb,8CAA8C;IAC9C,2DAAW,CAAA;AACb,CAAC,EAPW,eAAe,KAAf,eAAe,QAO1B;AACD;;;GAGG;AACH,MAAM,OAAO,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;IACD;;;;;OAKG;IACI,MAAM,CAAC,eAAe,CAAC,WAAoD,EAAE,QAAgB;QAClG,WAAW,KAAK,KAAK,CAAC;QACtB,IAAI,QAAQ,GAAG,CAAC,EAAE,CAAC;YACjB,MAAM,IAAI,G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AAO,EAAE,CAAC,EAAE,wBAAwB,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,wBAAwB,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","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":"CurveLocationDetail.d.ts","sourceRoot":"","sources":["../../../src/curve/CurveLocationDetail.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAU,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAEhE,OAAO,EAAE,OAAO,EAAE,QAAQ,E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E,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"}
|
|
@@ -362,7 +362,22 @@ export class CurveLocationDetail {
|
|
|
362
362
|
if (detailA) {
|
|
363
363
|
if (!detailB)
|
|
364
364
|
return detailA;
|
|
365
|
-
|
|
365
|
+
// tiebreakers (exact comparison!)
|
|
366
|
+
if (detailA.a === detailB.a) {
|
|
367
|
+
// prefer interior to exterior
|
|
368
|
+
const isInteriorA = Geometry.isIn01(detailA.fraction);
|
|
369
|
+
const isInteriorB = Geometry.isIn01(detailB.fraction);
|
|
370
|
+
if (isInteriorA && !isInteriorB)
|
|
371
|
+
return detailA;
|
|
372
|
+
if (!isInteriorA && isInteriorB)
|
|
373
|
+
return detailB;
|
|
374
|
+
if (!isInteriorA && !isInteriorB) { // prefer exterior closer to [0,1]
|
|
375
|
+
const distFrom01A = detailA.fraction < 0 ? -detailA.fraction : detailA.fraction - 1;
|
|
376
|
+
const distFrom01B = detailB.fraction < 0 ? -detailB.fraction : detailB.fraction - 1;
|
|
377
|
+
return (distFrom01A <= distFrom01B) ? detailA : detailB;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
return detailA.a < detailB.a ? detailA : detailB;
|
|
366
381
|
}
|
|
367
382
|
return detailB;
|
|
368
383
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurveLocationDetail.js","sourceRoot":"","sources":["../../../src/curve/CurveLocationDetail.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,OAAO,EAAE,MAAM,EAAqB,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAc,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,EAAY,MAAM,+BAA+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;;GAIG;AACH,MAAM,OAAO,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","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":"AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,OAAO,EAAE,MAAM,EAAqB,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,QAAQ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AAO,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,QAAQ,CAAC,mBAAmB,EAC/C,SAAkB,KAAK;QAEvB,OAAO,CAAC,EAA2B,EAAE,EAA2B,EAAU,EAAE;YAC1E,MAAM,aAAa,GAAG,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,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;AAED;;;;GAIG;AACH,MAAM,OAAO,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","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"]}
|