@itwin/core-geometry 3.3.0-dev.76 → 3.3.0-dev.79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/curve/spiral/DirectSpiral3d.js +1 -1
- package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableBlockedArray.d.ts +32 -3
- package/lib/cjs/geometry3d/GrowableBlockedArray.d.ts.map +1 -1
- package/lib/cjs/geometry3d/GrowableBlockedArray.js +63 -14
- package/lib/cjs/geometry3d/GrowableBlockedArray.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableFloat64Array.d.ts +24 -8
- package/lib/cjs/geometry3d/GrowableFloat64Array.d.ts.map +1 -1
- package/lib/cjs/geometry3d/GrowableFloat64Array.js +72 -54
- package/lib/cjs/geometry3d/GrowableFloat64Array.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYArray.d.ts +51 -26
- package/lib/cjs/geometry3d/GrowableXYArray.d.ts.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYArray.js +136 -116
- package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +35 -21
- package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYZArray.js +124 -137
- package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
- package/lib/esm/curve/spiral/DirectSpiral3d.js +1 -1
- package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
- package/lib/esm/geometry3d/GrowableBlockedArray.d.ts +32 -3
- package/lib/esm/geometry3d/GrowableBlockedArray.d.ts.map +1 -1
- package/lib/esm/geometry3d/GrowableBlockedArray.js +63 -14
- package/lib/esm/geometry3d/GrowableBlockedArray.js.map +1 -1
- package/lib/esm/geometry3d/GrowableFloat64Array.d.ts +24 -8
- package/lib/esm/geometry3d/GrowableFloat64Array.d.ts.map +1 -1
- package/lib/esm/geometry3d/GrowableFloat64Array.js +72 -54
- package/lib/esm/geometry3d/GrowableFloat64Array.js.map +1 -1
- package/lib/esm/geometry3d/GrowableXYArray.d.ts +51 -26
- package/lib/esm/geometry3d/GrowableXYArray.d.ts.map +1 -1
- package/lib/esm/geometry3d/GrowableXYArray.js +136 -116
- package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
- package/lib/esm/geometry3d/GrowableXYZArray.d.ts +35 -21
- package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
- package/lib/esm/geometry3d/GrowableXYZArray.js +124 -137
- package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
- package/package.json +4 -4
|
@@ -90,7 +90,7 @@ class DirectSpiral3d extends TransitionSpiral3d_1.TransitionSpiral3d {
|
|
|
90
90
|
for (let i = 1; i <= numInterval; i++) {
|
|
91
91
|
fraction1 = distances.getXAtUncheckedPointIndex(i);
|
|
92
92
|
trueDistance1 = trueDistance0 + this._evaluator.integrateDistanceBetweenFractions(fraction0, fraction1);
|
|
93
|
-
distances.
|
|
93
|
+
distances.setXYAtCheckedPointIndex(i, fraction1, trueDistance1);
|
|
94
94
|
fraction0 = fraction1;
|
|
95
95
|
trueDistance0 = trueDistance1;
|
|
96
96
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DirectSpiral3d.js","sourceRoot":"","sources":["../../../../src/curve/spiral/DirectSpiral3d.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,6CAA0C;AAM1C,0DAAuD;AAEvD,kDAA+C;AAC/C,oDAAiD;AAEjD,qDAA6D;AAC7D,iEAAsF;AACtF,uFAAoF;AACpF,mFAAgF;AAEhF,6DAA0D;AAE1D,qFAA4E;AAC5E,6EAAoE;AACpE;;;;;;;;;;;;;;;EAeE;AACF,MAAa,cAAe,SAAQ,uCAAkB;IA+BpD,sEAAsE;IACtE,iEAAiE;IACjE,YACE,YAAuB,EACvB,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CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC;mBAC9D,mBAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC;mBAC5D,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,KAAK,CAAC,YAAY,CAAC;mBACnD,IAAI,CAAC,uBAAuB,CAAC,aAAa,CAAC,KAAK,CAAC,uBAAuB,CAAC;mBACzE,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;SACtD;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAhiBD,wCAgiBC","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 { Geometry } from \"../../Geometry\";\r\nimport { GeometryHandler, IStrokeHandler } from \"../../geometry3d/GeometryHandler\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"../../geometry3d/Plane3dByOriginAndUnitNormal\";\r\nimport { Plane3dByOriginAndVectors } from \"../../geometry3d/Plane3dByOriginAndVectors\";\r\nimport { Point3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\r\nimport { Segment1d } from \"../../geometry3d/Segment1d\";\r\nimport { Transform } from \"../../geometry3d/Transform\";\r\nimport { LineString3d } from \"../LineString3d\";\r\nimport { StrokeOptions } from \"../StrokeOptions\";\r\nimport { TransitionConditionalProperties } from \"./TransitionConditionalProperties\";\r\nimport { ClothoidSeriesRLEvaluator } from \"./ClothoidSeries\";\r\nimport { CzechSpiralEvaluator, ItalianSpiralEvaluator } from \"./CzechSpiralEvaluator\";\r\nimport { DirectHalfCosineSpiralEvaluator } from \"./DirectHalfCosineSpiralEvaluator\";\r\nimport { AustralianRailCorpXYEvaluator } from \"./AustralianRailCorpXYEvaluator\";\r\nimport { XYCurveEvaluator } from \"./XYCurveEvaluator\";\r\nimport { TransitionSpiral3d } from \"./TransitionSpiral3d\";\r\nimport { Angle } from \"../../geometry3d/Angle\";\r\nimport { MXCubicAlongArcEvaluator } from \"./MXCubicAlongArcSpiralEvaluator\";\r\nimport { PolishCubicEvaluator } from \"./PolishCubicSpiralEvaluator\";\r\n/**\r\n* DirectSpiral3d acts like a TransitionSpiral3d for serialization purposes, but implements spiral types that have \"direct\" xy calculations without the integrations required\r\n* for IntegratedSpiral3d.\r\n* * Each DirectSpiral3d carries an XYCurveEvaluator to give it specialized behavior.\r\n* * Direct spirals that flow through serialization to native imodel02 are create with these static methods:\r\n* * createArema\r\n* * createJapaneseCubic\r\n* * createAustralianRail\r\n* * createDirectHalfCosine\r\n* * createChineseCubic\r\n* * createCzechCubic\r\n* * createPolishCubic\r\n* * createItalian\r\n* * createWesternAustralian\r\n* @public\r\n*/\r\nexport class DirectSpiral3d extends TransitionSpiral3d {\r\n\r\n /** String name for schema properties */\r\n\r\n public readonly curvePrimitiveType = \"transitionSpiral\";\r\n\r\n /** stroked approximation of entire spiral. This is AFTER the localToWorld transform ... */\r\n private _globalStrokes: LineString3d;\r\n /** stroked approximation of active spiral. This is AFTER the localToWorld transfomr ...\r\n * * Same count as global -- possibly overly fine, but it gives some consistency between same clothoid constructed as partial versus complete.\r\n * * If no trimming, this points to the same place as the _globalStrokes !!! Don't double transform!!!\r\n */\r\n private _activeStrokes?: LineString3d;\r\n /** Return the internal stroked form of the (possibly partial) spiral */\r\n public get activeStrokes(): LineString3d { return this._activeStrokes !== undefined ? this._activeStrokes : this._globalStrokes; }\r\n\r\n private _nominalL1: number;\r\n private _nominalR1: number;\r\n private _evaluator: XYCurveEvaluator;\r\n\r\n /** Return the nominal end radius. */\r\n public get nominalR1(): number { return this._nominalR1; }\r\n /** Return the nominal distance from inflection to endpoint. */\r\n public get nominalL1(): number { return this._nominalL1; }\r\n /** Return the nominal end curvature */\r\n public get nominalCurvature1(): number { return TransitionSpiral3d.radiusToCurvature(this._nominalR1); }\r\n /** Return the low level evaluator\r\n * @internal\r\n */\r\n public get evaluator(): XYCurveEvaluator { return this._evaluator; }\r\n\r\n // constructor demands radius1 and distance1 for nominal construction.\r\n // caller is responsible for managing intervals of partial spiral\r\n constructor(\r\n localToWorld: Transform,\r\n spiralType: string | undefined,\r\n originalProperties: TransitionConditionalProperties | undefined,\r\n nominalL1: number,\r\n nominalR1: number,\r\n activeFractionInterval: Segment1d | undefined,\r\n evaluator: XYCurveEvaluator) {\r\n super(spiralType, localToWorld, activeFractionInterval, originalProperties);\r\n this._nominalL1 = nominalL1;\r\n this._nominalR1 = nominalR1;\r\n this._evaluator = evaluator;\r\n this._globalStrokes = LineString3d.create();\r\n this._activeStrokes = LineString3d.create();\r\n // initialize for compiler -- but this will be recomputed in refreshComputeProperties ...\r\n this.refreshComputedProperties();\r\n }\r\n /**\r\n * Compute stroke data in an interval.\r\n * @param strokes strokes to clear and refill.\r\n * @param fraction0 start fraction\r\n * @param fraction1 end fraction\r\n */\r\n private computeStrokes(strokes: LineString3d, fractionA: number, fractionB: number, numInterval: number, applyLocalToWorld: boolean = true) {\r\n if (numInterval < 1)\r\n numInterval = 1;\r\n strokes.clear();\r\n strokes.ensureEmptyUVParams();\r\n strokes.ensureEmptyFractions();\r\n const distances = strokes.packedUVParams!;\r\n const nominalIntervalLength = Math.abs(fractionB - fractionA) * this._nominalL1;\r\n for (let i = 0; i <= numInterval; i++) {\r\n const fraction = Geometry.interpolate(fractionA, i / numInterval, fractionB);\r\n const nominalDistanceAlong = fraction * nominalIntervalLength;\r\n strokes.packedPoints.pushXYZ(this._evaluator.fractionToX(fraction),\r\n this._evaluator.fractionToY(fraction), 0);\r\n distances.pushXY(fraction, nominalDistanceAlong); // the second distance will be updated below\r\n }\r\n if (applyLocalToWorld)\r\n strokes.tryTransformInPlace (this._localToWorld);\r\n let fraction0 = distances.getXAtUncheckedPointIndex(0);\r\n let trueDistance0 = distances.getYAtUncheckedPointIndex(0); // whatever was assigned as start distance is fine\r\n let trueDistance1, fraction1;\r\n for (let i = 1; i <= numInterval; i++) {\r\n fraction1 = distances.getXAtUncheckedPointIndex(i);\r\n trueDistance1 = trueDistance0 + this._evaluator.integrateDistanceBetweenFractions(fraction0, fraction1);\r\n distances.setXYZAtCheckedPointIndex(i, fraction1, trueDistance1);\r\n fraction0 = fraction1;\r\n trueDistance0 = trueDistance1;\r\n }\r\n\r\n }\r\n /** Recompute strokes */\r\n public override refreshComputedProperties() {\r\n const sweepRadians = this.nominalL1 / (2.0 * this.nominalR1);\r\n const radiansStep = 0.02;\r\n const numInterval = StrokeOptions.applyAngleTol(undefined, 4, sweepRadians, radiansStep);\r\n this.computeStrokes(this._globalStrokes, 0, 1, numInterval);\r\n const numActiveInterval = Math.ceil(this._activeFractionInterval.absoluteDelta() * numInterval);\r\n this._activeStrokes = LineString3d.create();\r\n this.computeStrokes(this._activeStrokes, this._activeFractionInterval.x0, this._activeFractionInterval.x1,\r\n numActiveInterval);\r\n }\r\n /**\r\n * Create a spiral object which uses numXTerm terms from the clothoid X series and numYTerm from the clothoid Y series.\r\n * @param numXTerm number of terms to use from X series\r\n * @param numYTerm number of terms to use from Y series\r\n * @param localToWorld placement frame. Inflection point is at origin, initial direction is along x axis.\r\n * @param nominalL1 design distance from inflection to end point.\r\n * @param nominalR1 design radius at end point.\r\n * @param activeInterval active interval (as fractions of nominalL1 !!!)\r\n */\r\n public static createTruncatedClothoid(\r\n spiralType: string,\r\n localToWorld: Transform,\r\n numXTerm: number, numYTerm: number,\r\n originalProperties: TransitionConditionalProperties | undefined,\r\n nominalL1: number, nominalR1: number,\r\n activeInterval: Segment1d | undefined): DirectSpiral3d | undefined {\r\n if (numXTerm < 1)\r\n numXTerm = 1;\r\n if (numYTerm < 1)\r\n numYTerm = 1;\r\n const evaluator = new ClothoidSeriesRLEvaluator(nominalL1, 1.0 / (2.0 * nominalL1 * nominalR1), numXTerm, numYTerm);\r\n return new DirectSpiral3d(\r\n localToWorld.clone(),\r\n spiralType,\r\n originalProperties,\r\n nominalL1, nominalR1,\r\n activeInterval ? activeInterval.clone() : Segment1d.create(0, 1), evaluator);\r\n }\r\n /**\r\n * Create an Japanese spiral clothoid approximation\r\n * * X is 1 terms of the clothoid series as a function of nominal distance along.\r\n * * Y is 1 terms f the clothoid series as a function of nominal distance along.\r\n * * Remark: This is identical to the ChineseCubic\r\n * @param localToWorld axes with inflection at origin, tangent along x axis\r\n * @param nominalL1 nominal length as used in series LR terms.\r\n * @param nominalR1 nominal final radius as used in series LR terms\r\n * @param activeInterval fractional interval with (0, nominalL1) range for nominal distance along\r\n */\r\n public static createJapaneseCubic(\r\n localToWorld: Transform,\r\n nominalL1: number,\r\n nominalR1: number,\r\n activeInterval?: Segment1d): DirectSpiral3d | undefined {\r\n return this.createTruncatedClothoid(\"JapaneseCubic\", localToWorld, 1, 1, undefined, nominalL1, nominalR1, activeInterval);\r\n }\r\n /**\r\n * Create a czech cubic.\r\n * This is y= m*x^3 with\r\n * * x any point on the x axis\r\n * * `fraction` along the spiral goes to `x = fraction * L`\r\n * * m is gamma / (6RL)\r\n * * 1/(6RL) is the leading term of the sine series.\r\n * * `gamma = 2R/sqrt (4RR-LL)` pushes y up a little bit to simulate the lost series terms.\r\n * @param localToWorld\r\n * @param nominalLx nominal length along x axis\r\n * @param nominalR1\r\n * @param activeInterval\r\n */\r\n public static createCzechCubic(\r\n localToWorld: Transform,\r\n nominalLx: number,\r\n nominalR1: number,\r\n activeInterval?: Segment1d): DirectSpiral3d | undefined {\r\n const evaluator = CzechSpiralEvaluator.create(nominalLx, nominalR1);\r\n if (evaluator === undefined)\r\n return undefined;\r\n return new DirectSpiral3d(\r\n localToWorld.clone(),\r\n \"Czech\",\r\n undefined,\r\n nominalLx, nominalR1,\r\n activeInterval ? activeInterval.clone() : Segment1d.create(0, 1), evaluator);\r\n }\r\n /**\r\n * Create an italian spiral\r\n * This is y= m*x^3 with\r\n * * x any point on the x axis\r\n * * `fraction` along the spiral goes to `x = fraction * L`\r\n * * m is gamma / (6RL)\r\n * * 1/(6RL) is the leading term of the sine series.\r\n * * `gamma = 2R/sqrt (4RR-LL)` pushes y up a little bit to simulate the lost series terms.\r\n * * L in gamma and m is the\r\n * @param localToWorld\r\n * @param nominalL1 nominal length along the spiral\r\n * @param nominalR1\r\n * @param activeInterval\r\n */\r\n public static createItalian(\r\n localToWorld: Transform,\r\n nominalL1: number,\r\n nominalR1: number,\r\n activeInterval?: Segment1d): DirectSpiral3d | undefined {\r\n const evaluator = ItalianSpiralEvaluator.create(nominalL1, nominalR1);\r\n if (evaluator === undefined)\r\n return undefined;\r\n return new DirectSpiral3d(\r\n localToWorld.clone(),\r\n \"Italian\",\r\n undefined,\r\n nominalL1, nominalR1,\r\n activeInterval ? activeInterval.clone() : Segment1d.create(0, 1), evaluator);\r\n }\r\n\r\n /**\r\n * Create an MX Cubic whose nominal length is close to along the curve.\r\n * This is y= m*x^3 with\r\n * * m is 1/ (6RL1)\r\n * * 1/(6RL) is the leading term of the sine series.\r\n * * L1 is an along-the-x-axis distance that is slightly LESS THAN the nominal length\r\n * * x is axis position that is slightly LESS than nominal distance along\r\n * * L1, x use the approximation `x = s * ( 1 - s^4/ (40 R R L L))\r\n * @param localToWorld\r\n * @param nominalL1\r\n * @param nominalR1\r\n * @param activeInterval\r\n */\r\n public static createMXCubicAlongArc(\r\n localToWorld: Transform,\r\n nominalL1: number,\r\n nominalR1: number,\r\n activeInterval?: Segment1d): DirectSpiral3d | undefined {\r\n const evaluator = MXCubicAlongArcEvaluator.create(nominalL1, nominalR1);\r\n if (evaluator === undefined)\r\n return undefined;\r\n return new DirectSpiral3d(\r\n localToWorld.clone(),\r\n \"MXCubicAlongArc\",\r\n undefined,\r\n nominalL1, nominalR1,\r\n activeInterval ? activeInterval.clone() : Segment1d.create(0, 1), evaluator);\r\n }\r\n\r\n /**\r\n * Create a polish cubic\r\n * This is y= m*x^3 with\r\n * * m is 1/ (6RL)\r\n * * 1/(6RL) is the leading term of the sine series.\r\n * * L is nominal length\r\n * * R is nominal end radius.\r\n * * x ranges up to the x axis distance for which the polish distance series produces f(x)=L\r\n * * The support class PolishCubicEvaluator has static methods for the distance series and its inversion.\r\n */\r\n public static createPolishCubic(\r\n localToWorld: Transform,\r\n nominalL1: number,\r\n nominalR1: number,\r\n activeInterval?: Segment1d): DirectSpiral3d | undefined {\r\n const evaluator = PolishCubicEvaluator.create(nominalL1, nominalR1);\r\n if (evaluator === undefined)\r\n return undefined;\r\n return new DirectSpiral3d(\r\n localToWorld.clone(),\r\n \"PolishCubic\",\r\n undefined,\r\n nominalL1, nominalR1,\r\n activeInterval ? activeInterval.clone() : Segment1d.create(0, 1), evaluator);\r\n }\r\n\r\n /**\r\n * Create an AustralianRailCorp spiral\r\n * This is y= m*x^3 with\r\n * * x any point on the x axis\r\n * * `fraction` along the spiral goes to `x = fraction * L`\r\n * * m is gamma / (6RL)\r\n * * 1/(6RL) is the leading term of the sine series.\r\n * * `gamma = 2R/sqrt (4RR-LL)` pushes y up a little bit to simulate the lost series terms.\r\n * @param localToWorld\r\n * @param nominalL1\r\n * @param nominalR1\r\n * @param activeInterval\r\n */\r\n public static createAustralianRail(\r\n localToWorld: Transform,\r\n nominalL1: number,\r\n nominalR1: number,\r\n activeInterval?: Segment1d): DirectSpiral3d | undefined {\r\n const evaluator = AustralianRailCorpXYEvaluator.create(nominalL1, nominalR1);\r\n if (evaluator === undefined)\r\n return undefined;\r\n return new DirectSpiral3d(\r\n localToWorld.clone(),\r\n \"AustralianRailCorp\",\r\n undefined,\r\n nominalL1, nominalR1,\r\n activeInterval ? activeInterval.clone() : Segment1d.create(0, 1), evaluator);\r\n }\r\n\r\n public static createDirectHalfCosine(\r\n localToWorld: Transform,\r\n nominalL1: number,\r\n nominalR1: number,\r\n activeInterval?: Segment1d): DirectSpiral3d | undefined {\r\n return new this(localToWorld, \"HalfCosine\", undefined, nominalL1, nominalR1, activeInterval,\r\n new DirectHalfCosineSpiralEvaluator(nominalL1, nominalR1));\r\n }\r\n /**\r\n * Create an Arema spiral clothoid approximation\r\n * * X is 2 terms of the clothoid series as a function of nominal distance along\r\n * * Y is 2 terms f the clothoid series as a function of nominal distance along\r\n * * Remark: This is identical to the ChineseCubic\r\n * @param localToWorld axes with inflection at origin, tangent along x axis\r\n * @param nominalL1 nominal length as used in series LR terms.\r\n * @param nominalR1 nominal final radius as used in series LR terms\r\n * @param activeInterval fractional interval with (0, nominalL1) range for nominal distance along\r\n */\r\n public static createArema(\r\n localToWorld: Transform,\r\n nominalL1: number,\r\n nominalR1: number,\r\n activeInterval?: Segment1d): DirectSpiral3d | undefined {\r\n return this.createTruncatedClothoid(\"Arema\", localToWorld, 2, 2, undefined, nominalL1, nominalR1, activeInterval);\r\n }\r\n\r\n /**\r\n * Create a Chinese clothoid approximation\r\n * * X is 2 terms of the clothoid series as a function of nominal distance along\r\n * * Y is 2 terms f the clothoid series as a function of nominal distance along\r\n * * Remark: This is identical to the Arema spiral\r\n * @param localToWorld axes with inflection at origin, tangent along x axis\r\n * @param nominalL1 nominal length as used in series LR terms.\r\n * @param nominalR1 nominal final radius as used in series LR terms\r\n * @param activeInterval fractional interval with (0, nominalL1) range for nominal distance along\r\n */\r\n public static createChineseCubic(\r\n localToWorld: Transform,\r\n nominalL1: number,\r\n nominalR1: number,\r\n activeInterval?: Segment1d): DirectSpiral3d | undefined {\r\n return this.createTruncatedClothoid(\"ChineseCubic\", localToWorld, 2, 2, undefined, nominalL1, nominalR1, activeInterval);\r\n }\r\n /**\r\n * Create a Western Australian direct spiral.\r\n * * X is 2 terms of the clothoid series as a function of distance along\r\n * * Y is 1 term (cubic in nominal distance along)\r\n * @param localToWorld axes with inflection at origin, tangent along x axis\r\n * @param nominalL1 nominal length as used in series LR terms.\r\n * @param nominalR1 nominal final radius as used in series LR terms\r\n * @param activeInterval fractional interval with (0, nominalL1) range for nominal distance along\r\n */\r\n public static createWesternAustralian(\r\n localToWorld: Transform,\r\n nominalL1: number,\r\n nominalR1: number,\r\n activeInterval?: Segment1d): DirectSpiral3d | undefined {\r\n return this.createTruncatedClothoid(\"WesternAustralian\", localToWorld, 2, 1, undefined, nominalL1, nominalR1, activeInterval);\r\n }\r\n /**\r\n * Create (if possible) a DirectSpiral3d, applying various strict conditions appropriate to the spiral type.\r\n * The parameter list includes extraneous values in order to directly match IntegratedSpiral3d.create, which has greater flexibility about\r\n * mixtures of values.\r\n * * IMPORTANT RESTRICTIONS\r\n * * Direct spirals must have the inflection at the origin of their coordinate system, aligned with the x axis.\r\n * * hence bearing0 = 0\r\n * * hence radius0 = 0\r\n * * bearing1 is ignored\r\n * * radius1 must be given.\r\n * * arcLength must be given,\r\n * @param spiralType one of the types in `DirectSpiralTypeNames`\r\n * @param radius0 radius (or 0 for tangent to line) at start. Must be ZERO or UNDEFINED\r\n * @param radius1 radius (or 0 for tangent to line) at end.\r\n * @param bearing0 bearing, measured CCW from x axis at start. Must be ZERO or UNDEFINED\r\n * @param bearing1 bearing, measured CCW from x axis at end. IGNORED.\r\n * @param fractionInterval optional fractional interval for an \"active\" portion of the curve. if omitted, the full [0,1] is used.\r\n * @param localToWorld placement transform\r\n */\r\n public static createFromLengthAndRadius(\r\n spiralType: string,\r\n radius0: number | undefined,\r\n radius1: number | undefined,\r\n bearing0: Angle | undefined,\r\n _bearing1: Angle | undefined,\r\n arcLength: number | undefined,\r\n activeInterval: undefined | Segment1d,\r\n localToWorld: Transform): TransitionSpiral3d | undefined {\r\n if (bearing0 !== undefined && !bearing0.isAlmostZero)\r\n return undefined;\r\n if (radius0 !== undefined && !Geometry.isSmallMetricDistance(radius0))\r\n return undefined;\r\n if (radius1 === undefined || Geometry.isSmallMetricDistance(radius1))\r\n return undefined;\r\n if (arcLength === undefined)\r\n return undefined;\r\n if (Geometry.equalStringNoCase(spiralType, \"Arema\"))\r\n return this.createArema(localToWorld, arcLength, radius1, activeInterval);\r\n if (Geometry.equalStringNoCase(spiralType, \"ChineseCubic\"))\r\n return this.createChineseCubic(localToWorld, arcLength, radius1, activeInterval);\r\n if (Geometry.equalStringNoCase(spiralType, \"JapaneseCubic\"))\r\n return this.createJapaneseCubic(localToWorld, arcLength, radius1, activeInterval);\r\n if (Geometry.equalStringNoCase(spiralType, \"HalfCosine\"))\r\n return this.createDirectHalfCosine(localToWorld, arcLength, radius1, activeInterval);\r\n if (Geometry.equalStringNoCase(spiralType, \"Czech\"))\r\n return this.createCzechCubic(localToWorld, arcLength, radius1, activeInterval);\r\n if (Geometry.equalStringNoCase(spiralType, \"Italian\"))\r\n return this.createItalian(localToWorld, arcLength, radius1, activeInterval);\r\n if (Geometry.equalStringNoCase(spiralType, \"AustralianRailCorp\"))\r\n return this.createAustralianRail(localToWorld, arcLength, radius1, activeInterval);\r\n if (Geometry.equalStringNoCase(spiralType, \"MXCubicAlongArc\"))\r\n return this.createMXCubicAlongArc(localToWorld, arcLength, radius1, activeInterval);\r\n if (Geometry.equalStringNoCase(spiralType, \"WesternAustralian\"))\r\n return this.createWesternAustralian(localToWorld, arcLength, radius1, activeInterval);\r\n if (Geometry.equalStringNoCase(spiralType, \"PolishCubic\"))\r\n return this.createPolishCubic(localToWorld, arcLength, radius1, activeInterval);\r\n return undefined;\r\n }\r\n /** Deep clone of this spiral */\r\n public override clone(): DirectSpiral3d {\r\n return new DirectSpiral3d(\r\n this.localToWorld.clone(),\r\n this._spiralType,\r\n this.designProperties?.clone(),\r\n this._nominalL1,\r\n this._nominalR1,\r\n this._activeFractionInterval?.clone(),\r\n this._evaluator.clone());\r\n }\r\n\r\n /** apply `transform` to this spiral's local to world transform. */\r\n public tryTransformInPlace(transformA: Transform): boolean {\r\n const rigidData = this.applyRigidPartOfTransform(transformA);\r\n if (rigidData !== undefined) {\r\n this._nominalL1 *= rigidData.scale;\r\n this._nominalR1 *= rigidData.scale;\r\n this.evaluator.scaleInPlace(rigidData.scale);\r\n }\r\n this.refreshComputedProperties();\r\n return true;\r\n }\r\n\r\n /** Return the spiral start point. */\r\n public override startPoint(): Point3d { return this.activeStrokes.startPoint(); }\r\n /** return the spiral end point. */\r\n public override endPoint(): Point3d { return this.activeStrokes.endPoint(); }\r\n /** test if the local to world transform places the spiral xy plane into `plane` */\r\n public isInPlane(plane: Plane3dByOriginAndUnitNormal): boolean {\r\n return plane.isPointInPlane(this.localToWorld.origin as Point3d)\r\n && Geometry.isSameCoordinate(0.0, this.localToWorld.matrix.dotColumnX(plane.getNormalRef()))\r\n && Geometry.isSameCoordinate(0.0, this.localToWorld.matrix.dotColumnY(plane.getNormalRef()));\r\n }\r\n /** Return quick length of the spiral.\r\n * The tangent vector of a true clothoid is length 1 everywhere, so simple proportion of nominalL1 is a good approximation.\r\n */\r\n public quickLength() {\r\n const distanceData = this._globalStrokes.packedUVParams!;\r\n const n = distanceData.length;\r\n return distanceData.getYAtUncheckedPointIndex(n - 1);\r\n }\r\n /** Return length of the spiral.\r\n * * True length is stored at back of uvParams . . .\r\n */\r\n // use the generic integrator ... public override curveLength() { return this.quickLength(); }\r\n /** Test if `other` is an instance of `TransitionSpiral3d` */\r\n public isSameGeometryClass(other: any): boolean { return other instanceof DirectSpiral3d; }\r\n /** Add strokes from this spiral to `dest`.\r\n * * Linestrings will usually stroke as just their points.\r\n * * If maxEdgeLength is given, this will sub-stroke within the linestring -- not what we want.\r\n */\r\n public emitStrokes(dest: LineString3d, options?: StrokeOptions): void { this.activeStrokes.emitStrokes(dest, options); }\r\n /** emit stroke fragments to `dest` handler. */\r\n public emitStrokableParts(dest: IStrokeHandler, options?: StrokeOptions): void {\r\n const n = this.computeStrokeCountForOptions(options);\r\n const activeStrokes = this.activeStrokes;\r\n dest.startParentCurvePrimitive(this);\r\n if (n <= activeStrokes.numPoints()) {\r\n // this.activeStrokes.emitStrokableParts(dest, options);\r\n dest.announceIntervalForUniformStepStrokes(this, 2 * activeStrokes.numPoints(), 0.0, 1.0);\r\n } else {\r\n dest.announceIntervalForUniformStepStrokes(this, n, 0.0, 1.0);\r\n }\r\n dest.endParentCurvePrimitive(this);\r\n }\r\n\r\n /**\r\n * return the stroke count required for given options.\r\n * @param options StrokeOptions that determine count\r\n */\r\n\r\n public computeStrokeCountForOptions(options?: StrokeOptions): number {\r\n let numStroke;\r\n const nominalRadians = this._nominalL1 / (2.0 * this._nominalR1);\r\n if (options) {\r\n const rMin = Math.abs(this._nominalR1);\r\n numStroke = options.applyTolerancesToArc(rMin, nominalRadians);\r\n numStroke = options.applyMaxEdgeLength(numStroke, this.quickLength());\r\n numStroke = options.applyMinStrokesPerPrimitive(numStroke);\r\n } else {\r\n numStroke = StrokeOptions.applyAngleTol(undefined, 4, nominalRadians, 0.02);\r\n }\r\n numStroke = Math.ceil(this._activeFractionInterval.absoluteDelta() * numStroke);\r\n return numStroke;\r\n }\r\n\r\n /** Reverse the active interval and active strokes.\r\n * * Primary defining data remains unchanged !!!\r\n */\r\n\r\n public reverseInPlace(): void {\r\n this._activeFractionInterval.reverseInPlace();\r\n if (this._activeStrokes === undefined)\r\n this._activeStrokes = this._globalStrokes.clone();\r\n this._activeStrokes.reverseInPlace();\r\n }\r\n /** Evaluate curve point with respect to fraction. */\r\n public fractionToPoint(activeFraction: number, result?: Point3d): Point3d {\r\n const globalFraction = this._activeFractionInterval.fractionToPoint(activeFraction);\r\n result = this._evaluator.fractionToPoint(globalFraction, result);\r\n this.localToWorld.multiplyPoint3d(result, result);\r\n return result;\r\n }\r\n /** Evaluate curve point and derivative with respect to fraction. */\r\n public fractionToPointAndDerivative(activeFraction: number, result?: Ray3d): Ray3d {\r\n const globalFraction = this._activeFractionInterval.fractionToPoint(activeFraction);\r\n result = this._evaluator.fractionToPointAndDerivative(globalFraction, result);\r\n result.direction.scaleInPlace(this._activeFractionInterval.signedDelta());\r\n result.transformInPlace(this.localToWorld);\r\n return result;\r\n }\r\n\r\n /** Return a plane with\r\n *\r\n * * origin at fractional position along the curve\r\n * * vectorU is the first derivative, i.e. tangent vector with length equal to the rate of change with respect to the fraction.\r\n * * vectorV is the second derivative, i.e.derivative of vectorU.\r\n */\r\n\r\n public fractionToPointAnd2Derivatives(activeFraction: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors | undefined {\r\n const globalFraction = this._activeFractionInterval.fractionToPoint(activeFraction);\r\n result = this._evaluator.fractionToPointAnd2Derivatives(globalFraction, result);\r\n const a = this._activeFractionInterval.signedDelta();\r\n result.vectorU.scaleInPlace(a);\r\n result.vectorV.scaleInPlace(a * a);\r\n result.transformInPlace(this.localToWorld);\r\n return result;\r\n }\r\n /** Second step of double dispatch: call `handler.handleTransitionSpiral(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleTransitionSpiral(this);\r\n }\r\n /** compare various coordinate quantities */\r\n public override isAlmostEqual(other: any): boolean {\r\n if (other instanceof DirectSpiral3d) {\r\n return Geometry.isSameCoordinate(this._nominalL1, other._nominalL1)\r\n && Geometry.isSameCoordinate(this._nominalR1, other._nominalR1)\r\n && this.localToWorld.isAlmostEqual(other.localToWorld)\r\n && this._activeFractionInterval.isAlmostEqual(other._activeFractionInterval)\r\n && this._evaluator.isAlmostEqual(other._evaluator);\r\n }\r\n return false;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"DirectSpiral3d.js","sourceRoot":"","sources":["../../../../src/curve/spiral/DirectSpiral3d.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,6CAA0C;AAM1C,0DAAuD;AAEvD,kDAA+C;AAC/C,oDAAiD;AAEjD,qDAA6D;AAC7D,iEAAsF;AACtF,uFAAoF;AACpF,mFAAgF;AAEhF,6DAA0D;AAE1D,qFAA4E;AAC5E,6EAAoE;AACpE;;;;;;;;;;;;;;;EAeE;AACF,MAAa,cAAe,SAAQ,uCAAkB;IA+BpD,sEAAsE;IACtE,iEAAiE;IACjE,YACE,YAAuB,EACvB,UAA8B,EAC9B,kBAA+D,EAC/D,SAAiB,EACjB,SAAiB,EACjB,sBA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U,CAAC;mBAC9D,mBAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC;mBAC5D,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,KAAK,CAAC,YAAY,CAAC;mBACnD,IAAI,CAAC,uBAAuB,CAAC,aAAa,CAAC,KAAK,CAAC,uBAAuB,CAAC;mBACzE,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;SACtD;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAhiBD,wCAgiBC","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 { Geometry } from \"../../Geometry\";\r\nimport { GeometryHandler, IStrokeHandler } from \"../../geometry3d/GeometryHandler\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"../../geometry3d/Plane3dByOriginAndUnitNormal\";\r\nimport { Plane3dByOriginAndVectors } from \"../../geometry3d/Plane3dByOriginAndVectors\";\r\nimport { Point3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\r\nimport { Segment1d } from \"../../geometry3d/Segment1d\";\r\nimport { Transform } from \"../../geometry3d/Transform\";\r\nimport { LineString3d } from \"../LineString3d\";\r\nimport { StrokeOptions } from \"../StrokeOptions\";\r\nimport { TransitionConditionalProperties } from \"./TransitionConditionalProperties\";\r\nimport { ClothoidSeriesRLEvaluator } from \"./ClothoidSeries\";\r\nimport { CzechSpiralEvaluator, ItalianSpiralEvaluator } from \"./CzechSpiralEvaluator\";\r\nimport { DirectHalfCosineSpiralEvaluator } from \"./DirectHalfCosineSpiralEvaluator\";\r\nimport { AustralianRailCorpXYEvaluator } from \"./AustralianRailCorpXYEvaluator\";\r\nimport { XYCurveEvaluator } from \"./XYCurveEvaluator\";\r\nimport { TransitionSpiral3d } from \"./TransitionSpiral3d\";\r\nimport { Angle } from \"../../geometry3d/Angle\";\r\nimport { MXCubicAlongArcEvaluator } from \"./MXCubicAlongArcSpiralEvaluator\";\r\nimport { PolishCubicEvaluator } from \"./PolishCubicSpiralEvaluator\";\r\n/**\r\n* DirectSpiral3d acts like a TransitionSpiral3d for serialization purposes, but implements spiral types that have \"direct\" xy calculations without the integrations required\r\n* for IntegratedSpiral3d.\r\n* * Each DirectSpiral3d carries an XYCurveEvaluator to give it specialized behavior.\r\n* * Direct spirals that flow through serialization to native imodel02 are create with these static methods:\r\n* * createArema\r\n* * createJapaneseCubic\r\n* * createAustralianRail\r\n* * createDirectHalfCosine\r\n* * createChineseCubic\r\n* * createCzechCubic\r\n* * createPolishCubic\r\n* * createItalian\r\n* * createWesternAustralian\r\n* @public\r\n*/\r\nexport class DirectSpiral3d extends TransitionSpiral3d {\r\n\r\n /** String name for schema properties */\r\n\r\n public readonly curvePrimitiveType = \"transitionSpiral\";\r\n\r\n /** stroked approximation of entire spiral. This is AFTER the localToWorld transform ... */\r\n private _globalStrokes: LineString3d;\r\n /** stroked approximation of active spiral. This is AFTER the localToWorld transfomr ...\r\n * * Same count as global -- possibly overly fine, but it gives some consistency between same clothoid constructed as partial versus complete.\r\n * * If no trimming, this points to the same place as the _globalStrokes !!! Don't double transform!!!\r\n */\r\n private _activeStrokes?: LineString3d;\r\n /** Return the internal stroked form of the (possibly partial) spiral */\r\n public get activeStrokes(): LineString3d { return this._activeStrokes !== undefined ? this._activeStrokes : this._globalStrokes; }\r\n\r\n private _nominalL1: number;\r\n private _nominalR1: number;\r\n private _evaluator: XYCurveEvaluator;\r\n\r\n /** Return the nominal end radius. */\r\n public get nominalR1(): number { return this._nominalR1; }\r\n /** Return the nominal distance from inflection to endpoint. */\r\n public get nominalL1(): number { return this._nominalL1; }\r\n /** Return the nominal end curvature */\r\n public get nominalCurvature1(): number { return TransitionSpiral3d.radiusToCurvature(this._nominalR1); }\r\n /** Return the low level evaluator\r\n * @internal\r\n */\r\n public get evaluator(): XYCurveEvaluator { return this._evaluator; }\r\n\r\n // constructor demands radius1 and distance1 for nominal construction.\r\n // caller is responsible for managing intervals of partial spiral\r\n constructor(\r\n localToWorld: Transform,\r\n spiralType: string | undefined,\r\n originalProperties: TransitionConditionalProperties | undefined,\r\n nominalL1: number,\r\n nominalR1: number,\r\n activeFractionInterval: Segment1d | undefined,\r\n evaluator: XYCurveEvaluator) {\r\n super(spiralType, localToWorld, activeFractionInterval, originalProperties);\r\n this._nominalL1 = nominalL1;\r\n this._nominalR1 = nominalR1;\r\n this._evaluator = evaluator;\r\n this._globalStrokes = LineString3d.create();\r\n this._activeStrokes = LineString3d.create();\r\n // initialize for compiler -- but this will be recomputed in refreshComputeProperties ...\r\n this.refreshComputedProperties();\r\n }\r\n /**\r\n * Compute stroke data in an interval.\r\n * @param strokes strokes to clear and refill.\r\n * @param fraction0 start fraction\r\n * @param fraction1 end fraction\r\n */\r\n private computeStrokes(strokes: LineString3d, fractionA: number, fractionB: number, numInterval: number, applyLocalToWorld: boolean = true) {\r\n if (numInterval < 1)\r\n numInterval = 1;\r\n strokes.clear();\r\n strokes.ensureEmptyUVParams();\r\n strokes.ensureEmptyFractions();\r\n const distances = strokes.packedUVParams!;\r\n const nominalIntervalLength = Math.abs(fractionB - fractionA) * this._nominalL1;\r\n for (let i = 0; i <= numInterval; i++) {\r\n const fraction = Geometry.interpolate(fractionA, i / numInterval, fractionB);\r\n const nominalDistanceAlong = fraction * nominalIntervalLength;\r\n strokes.packedPoints.pushXYZ(this._evaluator.fractionToX(fraction),\r\n this._evaluator.fractionToY(fraction), 0);\r\n distances.pushXY(fraction, nominalDistanceAlong); // the second distance will be updated below\r\n }\r\n if (applyLocalToWorld)\r\n strokes.tryTransformInPlace (this._localToWorld);\r\n let fraction0 = distances.getXAtUncheckedPointIndex(0);\r\n let trueDistance0 = distances.getYAtUncheckedPointIndex(0); // whatever was assigned as start distance is fine\r\n let trueDistance1, fraction1;\r\n for (let i = 1; i <= numInterval; i++) {\r\n fraction1 = distances.getXAtUncheckedPointIndex(i);\r\n trueDistance1 = trueDistance0 + this._evaluator.integrateDistanceBetweenFractions(fraction0, fraction1);\r\n distances.setXYAtCheckedPointIndex(i, fraction1, trueDistance1);\r\n fraction0 = fraction1;\r\n trueDistance0 = trueDistance1;\r\n }\r\n\r\n }\r\n /** Recompute strokes */\r\n public override refreshComputedProperties() {\r\n const sweepRadians = this.nominalL1 / (2.0 * this.nominalR1);\r\n const radiansStep = 0.02;\r\n const numInterval = StrokeOptions.applyAngleTol(undefined, 4, sweepRadians, radiansStep);\r\n this.computeStrokes(this._globalStrokes, 0, 1, numInterval);\r\n const numActiveInterval = Math.ceil(this._activeFractionInterval.absoluteDelta() * numInterval);\r\n this._activeStrokes = LineString3d.create();\r\n this.computeStrokes(this._activeStrokes, this._activeFractionInterval.x0, this._activeFractionInterval.x1,\r\n numActiveInterval);\r\n }\r\n /**\r\n * Create a spiral object which uses numXTerm terms from the clothoid X series and numYTerm from the clothoid Y series.\r\n * @param numXTerm number of terms to use from X series\r\n * @param numYTerm number of terms to use from Y series\r\n * @param localToWorld placement frame. Inflection point is at origin, initial direction is along x axis.\r\n * @param nominalL1 design distance from inflection to end point.\r\n * @param nominalR1 design radius at end point.\r\n * @param activeInterval active interval (as fractions of nominalL1 !!!)\r\n */\r\n public static createTruncatedClothoid(\r\n spiralType: string,\r\n localToWorld: Transform,\r\n numXTerm: number, numYTerm: number,\r\n originalProperties: TransitionConditionalProperties | undefined,\r\n nominalL1: number, nominalR1: number,\r\n activeInterval: Segment1d | undefined): DirectSpiral3d | undefined {\r\n if (numXTerm < 1)\r\n numXTerm = 1;\r\n if (numYTerm < 1)\r\n numYTerm = 1;\r\n const evaluator = new ClothoidSeriesRLEvaluator(nominalL1, 1.0 / (2.0 * nominalL1 * nominalR1), numXTerm, numYTerm);\r\n return new DirectSpiral3d(\r\n localToWorld.clone(),\r\n spiralType,\r\n originalProperties,\r\n nominalL1, nominalR1,\r\n activeInterval ? activeInterval.clone() : Segment1d.create(0, 1), evaluator);\r\n }\r\n /**\r\n * Create an Japanese spiral clothoid approximation\r\n * * X is 1 terms of the clothoid series as a function of nominal distance along.\r\n * * Y is 1 terms f the clothoid series as a function of nominal distance along.\r\n * * Remark: This is identical to the ChineseCubic\r\n * @param localToWorld axes with inflection at origin, tangent along x axis\r\n * @param nominalL1 nominal length as used in series LR terms.\r\n * @param nominalR1 nominal final radius as used in series LR terms\r\n * @param activeInterval fractional interval with (0, nominalL1) range for nominal distance along\r\n */\r\n public static createJapaneseCubic(\r\n localToWorld: Transform,\r\n nominalL1: number,\r\n nominalR1: number,\r\n activeInterval?: Segment1d): DirectSpiral3d | undefined {\r\n return this.createTruncatedClothoid(\"JapaneseCubic\", localToWorld, 1, 1, undefined, nominalL1, nominalR1, activeInterval);\r\n }\r\n /**\r\n * Create a czech cubic.\r\n * This is y= m*x^3 with\r\n * * x any point on the x axis\r\n * * `fraction` along the spiral goes to `x = fraction * L`\r\n * * m is gamma / (6RL)\r\n * * 1/(6RL) is the leading term of the sine series.\r\n * * `gamma = 2R/sqrt (4RR-LL)` pushes y up a little bit to simulate the lost series terms.\r\n * @param localToWorld\r\n * @param nominalLx nominal length along x axis\r\n * @param nominalR1\r\n * @param activeInterval\r\n */\r\n public static createCzechCubic(\r\n localToWorld: Transform,\r\n nominalLx: number,\r\n nominalR1: number,\r\n activeInterval?: Segment1d): DirectSpiral3d | undefined {\r\n const evaluator = CzechSpiralEvaluator.create(nominalLx, nominalR1);\r\n if (evaluator === undefined)\r\n return undefined;\r\n return new DirectSpiral3d(\r\n localToWorld.clone(),\r\n \"Czech\",\r\n undefined,\r\n nominalLx, nominalR1,\r\n activeInterval ? activeInterval.clone() : Segment1d.create(0, 1), evaluator);\r\n }\r\n /**\r\n * Create an italian spiral\r\n * This is y= m*x^3 with\r\n * * x any point on the x axis\r\n * * `fraction` along the spiral goes to `x = fraction * L`\r\n * * m is gamma / (6RL)\r\n * * 1/(6RL) is the leading term of the sine series.\r\n * * `gamma = 2R/sqrt (4RR-LL)` pushes y up a little bit to simulate the lost series terms.\r\n * * L in gamma and m is the\r\n * @param localToWorld\r\n * @param nominalL1 nominal length along the spiral\r\n * @param nominalR1\r\n * @param activeInterval\r\n */\r\n public static createItalian(\r\n localToWorld: Transform,\r\n nominalL1: number,\r\n nominalR1: number,\r\n activeInterval?: Segment1d): DirectSpiral3d | undefined {\r\n const evaluator = ItalianSpiralEvaluator.create(nominalL1, nominalR1);\r\n if (evaluator === undefined)\r\n return undefined;\r\n return new DirectSpiral3d(\r\n localToWorld.clone(),\r\n \"Italian\",\r\n undefined,\r\n nominalL1, nominalR1,\r\n activeInterval ? activeInterval.clone() : Segment1d.create(0, 1), evaluator);\r\n }\r\n\r\n /**\r\n * Create an MX Cubic whose nominal length is close to along the curve.\r\n * This is y= m*x^3 with\r\n * * m is 1/ (6RL1)\r\n * * 1/(6RL) is the leading term of the sine series.\r\n * * L1 is an along-the-x-axis distance that is slightly LESS THAN the nominal length\r\n * * x is axis position that is slightly LESS than nominal distance along\r\n * * L1, x use the approximation `x = s * ( 1 - s^4/ (40 R R L L))\r\n * @param localToWorld\r\n * @param nominalL1\r\n * @param nominalR1\r\n * @param activeInterval\r\n */\r\n public static createMXCubicAlongArc(\r\n localToWorld: Transform,\r\n nominalL1: number,\r\n nominalR1: number,\r\n activeInterval?: Segment1d): DirectSpiral3d | undefined {\r\n const evaluator = MXCubicAlongArcEvaluator.create(nominalL1, nominalR1);\r\n if (evaluator === undefined)\r\n return undefined;\r\n return new DirectSpiral3d(\r\n localToWorld.clone(),\r\n \"MXCubicAlongArc\",\r\n undefined,\r\n nominalL1, nominalR1,\r\n activeInterval ? activeInterval.clone() : Segment1d.create(0, 1), evaluator);\r\n }\r\n\r\n /**\r\n * Create a polish cubic\r\n * This is y= m*x^3 with\r\n * * m is 1/ (6RL)\r\n * * 1/(6RL) is the leading term of the sine series.\r\n * * L is nominal length\r\n * * R is nominal end radius.\r\n * * x ranges up to the x axis distance for which the polish distance series produces f(x)=L\r\n * * The support class PolishCubicEvaluator has static methods for the distance series and its inversion.\r\n */\r\n public static createPolishCubic(\r\n localToWorld: Transform,\r\n nominalL1: number,\r\n nominalR1: number,\r\n activeInterval?: Segment1d): DirectSpiral3d | undefined {\r\n const evaluator = PolishCubicEvaluator.create(nominalL1, nominalR1);\r\n if (evaluator === undefined)\r\n return undefined;\r\n return new DirectSpiral3d(\r\n localToWorld.clone(),\r\n \"PolishCubic\",\r\n undefined,\r\n nominalL1, nominalR1,\r\n activeInterval ? activeInterval.clone() : Segment1d.create(0, 1), evaluator);\r\n }\r\n\r\n /**\r\n * Create an AustralianRailCorp spiral\r\n * This is y= m*x^3 with\r\n * * x any point on the x axis\r\n * * `fraction` along the spiral goes to `x = fraction * L`\r\n * * m is gamma / (6RL)\r\n * * 1/(6RL) is the leading term of the sine series.\r\n * * `gamma = 2R/sqrt (4RR-LL)` pushes y up a little bit to simulate the lost series terms.\r\n * @param localToWorld\r\n * @param nominalL1\r\n * @param nominalR1\r\n * @param activeInterval\r\n */\r\n public static createAustralianRail(\r\n localToWorld: Transform,\r\n nominalL1: number,\r\n nominalR1: number,\r\n activeInterval?: Segment1d): DirectSpiral3d | undefined {\r\n const evaluator = AustralianRailCorpXYEvaluator.create(nominalL1, nominalR1);\r\n if (evaluator === undefined)\r\n return undefined;\r\n return new DirectSpiral3d(\r\n localToWorld.clone(),\r\n \"AustralianRailCorp\",\r\n undefined,\r\n nominalL1, nominalR1,\r\n activeInterval ? activeInterval.clone() : Segment1d.create(0, 1), evaluator);\r\n }\r\n\r\n public static createDirectHalfCosine(\r\n localToWorld: Transform,\r\n nominalL1: number,\r\n nominalR1: number,\r\n activeInterval?: Segment1d): DirectSpiral3d | undefined {\r\n return new this(localToWorld, \"HalfCosine\", undefined, nominalL1, nominalR1, activeInterval,\r\n new DirectHalfCosineSpiralEvaluator(nominalL1, nominalR1));\r\n }\r\n /**\r\n * Create an Arema spiral clothoid approximation\r\n * * X is 2 terms of the clothoid series as a function of nominal distance along\r\n * * Y is 2 terms f the clothoid series as a function of nominal distance along\r\n * * Remark: This is identical to the ChineseCubic\r\n * @param localToWorld axes with inflection at origin, tangent along x axis\r\n * @param nominalL1 nominal length as used in series LR terms.\r\n * @param nominalR1 nominal final radius as used in series LR terms\r\n * @param activeInterval fractional interval with (0, nominalL1) range for nominal distance along\r\n */\r\n public static createArema(\r\n localToWorld: Transform,\r\n nominalL1: number,\r\n nominalR1: number,\r\n activeInterval?: Segment1d): DirectSpiral3d | undefined {\r\n return this.createTruncatedClothoid(\"Arema\", localToWorld, 2, 2, undefined, nominalL1, nominalR1, activeInterval);\r\n }\r\n\r\n /**\r\n * Create a Chinese clothoid approximation\r\n * * X is 2 terms of the clothoid series as a function of nominal distance along\r\n * * Y is 2 terms f the clothoid series as a function of nominal distance along\r\n * * Remark: This is identical to the Arema spiral\r\n * @param localToWorld axes with inflection at origin, tangent along x axis\r\n * @param nominalL1 nominal length as used in series LR terms.\r\n * @param nominalR1 nominal final radius as used in series LR terms\r\n * @param activeInterval fractional interval with (0, nominalL1) range for nominal distance along\r\n */\r\n public static createChineseCubic(\r\n localToWorld: Transform,\r\n nominalL1: number,\r\n nominalR1: number,\r\n activeInterval?: Segment1d): DirectSpiral3d | undefined {\r\n return this.createTruncatedClothoid(\"ChineseCubic\", localToWorld, 2, 2, undefined, nominalL1, nominalR1, activeInterval);\r\n }\r\n /**\r\n * Create a Western Australian direct spiral.\r\n * * X is 2 terms of the clothoid series as a function of distance along\r\n * * Y is 1 term (cubic in nominal distance along)\r\n * @param localToWorld axes with inflection at origin, tangent along x axis\r\n * @param nominalL1 nominal length as used in series LR terms.\r\n * @param nominalR1 nominal final radius as used in series LR terms\r\n * @param activeInterval fractional interval with (0, nominalL1) range for nominal distance along\r\n */\r\n public static createWesternAustralian(\r\n localToWorld: Transform,\r\n nominalL1: number,\r\n nominalR1: number,\r\n activeInterval?: Segment1d): DirectSpiral3d | undefined {\r\n return this.createTruncatedClothoid(\"WesternAustralian\", localToWorld, 2, 1, undefined, nominalL1, nominalR1, activeInterval);\r\n }\r\n /**\r\n * Create (if possible) a DirectSpiral3d, applying various strict conditions appropriate to the spiral type.\r\n * The parameter list includes extraneous values in order to directly match IntegratedSpiral3d.create, which has greater flexibility about\r\n * mixtures of values.\r\n * * IMPORTANT RESTRICTIONS\r\n * * Direct spirals must have the inflection at the origin of their coordinate system, aligned with the x axis.\r\n * * hence bearing0 = 0\r\n * * hence radius0 = 0\r\n * * bearing1 is ignored\r\n * * radius1 must be given.\r\n * * arcLength must be given,\r\n * @param spiralType one of the types in `DirectSpiralTypeNames`\r\n * @param radius0 radius (or 0 for tangent to line) at start. Must be ZERO or UNDEFINED\r\n * @param radius1 radius (or 0 for tangent to line) at end.\r\n * @param bearing0 bearing, measured CCW from x axis at start. Must be ZERO or UNDEFINED\r\n * @param bearing1 bearing, measured CCW from x axis at end. IGNORED.\r\n * @param fractionInterval optional fractional interval for an \"active\" portion of the curve. if omitted, the full [0,1] is used.\r\n * @param localToWorld placement transform\r\n */\r\n public static createFromLengthAndRadius(\r\n spiralType: string,\r\n radius0: number | undefined,\r\n radius1: number | undefined,\r\n bearing0: Angle | undefined,\r\n _bearing1: Angle | undefined,\r\n arcLength: number | undefined,\r\n activeInterval: undefined | Segment1d,\r\n localToWorld: Transform): TransitionSpiral3d | undefined {\r\n if (bearing0 !== undefined && !bearing0.isAlmostZero)\r\n return undefined;\r\n if (radius0 !== undefined && !Geometry.isSmallMetricDistance(radius0))\r\n return undefined;\r\n if (radius1 === undefined || Geometry.isSmallMetricDistance(radius1))\r\n return undefined;\r\n if (arcLength === undefined)\r\n return undefined;\r\n if (Geometry.equalStringNoCase(spiralType, \"Arema\"))\r\n return this.createArema(localToWorld, arcLength, radius1, activeInterval);\r\n if (Geometry.equalStringNoCase(spiralType, \"ChineseCubic\"))\r\n return this.createChineseCubic(localToWorld, arcLength, radius1, activeInterval);\r\n if (Geometry.equalStringNoCase(spiralType, \"JapaneseCubic\"))\r\n return this.createJapaneseCubic(localToWorld, arcLength, radius1, activeInterval);\r\n if (Geometry.equalStringNoCase(spiralType, \"HalfCosine\"))\r\n return this.createDirectHalfCosine(localToWorld, arcLength, radius1, activeInterval);\r\n if (Geometry.equalStringNoCase(spiralType, \"Czech\"))\r\n return this.createCzechCubic(localToWorld, arcLength, radius1, activeInterval);\r\n if (Geometry.equalStringNoCase(spiralType, \"Italian\"))\r\n return this.createItalian(localToWorld, arcLength, radius1, activeInterval);\r\n if (Geometry.equalStringNoCase(spiralType, \"AustralianRailCorp\"))\r\n return this.createAustralianRail(localToWorld, arcLength, radius1, activeInterval);\r\n if (Geometry.equalStringNoCase(spiralType, \"MXCubicAlongArc\"))\r\n return this.createMXCubicAlongArc(localToWorld, arcLength, radius1, activeInterval);\r\n if (Geometry.equalStringNoCase(spiralType, \"WesternAustralian\"))\r\n return this.createWesternAustralian(localToWorld, arcLength, radius1, activeInterval);\r\n if (Geometry.equalStringNoCase(spiralType, \"PolishCubic\"))\r\n return this.createPolishCubic(localToWorld, arcLength, radius1, activeInterval);\r\n return undefined;\r\n }\r\n /** Deep clone of this spiral */\r\n public override clone(): DirectSpiral3d {\r\n return new DirectSpiral3d(\r\n this.localToWorld.clone(),\r\n this._spiralType,\r\n this.designProperties?.clone(),\r\n this._nominalL1,\r\n this._nominalR1,\r\n this._activeFractionInterval?.clone(),\r\n this._evaluator.clone());\r\n }\r\n\r\n /** apply `transform` to this spiral's local to world transform. */\r\n public tryTransformInPlace(transformA: Transform): boolean {\r\n const rigidData = this.applyRigidPartOfTransform(transformA);\r\n if (rigidData !== undefined) {\r\n this._nominalL1 *= rigidData.scale;\r\n this._nominalR1 *= rigidData.scale;\r\n this.evaluator.scaleInPlace(rigidData.scale);\r\n }\r\n this.refreshComputedProperties();\r\n return true;\r\n }\r\n\r\n /** Return the spiral start point. */\r\n public override startPoint(): Point3d { return this.activeStrokes.startPoint(); }\r\n /** return the spiral end point. */\r\n public override endPoint(): Point3d { return this.activeStrokes.endPoint(); }\r\n /** test if the local to world transform places the spiral xy plane into `plane` */\r\n public isInPlane(plane: Plane3dByOriginAndUnitNormal): boolean {\r\n return plane.isPointInPlane(this.localToWorld.origin as Point3d)\r\n && Geometry.isSameCoordinate(0.0, this.localToWorld.matrix.dotColumnX(plane.getNormalRef()))\r\n && Geometry.isSameCoordinate(0.0, this.localToWorld.matrix.dotColumnY(plane.getNormalRef()));\r\n }\r\n /** Return quick length of the spiral.\r\n * The tangent vector of a true clothoid is length 1 everywhere, so simple proportion of nominalL1 is a good approximation.\r\n */\r\n public quickLength() {\r\n const distanceData = this._globalStrokes.packedUVParams!;\r\n const n = distanceData.length;\r\n return distanceData.getYAtUncheckedPointIndex(n - 1);\r\n }\r\n /** Return length of the spiral.\r\n * * True length is stored at back of uvParams . . .\r\n */\r\n // use the generic integrator ... public override curveLength() { return this.quickLength(); }\r\n /** Test if `other` is an instance of `TransitionSpiral3d` */\r\n public isSameGeometryClass(other: any): boolean { return other instanceof DirectSpiral3d; }\r\n /** Add strokes from this spiral to `dest`.\r\n * * Linestrings will usually stroke as just their points.\r\n * * If maxEdgeLength is given, this will sub-stroke within the linestring -- not what we want.\r\n */\r\n public emitStrokes(dest: LineString3d, options?: StrokeOptions): void { this.activeStrokes.emitStrokes(dest, options); }\r\n /** emit stroke fragments to `dest` handler. */\r\n public emitStrokableParts(dest: IStrokeHandler, options?: StrokeOptions): void {\r\n const n = this.computeStrokeCountForOptions(options);\r\n const activeStrokes = this.activeStrokes;\r\n dest.startParentCurvePrimitive(this);\r\n if (n <= activeStrokes.numPoints()) {\r\n // this.activeStrokes.emitStrokableParts(dest, options);\r\n dest.announceIntervalForUniformStepStrokes(this, 2 * activeStrokes.numPoints(), 0.0, 1.0);\r\n } else {\r\n dest.announceIntervalForUniformStepStrokes(this, n, 0.0, 1.0);\r\n }\r\n dest.endParentCurvePrimitive(this);\r\n }\r\n\r\n /**\r\n * return the stroke count required for given options.\r\n * @param options StrokeOptions that determine count\r\n */\r\n\r\n public computeStrokeCountForOptions(options?: StrokeOptions): number {\r\n let numStroke;\r\n const nominalRadians = this._nominalL1 / (2.0 * this._nominalR1);\r\n if (options) {\r\n const rMin = Math.abs(this._nominalR1);\r\n numStroke = options.applyTolerancesToArc(rMin, nominalRadians);\r\n numStroke = options.applyMaxEdgeLength(numStroke, this.quickLength());\r\n numStroke = options.applyMinStrokesPerPrimitive(numStroke);\r\n } else {\r\n numStroke = StrokeOptions.applyAngleTol(undefined, 4, nominalRadians, 0.02);\r\n }\r\n numStroke = Math.ceil(this._activeFractionInterval.absoluteDelta() * numStroke);\r\n return numStroke;\r\n }\r\n\r\n /** Reverse the active interval and active strokes.\r\n * * Primary defining data remains unchanged !!!\r\n */\r\n\r\n public reverseInPlace(): void {\r\n this._activeFractionInterval.reverseInPlace();\r\n if (this._activeStrokes === undefined)\r\n this._activeStrokes = this._globalStrokes.clone();\r\n this._activeStrokes.reverseInPlace();\r\n }\r\n /** Evaluate curve point with respect to fraction. */\r\n public fractionToPoint(activeFraction: number, result?: Point3d): Point3d {\r\n const globalFraction = this._activeFractionInterval.fractionToPoint(activeFraction);\r\n result = this._evaluator.fractionToPoint(globalFraction, result);\r\n this.localToWorld.multiplyPoint3d(result, result);\r\n return result;\r\n }\r\n /** Evaluate curve point and derivative with respect to fraction. */\r\n public fractionToPointAndDerivative(activeFraction: number, result?: Ray3d): Ray3d {\r\n const globalFraction = this._activeFractionInterval.fractionToPoint(activeFraction);\r\n result = this._evaluator.fractionToPointAndDerivative(globalFraction, result);\r\n result.direction.scaleInPlace(this._activeFractionInterval.signedDelta());\r\n result.transformInPlace(this.localToWorld);\r\n return result;\r\n }\r\n\r\n /** Return a plane with\r\n *\r\n * * origin at fractional position along the curve\r\n * * vectorU is the first derivative, i.e. tangent vector with length equal to the rate of change with respect to the fraction.\r\n * * vectorV is the second derivative, i.e.derivative of vectorU.\r\n */\r\n\r\n public fractionToPointAnd2Derivatives(activeFraction: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors | undefined {\r\n const globalFraction = this._activeFractionInterval.fractionToPoint(activeFraction);\r\n result = this._evaluator.fractionToPointAnd2Derivatives(globalFraction, result);\r\n const a = this._activeFractionInterval.signedDelta();\r\n result.vectorU.scaleInPlace(a);\r\n result.vectorV.scaleInPlace(a * a);\r\n result.transformInPlace(this.localToWorld);\r\n return result;\r\n }\r\n /** Second step of double dispatch: call `handler.handleTransitionSpiral(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleTransitionSpiral(this);\r\n }\r\n /** compare various coordinate quantities */\r\n public override isAlmostEqual(other: any): boolean {\r\n if (other instanceof DirectSpiral3d) {\r\n return Geometry.isSameCoordinate(this._nominalL1, other._nominalL1)\r\n && Geometry.isSameCoordinate(this._nominalR1, other._nominalR1)\r\n && this.localToWorld.isAlmostEqual(other.localToWorld)\r\n && this._activeFractionInterval.isAlmostEqual(other._activeFractionInterval)\r\n && this._evaluator.isAlmostEqual(other._evaluator);\r\n }\r\n return false;\r\n }\r\n}\r\n"]}
|
|
@@ -16,13 +16,42 @@ export declare class GrowableBlockedArray {
|
|
|
16
16
|
* * If viewing the array as a two dimensional array, this is the row size.
|
|
17
17
|
*/
|
|
18
18
|
protected _blockSize: number;
|
|
19
|
-
|
|
19
|
+
/**
|
|
20
|
+
* multiplier used by ensureBlockCapacity to expand requested reallocation size
|
|
21
|
+
*/
|
|
22
|
+
protected _growthFactor: number;
|
|
23
|
+
/**
|
|
24
|
+
* Construct an array whose contents are in blocked (row-major) order, possibly with extra capacity.
|
|
25
|
+
* * Total capacity is `this._data.length`
|
|
26
|
+
* * Actual in-use count is `this._inUse * this._blockSize`
|
|
27
|
+
* @param blockSize number of entries in each block, i.e., row size
|
|
28
|
+
* @param initialBlocks initial capacity in blocks (default 8)
|
|
29
|
+
* @param growthFactor used by ensureBlockCapacity to expand requested reallocation size (default 1.5)
|
|
30
|
+
*/
|
|
31
|
+
constructor(blockSize: number, initialBlocks?: number, growthFactor?: number);
|
|
32
|
+
/** Copy data from source array. Does not reallocate or change active block count.
|
|
33
|
+
* @param source array to copy from
|
|
34
|
+
* @param sourceCount copy the first sourceCount blocks; all blocks if undefined
|
|
35
|
+
* @param destOffset copy to instance array starting at this block index; zero if undefined
|
|
36
|
+
* @return count and offset of blocks copied
|
|
37
|
+
*/
|
|
38
|
+
protected copyData(source: Float64Array | number[], sourceCount?: number, destOffset?: number): {
|
|
39
|
+
count: number;
|
|
40
|
+
offset: number;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Make a copy of the (active) blocks in this array.
|
|
44
|
+
* (The clone does NOT get excess capacity)
|
|
45
|
+
*/
|
|
46
|
+
clone(): GrowableBlockedArray;
|
|
47
|
+
/** computed property: length (in blocks, not doubles) */
|
|
48
|
+
get length(): number;
|
|
20
49
|
/** computed property: length (in blocks, not doubles) */
|
|
21
50
|
get numBlocks(): number;
|
|
22
51
|
/** property: number of data values per block */
|
|
23
52
|
get numPerBlock(): number;
|
|
24
53
|
/**
|
|
25
|
-
* Return a single value indexed within a block
|
|
54
|
+
* Return a single value indexed within a block. Indices are unchecked.
|
|
26
55
|
* @param blockIndex index of block to read
|
|
27
56
|
* @param indexInBlock offset within the block
|
|
28
57
|
*/
|
|
@@ -32,7 +61,7 @@ export declare class GrowableBlockedArray {
|
|
|
32
61
|
/** Return the capacity in blocks (not doubles) */
|
|
33
62
|
blockCapacity(): number;
|
|
34
63
|
/** ensure capacity (in blocks, not doubles) */
|
|
35
|
-
ensureBlockCapacity(blockCapacity: number): void;
|
|
64
|
+
ensureBlockCapacity(blockCapacity: number, applyGrowthFactor?: boolean): void;
|
|
36
65
|
/** Add a new block of data.
|
|
37
66
|
* * If newData has fewer than numPerBlock entries, the remaining part of the new block is zeros.
|
|
38
67
|
* * If newData has more entries, only the first numPerBlock are taken.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GrowableBlockedArray.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/GrowableBlockedArray.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEjE;;;;GAIG;AACH,qBAAa,oBAAoB;IAC/B,+CAA+C;IAC/C,SAAS,CAAC,KAAK,EAAE,YAAY,CAAC;IAC9B,6CAA6C;IAC7C,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,SAAS,CAAC,UAAU,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"GrowableBlockedArray.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/GrowableBlockedArray.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEjE;;;;GAIG;AACH,qBAAa,oBAAoB;IAC/B,+CAA+C;IAC/C,SAAS,CAAC,KAAK,EAAE,YAAY,CAAC;IAC9B,6CAA6C;IAC7C,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,SAAS,CAAC,UAAU,EAAE,MAAM,CAAC;IAC7B;;OAEG;IACH,SAAS,CAAC,aAAa,EAAE,MAAM,CAAC;IAEhC;;;;;;;OAOG;gBACgB,SAAS,EAAE,MAAM,EAAE,aAAa,GAAE,MAAU,EAAE,YAAY,CAAC,EAAE,MAAM;IAOtF;;;;;OAKG;IACH,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,EAAE,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC;IA2B/H;;;OAGG;IACI,KAAK,IAAI,oBAAoB;IAOpC,yDAAyD;IACzD,IAAW,MAAM,IAAI,MAAM,CAAwB;IACnD,yDAAyD;IACzD,IAAW,SAAS,IAAI,MA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ockedArray {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Construct an array whose contents are in blocked (row-major) order, possibly with extra capacity.
|
|
19
|
+
* * Total capacity is `this._data.length`
|
|
20
|
+
* * Actual in-use count is `this._inUse * this._blockSize`
|
|
21
|
+
* @param blockSize number of entries in each block, i.e., row size
|
|
22
|
+
* @param initialBlocks initial capacity in blocks (default 8)
|
|
23
|
+
* @param growthFactor used by ensureBlockCapacity to expand requested reallocation size (default 1.5)
|
|
24
|
+
*/
|
|
25
|
+
constructor(blockSize, initialBlocks = 8, growthFactor) {
|
|
22
26
|
this._data = new Float64Array(initialBlocks * blockSize);
|
|
23
27
|
this._inUse = 0;
|
|
24
|
-
this._blockSize = blockSize;
|
|
28
|
+
this._blockSize = blockSize > 0 ? blockSize : 1;
|
|
29
|
+
this._growthFactor = (undefined !== growthFactor && growthFactor >= 1.0) ? growthFactor : 1.5;
|
|
30
|
+
}
|
|
31
|
+
/** Copy data from source array. Does not reallocate or change active block count.
|
|
32
|
+
* @param source array to copy from
|
|
33
|
+
* @param sourceCount copy the first sourceCount blocks; all blocks if undefined
|
|
34
|
+
* @param destOffset copy to instance array starting at this block index; zero if undefined
|
|
35
|
+
* @return count and offset of blocks copied
|
|
36
|
+
*/
|
|
37
|
+
copyData(source, sourceCount, destOffset) {
|
|
38
|
+
// validate inputs and convert from blocks to entries
|
|
39
|
+
let myOffset = (undefined !== destOffset) ? destOffset * this.numPerBlock : 0;
|
|
40
|
+
if (myOffset < 0)
|
|
41
|
+
myOffset = 0;
|
|
42
|
+
if (myOffset >= this._data.length)
|
|
43
|
+
return { count: 0, offset: 0 };
|
|
44
|
+
let myCount = (undefined !== sourceCount) ? sourceCount * this.numPerBlock : source.length;
|
|
45
|
+
if (myCount > 0) {
|
|
46
|
+
if (myCount > source.length)
|
|
47
|
+
myCount = source.length;
|
|
48
|
+
if (myOffset + myCount > this._data.length)
|
|
49
|
+
myCount = this._data.length - myOffset;
|
|
50
|
+
if (myCount % this.numPerBlock !== 0)
|
|
51
|
+
myCount -= myCount % this.numPerBlock;
|
|
52
|
+
}
|
|
53
|
+
if (myCount <= 0)
|
|
54
|
+
return { count: 0, offset: 0 };
|
|
55
|
+
if (myCount === source.length)
|
|
56
|
+
this._data.set(source, myOffset);
|
|
57
|
+
else if (source instanceof Float64Array)
|
|
58
|
+
this._data.set(source.subarray(0, myCount), myOffset);
|
|
59
|
+
else
|
|
60
|
+
this._data.set(source.slice(0, myCount), myOffset);
|
|
61
|
+
return { count: myCount / this.numPerBlock, offset: myOffset / this.numPerBlock };
|
|
25
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* Make a copy of the (active) blocks in this array.
|
|
65
|
+
* (The clone does NOT get excess capacity)
|
|
66
|
+
*/
|
|
67
|
+
clone() {
|
|
68
|
+
const newBlocks = new GrowableBlockedArray(this.numPerBlock, this.numBlocks, this._growthFactor);
|
|
69
|
+
newBlocks.copyData(this._data, this.numBlocks);
|
|
70
|
+
newBlocks._inUse = this.numBlocks;
|
|
71
|
+
return newBlocks;
|
|
72
|
+
}
|
|
73
|
+
/** computed property: length (in blocks, not doubles) */
|
|
74
|
+
get length() { return this._inUse; }
|
|
26
75
|
/** computed property: length (in blocks, not doubles) */
|
|
27
76
|
get numBlocks() { return this._inUse; }
|
|
28
77
|
/** property: number of data values per block */
|
|
29
78
|
get numPerBlock() { return this._blockSize; }
|
|
30
79
|
/**
|
|
31
|
-
* Return a single value indexed within a block
|
|
80
|
+
* Return a single value indexed within a block. Indices are unchecked.
|
|
32
81
|
* @param blockIndex index of block to read
|
|
33
82
|
* @param indexInBlock offset within the block
|
|
34
83
|
*/
|
|
@@ -42,13 +91,13 @@ class GrowableBlockedArray {
|
|
|
42
91
|
return this._data.length / this._blockSize;
|
|
43
92
|
}
|
|
44
93
|
/** ensure capacity (in blocks, not doubles) */
|
|
45
|
-
ensureBlockCapacity(blockCapacity) {
|
|
94
|
+
ensureBlockCapacity(blockCapacity, applyGrowthFactor = true) {
|
|
46
95
|
if (blockCapacity > this.blockCapacity()) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
this.
|
|
96
|
+
if (applyGrowthFactor)
|
|
97
|
+
blockCapacity *= this._growthFactor;
|
|
98
|
+
const prevData = this._data;
|
|
99
|
+
this._data = new Float64Array(blockCapacity * this._blockSize);
|
|
100
|
+
this.copyData(prevData, this._inUse);
|
|
52
101
|
}
|
|
53
102
|
}
|
|
54
103
|
/** Add a new block of data.
|
|
@@ -73,7 +122,7 @@ class GrowableBlockedArray {
|
|
|
73
122
|
newBlockIndex() {
|
|
74
123
|
const index = this._blockSize * this._inUse;
|
|
75
124
|
if ((index + 1) > this._data.length)
|
|
76
|
-
this.ensureBlockCapacity(1 +
|
|
125
|
+
this.ensureBlockCapacity(1 + this._inUse);
|
|
77
126
|
this._inUse++;
|
|
78
127
|
for (let i = index; i < index + this._blockSize; i++)
|
|
79
128
|
this._data[i] = 0.0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GrowableBlockedArray.js","sourceRoot":"","sources":["../../../src/geometry3d/GrowableBlockedArray.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAIH;;;;GAIG;AACH,MAAa,oBAAoB;IAS/B,YAAmB,SAAiB,EAAE,gBAAwB,CAAC;QAC7D;;;WAGG;QACH,IAAI,CAAC,KAAK,GAAG,IAAI,YAAY,CAAC,aAAa,GAAG,SAAS,CAAC,CAAC;QACzD,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAChB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAC9B,CAAC;IACD,yDAAyD;IACzD,IAAW,SAAS,KAAa,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IACtD,gDAAgD;IAChD,IAAW,WAAW,KAAa,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IAC5D;;;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AI,EAAE,GAAG,IAAI,CAAC,uBAAuB,CAAC,WAAW,CAAC,CAAC;QACnD,IAAI,EAAE,GAAG,IAAI,CAAC,uBAAuB,CAAC,WAAW,CAAC,CAAC;QACnD,IAAI,CAAC,GAAG,CAAC,CAAC;QACV,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC,EAAE,EAAE;YACxC,CAAC,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;YAC5B,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;SACb;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACvB,CAAC;IAED,2HAA2H;IACpH,wBAAwB,CAAC,WAAmB,EAAE,WAAmB,EAAE,MAAc,EAAE,IAAY;QACpG,IAAI,EAAE,GAAG,GAAG,CAAC;QACb,MAAM,EAAE,GAAG,IAAI,CAAC,uBAAuB,CAAC,WAAW,CAAC,CAAC;QACrD,MAAM,EAAE,GAAG,IAAI,CAAC,uBAAuB,CAAC,WAAW,CAAC,CAAC;QACrD,IAAI,CAAC,GAAG,CAAC,CAAC;QACV,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,KAAK,IAAI,CAAC,GAAG,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE;YAClC,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;YAChC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;SACb;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACvB,CAAC;CACF;AAvJD,oDAuJC","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 ArraysAndInterfaces\r\n */\r\n\r\nimport { BlockComparisonFunction } from \"./GrowableFloat64Array\";\r\n\r\n/**\r\n * Array of contiguous doubles, indexed by block number and index within block.\r\n * * This is essentially a rectangular matrix (two dimensional array), with each block being a row of the matrix.\r\n * @public\r\n */\r\nexport class GrowableBlockedArray {\r\n /** underlying contiguous, oversized buffer. */\r\n protected _data: Float64Array;\r\n /** Number of blocks (matrix rows) in use. */\r\n protected _inUse: number;\r\n /** number of numbers per block in the array.\r\n * * If viewing the array as a two dimensional array, this is the row size.\r\n */\r\n protected _blockSize: number; // positive integer !!!\r\n public constructor(blockSize: number, initialBlocks: number = 8) {\r\n /** array contents in blocked (row-major) order, possibly with extra capacity\r\n * Total capacity is `this._data.length`\r\n * Actual in-use count is `this._inUse * this._blockSize`\r\n */\r\n this._data = new Float64Array(initialBlocks * blockSize);\r\n this._inUse = 0;\r\n this._blockSize = blockSize;\r\n }\r\n /** computed property: length (in blocks, not doubles) */\r\n public get numBlocks(): number { return this._inUse; }\r\n /** property: number of data values per block */\r\n public get numPerBlock(): number { return this._blockSize; }\r\n /**\r\n * Return a single value indexed within a block\r\n * @param blockIndex index of block to read\r\n * @param indexInBlock offset within the block\r\n */\r\n public getWithinBlock(blockIndex: number, indexWithinBlock: number): number {\r\n return this._data[blockIndex * this._blockSize + indexWithinBlock];\r\n }\r\n /** clear the block count to zero, but maintain the allocated memory */\r\n public clear() { this._inUse = 0; }\r\n /** Return the capacity in blocks (not doubles) */\r\n public blockCapacity() {\r\n return this._data.length / this._blockSize;\r\n }\r\n /** ensure capacity (in blocks, not doubles) */\r\n public ensureBlockCapacity(blockCapacity: number) {\r\n if (blockCapacity > this.blockCapacity()) {\r\n const newData = new Float64Array(blockCapacity * this._blockSize);\r\n for (let i = 0; i < this._data.length; i++) {\r\n newData[i] = this._data[i];\r\n }\r\n this._data = newData;\r\n }\r\n }\r\n /** Add a new block of data.\r\n * * If newData has fewer than numPerBlock entries, the remaining part of the new block is zeros.\r\n * * If newData has more entries, only the first numPerBlock are taken.\r\n */\r\n public addBlock(newData: number[]) {\r\n const k0 = this.newBlockIndex();\r\n let numValue = newData.length;\r\n if (numValue > this._blockSize)\r\n numValue = this._blockSize;\r\n for (let i = 0; i < numValue; i++)\r\n this._data[k0 + i] = newData[i];\r\n }\r\n /**\r\n * Return the starting index of a block of (zero-initialized) doubles at the end.\r\n *\r\n * * this.data is reallocated if needed to include the new block.\r\n * * The inUse count is incremented to include the new block.\r\n * * The returned block is an index to the Float64Array (not a block index)\r\n */\r\n protected newBlockIndex(): number {\r\n const index = this._blockSize * this._inUse;\r\n if ((index + 1) > this._data.length)\r\n this.ensureBlockCapacity(1 + 2 * this._inUse);\r\n this._inUse++;\r\n for (let i = index; i < index + this._blockSize; i++)\r\n this._data[i] = 0.0;\r\n return index;\r\n }\r\n /** reduce the block count by one. */\r\n public popBlock() {\r\n if (this._inUse > 0)\r\n this._inUse--;\r\n }\r\n /** convert a block index to the simple index to the underlying Float64Array. */\r\n protected blockIndexToDoubleIndex(blockIndex: number) { return this._blockSize * blockIndex; }\r\n /** Access a single double at offset within a block, with index checking and return undefined if indexing is invalid. */\r\n public checkedComponent(blockIndex: number, componentIndex: number): number | undefined {\r\n if (blockIndex >= this._inUse || blockIndex < 0 || componentIndex < 0 || componentIndex >= this._blockSize)\r\n return undefined;\r\n return this._data[this._blockSize * blockIndex + componentIndex];\r\n }\r\n /** Access a single double at offset within a block. This has no index checking. */\r\n public component(blockIndex: number, componentIndex: number): number {\r\n return this._data[this._blockSize * blockIndex + componentIndex];\r\n }\r\n /** compare two blocks in simple lexical order.\r\n * @param data data array\r\n * @param blockSize number of items to compare\r\n * @param ia raw index (not block index) of first block\r\n * @param ib raw index (not block index) of second block\r\n */\r\n public static compareLexicalBlock(data: Float64Array, blockSize: number, ia: number, ib: number): number {\r\n let ax = 0;\r\n let bx = 0;\r\n for (let i = 0; i < blockSize; i++) {\r\n ax = data[ia + i];\r\n bx = data[ib + i];\r\n if (ax > bx) return 1;\r\n if (ax < bx) return -1;\r\n }\r\n return ia - ib; // so original order is maintained among duplicates !!!!\r\n }\r\n /** Return an array of block indices sorted per compareLexicalBlock function */\r\n public sortIndicesLexical(compareBlocks: BlockComparisonFunction = GrowableBlockedArray.compareLexicalBlock): Uint32Array {\r\n const n = this._inUse;\r\n // let numCompare = 0;\r\n const result = new Uint32Array(n);\r\n const data = this._data;\r\n const blockSize = this._blockSize;\r\n for (let i = 0; i < n; i++)result[i] = i;\r\n result.sort(\r\n (blockIndexA: number, blockIndexB: number) => {\r\n // numCompare++;\r\n return compareBlocks(data, blockSize, blockIndexA * blockSize, blockIndexB * blockSize);\r\n });\r\n // console.log (n, numCompare);\r\n return result;\r\n }\r\n /** Return the distance (hypotenuse=sqrt(summed squares)) between indicated blocks */\r\n public distanceBetweenBlocks(blockIndexA: number, blockIndexB: number): number {\r\n let dd = 0.0;\r\n let iA = this.blockIndexToDoubleIndex(blockIndexA);\r\n let iB = this.blockIndexToDoubleIndex(blockIndexB);\r\n let a = 0;\r\n const data = this._data;\r\n for (let i = 0; i < this._blockSize; i++) {\r\n a = data[iA++] - data[iB++];\r\n dd += a * a;\r\n }\r\n return Math.sqrt(dd);\r\n }\r\n\r\n /** Return the distance (hypotenuse=sqrt(summed squares)) between block entries `iBegin <= i < iEnd` of indicated blocks */\r\n public distanceBetweenSubBlocks(blockIndexA: number, blockIndexB: number, iBegin: number, iEnd: number): number {\r\n let dd = 0.0;\r\n const iA = this.blockIndexToDoubleIndex(blockIndexA);\r\n const iB = this.blockIndexToDoubleIndex(blockIndexB);\r\n let a = 0;\r\n const data = this._data;\r\n for (let i = iBegin; i < iEnd; i++) {\r\n a = data[iA + i] - data[iB + i];\r\n dd += a * a;\r\n }\r\n return Math.sqrt(dd);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"GrowableBlockedArray.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C,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;SACb;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACvB,CAAC;CACF;AAhND,oDAgNC","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 ArraysAndInterfaces\r\n */\r\n\r\nimport { BlockComparisonFunction } from \"./GrowableFloat64Array\";\r\n\r\n/**\r\n * Array of contiguous doubles, indexed by block number and index within block.\r\n * * This is essentially a rectangular matrix (two dimensional array), with each block being a row of the matrix.\r\n * @public\r\n */\r\nexport class GrowableBlockedArray {\r\n /** underlying contiguous, oversized buffer. */\r\n protected _data: Float64Array;\r\n /** Number of blocks (matrix rows) in use. */\r\n protected _inUse: number;\r\n /** number of numbers per block in the array.\r\n * * If viewing the array as a two dimensional array, this is the row size.\r\n */\r\n protected _blockSize: number; // positive integer !!!\r\n /**\r\n * multiplier used by ensureBlockCapacity to expand requested reallocation size\r\n */\r\n protected _growthFactor: number;\r\n\r\n /**\r\n * Construct an array whose contents are in blocked (row-major) order, possibly with extra capacity.\r\n * * Total capacity is `this._data.length`\r\n * * Actual in-use count is `this._inUse * this._blockSize`\r\n * @param blockSize number of entries in each block, i.e., row size\r\n * @param initialBlocks initial capacity in blocks (default 8)\r\n * @param growthFactor used by ensureBlockCapacity to expand requested reallocation size (default 1.5)\r\n */\r\n public constructor(blockSize: number, initialBlocks: number = 8, growthFactor?: number) {\r\n this._data = new Float64Array(initialBlocks * blockSize);\r\n this._inUse = 0;\r\n this._blockSize = blockSize > 0 ? blockSize : 1;\r\n this._growthFactor = (undefined !== growthFactor && growthFactor >= 1.0) ? growthFactor : 1.5;\r\n }\r\n\r\n /** Copy data from source array. Does not reallocate or change active block count.\r\n * @param source array to copy from\r\n * @param sourceCount copy the first sourceCount blocks; all blocks if undefined\r\n * @param destOffset copy to instance array starting at this block index; zero if undefined\r\n * @return count and offset of blocks copied\r\n */\r\n protected copyData(source: Float64Array | number[], sourceCount?: number, destOffset?: number): {count: number, offset: number} {\r\n // validate inputs and convert from blocks to entries\r\n let myOffset = (undefined !== destOffset) ? destOffset * this.numPerBlock : 0;\r\n if (myOffset < 0)\r\n myOffset = 0;\r\n if (myOffset >= this._data.length)\r\n return {count: 0, offset: 0};\r\n let myCount = (undefined !== sourceCount) ? sourceCount * this.numPerBlock : source.length;\r\n if (myCount > 0) {\r\n if (myCount > source.length)\r\n myCount = source.length;\r\n if (myOffset + myCount > this._data.length)\r\n myCount = this._data.length - myOffset;\r\n if (myCount % this.numPerBlock !== 0)\r\n myCount -= myCount % this.numPerBlock;\r\n }\r\n if (myCount <= 0)\r\n return {count: 0, offset: 0};\r\n if (myCount === source.length)\r\n this._data.set(source, myOffset);\r\n else if (source instanceof Float64Array)\r\n this._data.set(source.subarray(0, myCount), myOffset);\r\n else\r\n this._data.set(source.slice(0, myCount), myOffset);\r\n return {count: myCount / this.numPerBlock, offset: myOffset / this.numPerBlock};\r\n }\r\n\r\n /**\r\n * Make a copy of the (active) blocks in this array.\r\n * (The clone does NOT get excess capacity)\r\n */\r\n public clone(): GrowableBlockedArray {\r\n const newBlocks = new GrowableBlockedArray(this.numPerBlock, this.numBlocks, this._growthFactor);\r\n newBlocks.copyData(this._data, this.numBlocks);\r\n newBlocks._inUse = this.numBlocks;\r\n return newBlocks;\r\n }\r\n\r\n /** computed property: length (in blocks, not doubles) */\r\n public get length(): number { return this._inUse; }\r\n /** computed property: length (in blocks, not doubles) */\r\n public get numBlocks(): number { return this._inUse; }\r\n /** property: number of data values per block */\r\n public get numPerBlock(): number { return this._blockSize; }\r\n /**\r\n * Return a single value indexed within a block. Indices are unchecked.\r\n * @param blockIndex index of block to read\r\n * @param indexInBlock offset within the block\r\n */\r\n public getWithinBlock(blockIndex: number, indexWithinBlock: number): number {\r\n return this._data[blockIndex * this._blockSize + indexWithinBlock];\r\n }\r\n /** clear the block count to zero, but maintain the allocated memory */\r\n public clear() { this._inUse = 0; }\r\n /** Return the capacity in blocks (not doubles) */\r\n public blockCapacity() {\r\n return this._data.length / this._blockSize;\r\n }\r\n /** ensure capacity (in blocks, not doubles) */\r\n public ensureBlockCapacity(blockCapacity: number, applyGrowthFactor: boolean = true) {\r\n if (blockCapacity > this.blockCapacity()) {\r\n if (applyGrowthFactor)\r\n blockCapacity *= this._growthFactor;\r\n const prevData = this._data;\r\n this._data = new Float64Array(blockCapacity * this._blockSize);\r\n this.copyData(prevData, this._inUse);\r\n }\r\n }\r\n /** Add a new block of data.\r\n * * If newData has fewer than numPerBlock entries, the remaining part of the new block is zeros.\r\n * * If newData has more entries, only the first numPerBlock are taken.\r\n */\r\n public addBlock(newData: number[]) {\r\n const k0 = this.newBlockIndex();\r\n let numValue = newData.length;\r\n if (numValue > this._blockSize)\r\n numValue = this._blockSize;\r\n for (let i = 0; i < numValue; i++)\r\n this._data[k0 + i] = newData[i];\r\n }\r\n /**\r\n * Return the starting index of a block of (zero-initialized) doubles at the end.\r\n *\r\n * * this.data is reallocated if needed to include the new block.\r\n * * The inUse count is incremented to include the new block.\r\n * * The returned block is an index to the Float64Array (not a block index)\r\n */\r\n protected newBlockIndex(): number {\r\n const index = this._blockSize * this._inUse;\r\n if ((index + 1) > this._data.length)\r\n this.ensureBlockCapacity(1 + this._inUse);\r\n this._inUse++;\r\n for (let i = index; i < index + this._blockSize; i++)\r\n this._data[i] = 0.0;\r\n return index;\r\n }\r\n /** reduce the block count by one. */\r\n public popBlock() {\r\n if (this._inUse > 0)\r\n this._inUse--;\r\n }\r\n /** convert a block index to the simple index to the underlying Float64Array. */\r\n protected blockIndexToDoubleIndex(blockIndex: number) { return this._blockSize * blockIndex; }\r\n /** Access a single double at offset within a block, with index checking and return undefined if indexing is invalid. */\r\n public checkedComponent(blockIndex: number, componentIndex: number): number | undefined {\r\n if (blockIndex >= this._inUse || blockIndex < 0 || componentIndex < 0 || componentIndex >= this._blockSize)\r\n return undefined;\r\n return this._data[this._blockSize * blockIndex + componentIndex];\r\n }\r\n /** Access a single double at offset within a block. This has no index checking. */\r\n public component(blockIndex: number, componentIndex: number): number {\r\n return this._data[this._blockSize * blockIndex + componentIndex];\r\n }\r\n /** compare two blocks in simple lexical order.\r\n * @param data data array\r\n * @param blockSize number of items to compare\r\n * @param ia raw index (not block index) of first block\r\n * @param ib raw index (not block index) of second block\r\n */\r\n public static compareLexicalBlock(data: Float64Array, blockSize: number, ia: number, ib: number): number {\r\n let ax = 0;\r\n let bx = 0;\r\n for (let i = 0; i < blockSize; i++) {\r\n ax = data[ia + i];\r\n bx = data[ib + i];\r\n if (ax > bx) return 1;\r\n if (ax < bx) return -1;\r\n }\r\n return ia - ib; // so original order is maintained among duplicates !!!!\r\n }\r\n /** Return an array of block indices sorted per compareLexicalBlock function */\r\n public sortIndicesLexical(compareBlocks: BlockComparisonFunction = GrowableBlockedArray.compareLexicalBlock): Uint32Array {\r\n const n = this._inUse;\r\n // let numCompare = 0;\r\n const result = new Uint32Array(n);\r\n const data = this._data;\r\n const blockSize = this._blockSize;\r\n for (let i = 0; i < n; i++)result[i] = i;\r\n result.sort(\r\n (blockIndexA: number, blockIndexB: number) => {\r\n // numCompare++;\r\n return compareBlocks(data, blockSize, blockIndexA * blockSize, blockIndexB * blockSize);\r\n });\r\n // console.log (n, numCompare);\r\n return result;\r\n }\r\n /** Return the distance (hypotenuse=sqrt(summed squares)) between indicated blocks */\r\n public distanceBetweenBlocks(blockIndexA: number, blockIndexB: number): number {\r\n let dd = 0.0;\r\n let iA = this.blockIndexToDoubleIndex(blockIndexA);\r\n let iB = this.blockIndexToDoubleIndex(blockIndexB);\r\n let a = 0;\r\n const data = this._data;\r\n for (let i = 0; i < this._blockSize; i++) {\r\n a = data[iA++] - data[iB++];\r\n dd += a * a;\r\n }\r\n return Math.sqrt(dd);\r\n }\r\n\r\n /** Return the distance (hypotenuse=sqrt(summed squares)) between block entries `iBegin <= i < iEnd` of indicated blocks */\r\n public distanceBetweenSubBlocks(blockIndexA: number, blockIndexB: number, iBegin: number, iEnd: number): number {\r\n let dd = 0.0;\r\n const iA = this.blockIndexToDoubleIndex(blockIndexA);\r\n const iB = this.blockIndexToDoubleIndex(blockIndexB);\r\n let a = 0;\r\n const data = this._data;\r\n for (let i = iBegin; i < iEnd; i++) {\r\n a = data[iA + i] - data[iB + i];\r\n dd += a * a;\r\n }\r\n return Math.sqrt(dd);\r\n }\r\n}\r\n"]}
|
|
@@ -23,7 +23,22 @@ export declare type BlockComparisonFunction = (data: Float64Array, blockSize: nu
|
|
|
23
23
|
export declare class GrowableFloat64Array {
|
|
24
24
|
private _data;
|
|
25
25
|
private _inUse;
|
|
26
|
-
|
|
26
|
+
private _growthFactor;
|
|
27
|
+
/** Construct a GrowableFloat64Array.
|
|
28
|
+
* @param initialCapacity initial capacity (default 8)
|
|
29
|
+
* @param growthFactor used by ensureCapacity to expand requested reallocation size (default 1.5)
|
|
30
|
+
*/
|
|
31
|
+
constructor(initialCapacity?: number, growthFactor?: number);
|
|
32
|
+
/** Copy data from source array. Does not reallocate or change active entry count.
|
|
33
|
+
* @param source array to copy from
|
|
34
|
+
* @param sourceCount copy the first sourceCount entries; all entries if undefined
|
|
35
|
+
* @param destOffset copy to instance array starting at this index; zero if undefined
|
|
36
|
+
* @return count and offset of entries copied
|
|
37
|
+
*/
|
|
38
|
+
protected copyData(source: Float64Array | number[], sourceCount?: number, destOffset?: number): {
|
|
39
|
+
count: number;
|
|
40
|
+
offset: number;
|
|
41
|
+
};
|
|
27
42
|
/**
|
|
28
43
|
* Create a GrowableFloat64Array with given contents.
|
|
29
44
|
* @param contents data to copy into the array
|
|
@@ -74,7 +89,7 @@ export declare class GrowableFloat64Array {
|
|
|
74
89
|
* @param data array of values to push
|
|
75
90
|
*/
|
|
76
91
|
pushArray(data: Float64Array | number[]): void;
|
|
77
|
-
/** Push
|
|
92
|
+
/** Push `numToCopy` consecutive values starting at `copyFromIndex`. */
|
|
78
93
|
pushBlockCopy(copyFromIndex: number, numToCopy: number): void;
|
|
79
94
|
/** Clear the array to 0 length. The underlying memory remains allocated for reuse. */
|
|
80
95
|
clear(): void;
|
|
@@ -84,14 +99,15 @@ export declare class GrowableFloat64Array {
|
|
|
84
99
|
*/
|
|
85
100
|
capacity(): number;
|
|
86
101
|
/**
|
|
87
|
-
* * If the capacity (Float64Array length) is less than or equal to the requested newCapacity, do nothing
|
|
88
|
-
* * If the requested newCapacity is larger than the existing capacity, reallocate
|
|
89
|
-
* @param newCapacity
|
|
102
|
+
* * If the capacity (Float64Array length) is less than or equal to the requested newCapacity, do nothing.
|
|
103
|
+
* * If the requested newCapacity is larger than the existing capacity, reallocate to larger capacity, and copy existing values.
|
|
104
|
+
* @param newCapacity size of new array
|
|
105
|
+
* @param applyGrowthFactor whether to apply the growth factor to newCapacity when reallocating
|
|
90
106
|
*/
|
|
91
|
-
ensureCapacity(newCapacity: number): void;
|
|
107
|
+
ensureCapacity(newCapacity: number, applyGrowthFactor?: boolean): void;
|
|
92
108
|
/**
|
|
93
|
-
* * If newLength is less than current
|
|
94
|
-
* * If newLength is greater,
|
|
109
|
+
* * If newLength is less than current length, just reset current length to newLength, effectively trimming active entries but preserving original capacity.
|
|
110
|
+
* * If newLength is greater than current length, reallocate to (exactly) newLength, copy existing entries, and pad with padValue up to newLength.
|
|
95
111
|
* @param newLength new data count
|
|
96
112
|
* @param padValue value to use for padding if the length increases.
|
|
97
113
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GrowableFloat64Array.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/GrowableFloat64Array.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH;;;GAGG;AACH,oBAAY,4BAA4B,GAAG,oBAAoB,GAAG,SAAS,CAAC;AAC5E;;;GAGG;AACH,oBAAY,uBAAuB,GAAG,CAAC,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,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