@itwin/core-geometry 3.4.0-dev.55 → 3.4.0-dev.56
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/Query/PlanarSubdivision.d.ts.map +1 -1
- package/lib/cjs/curve/Query/PlanarSubdivision.js +16 -4
- package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
- package/lib/cjs/geometry3d/AngleSweep.d.ts +1 -1
- package/lib/cjs/geometry3d/AngleSweep.js +1 -1
- package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
- package/lib/cjs/numerics/ClusterableArray.d.ts +4 -4
- package/lib/cjs/numerics/ClusterableArray.js +5 -5
- package/lib/cjs/numerics/ClusterableArray.js.map +1 -1
- package/lib/cjs/topology/Graph.d.ts +3 -3
- package/lib/cjs/topology/Graph.d.ts.map +1 -1
- package/lib/cjs/topology/Graph.js +2 -2
- package/lib/cjs/topology/Graph.js.map +1 -1
- package/lib/cjs/topology/Merging.d.ts +5 -1
- package/lib/cjs/topology/Merging.d.ts.map +1 -1
- package/lib/cjs/topology/Merging.js +27 -15
- package/lib/cjs/topology/Merging.js.map +1 -1
- package/lib/esm/curve/Query/PlanarSubdivision.d.ts.map +1 -1
- package/lib/esm/curve/Query/PlanarSubdivision.js +16 -4
- package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
- package/lib/esm/geometry3d/AngleSweep.d.ts +1 -1
- package/lib/esm/geometry3d/AngleSweep.js +1 -1
- package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
- package/lib/esm/numerics/ClusterableArray.d.ts +4 -4
- package/lib/esm/numerics/ClusterableArray.js +5 -5
- package/lib/esm/numerics/ClusterableArray.js.map +1 -1
- package/lib/esm/topology/Graph.d.ts +3 -3
- package/lib/esm/topology/Graph.d.ts.map +1 -1
- package/lib/esm/topology/Graph.js +2 -2
- package/lib/esm/topology/Graph.js.map +1 -1
- package/lib/esm/topology/Merging.d.ts +5 -1
- package/lib/esm/topology/Merging.d.ts.map +1 -1
- package/lib/esm/topology/Merging.js +27 -15
- package/lib/esm/topology/Merging.js.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlanarSubdivision.d.ts","sourceRoot":"","sources":["../../../../src/curve/Query/PlanarSubdivision.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PlanarSubdivision.d.ts","sourceRoot":"","sources":["../../../../src/curve/Query/PlanarSubdivision.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAG/D,OAAO,EAAuB,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAsB,WAAW,EAAE,MAAM,SAAS,CAAC;AAqDhE;;GAEG;AACH,qBAAa,iBAAiB;WACd,qBAAqB,CAAC,WAAW,EAAE,cAAc,EAAE,EAAE,QAAQ,EAAE,uBAAuB,EAAE,GAAG,aAAa;IA+BxH;;;;;;;;;OASG;IACD,OAAO,CAAC,MAAM,CAAC,WAAW;WAeZ,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,iBAAiB,GAAE,MAAgB,GAAG,MAAM;WAepG,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,EAC/C,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,IAAI,KAAK,IAAI,GAAG,IAAI;IAsB7E,OAAO,CAAC,MAAM,CAAC,UAAU;IAYzB,OAAO,CAAC,MAAM,CAAC,eAAe;WAWhB,oCAAoC,CAAC,KAAK,EAAE,aAAa,EAAE,iBAAiB,GAAE,MAAgB,GAAG,WAAW,EAAE;CAmC7H"}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PlanarSubdivision = void 0;
|
|
4
|
+
/*---------------------------------------------------------------------------------------------
|
|
5
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
6
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
7
|
+
*--------------------------------------------------------------------------------------------*/
|
|
8
|
+
const Geometry_1 = require("../../Geometry");
|
|
4
9
|
const Graph_1 = require("../../topology/Graph");
|
|
5
10
|
const HalfEdgeGraphSearch_1 = require("../../topology/HalfEdgeGraphSearch");
|
|
6
11
|
const Merging_1 = require("../../topology/Merging");
|
|
@@ -155,12 +160,19 @@ class PlanarSubdivision {
|
|
|
155
160
|
} while (he !== faceSeed);
|
|
156
161
|
return loop;
|
|
157
162
|
}
|
|
158
|
-
//
|
|
159
|
-
// In a line-only graph, this is a null-area face.
|
|
163
|
+
// Return true if there are only two edges in the face loop, and their start curvatures are the same.
|
|
160
164
|
static isNullFace(he) {
|
|
161
|
-
|
|
165
|
+
const faceHasTwoEdges = (he.faceSuccessor.faceSuccessor === he);
|
|
166
|
+
let faceIsBanana = false;
|
|
167
|
+
if (faceHasTwoEdges) {
|
|
168
|
+
const c0 = Merging_1.HalfEdgeGraphMerge.curvatureSortKey(he);
|
|
169
|
+
const c1 = Merging_1.HalfEdgeGraphMerge.curvatureSortKey(he.faceSuccessor.edgeMate);
|
|
170
|
+
if (!Geometry_1.Geometry.isSameCoordinate(c0, c1)) // default tol!
|
|
171
|
+
faceIsBanana = true; // heuristic: we could also check end curvatures, and/or higher derivatives...
|
|
172
|
+
}
|
|
173
|
+
return faceHasTwoEdges && !faceIsBanana;
|
|
162
174
|
}
|
|
163
|
-
// Look
|
|
175
|
+
// Look across edge mates (possibly several) for a nonnull mate face.
|
|
164
176
|
static nonNullEdgeMate(_graph, e) {
|
|
165
177
|
if (this.isNullFace(e))
|
|
166
178
|
return undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version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;IACtB,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { Point3d } from \"../../geometry3d/Point3dVector3d\";\nimport { HalfEdge, HalfEdgeGraph } from \"../../topology/Graph\";\nimport { HalfEdgeGraphSearch } from \"../../topology/HalfEdgeGraphSearch\";\nimport { HalfEdgeGraphMerge } from \"../../topology/Merging\";\nimport { CurveLocationDetail, CurveLocationDetailPair } from \"../CurveLocationDetail\";\nimport { CurvePrimitive } from \"../CurvePrimitive\";\nimport { Loop, LoopCurveLoopCurve, SignedLoops } from \"../Loop\";\nimport { RegionOps } from \"../RegionOps\";\n\n/** @packageDocumentation\n * @module Curve\n */\n\nclass MapCurvePrimitiveToCurveLocatioNDetailPairArray {\n public primitiveToPair = new Map<CurvePrimitive, CurveLocationDetailPair[]>();\n // index assigned to this primitive for this calculation.\n public primitiveToIndex = new Map<CurvePrimitive, number>();\n private _numIndexedPrimitives: number = 0;\n public assignPrimitiveIndex(primitive: CurvePrimitive | undefined) {\n if (primitive !== undefined) {\n const index = this.primitiveToIndex.get(primitive);\n if (index === undefined) {\n this.primitiveToIndex.set(primitive, this._numIndexedPrimitives++);\n }\n }\n }\n public insertPrimitiveToPair(primitive: CurvePrimitive | undefined, pair: CurveLocationDetailPair) {\n if (primitive) {\n const priorPairs = this.primitiveToPair.get(primitive);\n this.assignPrimitiveIndex(primitive);\n if (!priorPairs) {\n this.primitiveToPair.set(primitive, [pair]);\n } else {\n priorPairs.push(pair);\n }\n }\n }\n public insertPair(pair: CurveLocationDetailPair) {\n const primitiveA = pair.detailA.curve;\n if (primitiveA)\n this.insertPrimitiveToPair(primitiveA, pair);\n const primitiveB = pair.detailB.curve;\n if (primitiveB)\n this.insertPrimitiveToPair(primitiveB, pair);\n }\n}\n/*\n function getDetailString(detail: CurveLocationDetail | undefined): string {\n if (!detail)\n return \"{}\";\n else return tagString(\"primitive\", this.primitiveToIndex.get(detail.curve!)) + tagString(\"f0\", detail.fraction) + tagString(\"f1\", detail.fraction1);\n }\n}\nfunction tagString(name: string, value: number | undefined): string {\n if (value !== undefined)\n return \"(\" + name + \" \" + value + \")\";\n return \"\";\n}\n*/\n/**\n * @internal\n */\nexport class PlanarSubdivision {\n public static assembleHalfEdgeGraph(_primitives: CurvePrimitive[], allPairs: CurveLocationDetailPair[]): HalfEdgeGraph {\n const detailByPrimitive = new MapCurvePrimitiveToCurveLocatioNDetailPairArray(); // map from key CurvePrimitive to CurveLocationDetailPair.\n for (const p of _primitives)\n detailByPrimitive.assignPrimitiveIndex(p);\n for (const pair of allPairs) {\n detailByPrimitive.insertPair(pair);\n }\n const graph = new HalfEdgeGraph();\n for (const entry of detailByPrimitive.primitiveToPair.entries()) {\n const p = entry[0];\n const details = entry[1];\n details.sort((pairA: CurveLocationDetailPair, pairB: CurveLocationDetailPair) => {\n const fractionA = getFractionOnCurve(pairA, p);\n const fractionB = getFractionOnCurve(pairB, p);\n if (fractionA === undefined || fractionB === undefined)\n return -1000.0;\n return fractionA - fractionB;\n });\n let detail0 = getDetailOnCurve(details[0], p)!;\n this.addHalfEdge(graph, p, p.startPoint (), 0.0, detail0.point, detail0.fraction);\n for (let i = 1; i < details.length; i++) {\n // create (both sides of) a graph edge . . .\n const detail1 = getDetailOnCurve(details[i], p)!;\n this.addHalfEdge(graph, p, detail0.point, detail0.fraction, detail1.point, detail1.fraction);\n detail0 = detail1;\n }\n this.addHalfEdge(graph, p, detail0.point, detail0.fraction, p.endPoint(), 1.0);\n }\n HalfEdgeGraphMerge.clusterAndMergeXYTheta(graph, (he: HalfEdge) => he.sortAngle!);\n return graph;\n }\n/**\n * Create a pair of mated half edges referencing an interval of a primitive\n * * no action if start and end points are identical.\n * @param graph containing graph.\n * @param p the curve\n * @param fraction0 starting fraction\n * @param point0 start point\n * @param fraction1 end fraction\n * @param point1 end point\n */\n private static addHalfEdge(graph: HalfEdgeGraph, p: CurvePrimitive, point0: Point3d, fraction0: number, point1: Point3d, fraction1: number) {\n if (!point0.isAlmostEqual (point1)){\n const halfEdge = graph.createEdgeXYAndZ(point0, 0, point1, 0);\n const detail01 = CurveLocationDetail.createCurveEvaluatedFractionFraction(p, fraction0, fraction1);\n const mate = halfEdge.edgeMate;\n halfEdge.edgeTag = detail01;\n halfEdge.sortData = 1.0;\n mate.edgeTag = detail01;\n mate.sortData = -1.0;\n halfEdge.sortAngle = sortAngle(detail01.curve!, detail01.fraction, false);\n mate.sortAngle = sortAngle(detail01.curve!, detail01.fraction1!, true);\n }\n }\n// based on computed (and toleranced) area, push the loop (pointer) onto the appropriate array of positive, negative, or sliver loops.\n // return the area (forced to zero if within tolerance)\n public static collectSignedLoop(loop: Loop, signedAreas: SignedLoops, zeroAreaTolerance: number = 1.0e-10): number{\n let area = RegionOps.computeXYArea(loop);\n if (area === undefined)\n area = 0;\n if (Math.abs(area) < zeroAreaTolerance)\n area = 0.0;\n (loop as any).computedAreaInPlanarSubdivision = area;\n if (area > 0)\n signedAreas.positiveAreaLoops.push(loop);\n else if (area < 0)\n signedAreas.negativeAreaLoops.push(loop);\n else\n signedAreas.slivers.push(loop);\n return area;\n }\n public static createLoopInFace(faceSeed: HalfEdge,\n announce?: (he: HalfEdge, curve: CurvePrimitive, loop: Loop) => void): Loop {\n let he = faceSeed;\n const loop = Loop.create();\n do {\n const detail = he.edgeTag as CurveLocationDetail;\n if (detail) {\n let curve;\n if (he.sortData! > 0)\n curve = detail.curve!.clonePartialCurve(detail.fraction, detail.fraction1!);\n else\n curve = detail.curve!.clonePartialCurve(detail.fraction1!, detail.fraction);\n if (curve) {\n if (announce !== undefined)\n announce(he, curve, loop);\n loop.tryAddChild(curve);\n }\n }\n he = he.faceSuccessor;\n } while (he !== faceSeed);\n return loop;\n }\n// return true if there are only two edges.\n // In a line-only graph, this is a null-area face.\n private static isNullFace(he: HalfEdge): boolean {\n return he.faceSuccessor.faceSuccessor === he;\n }\n // Look across edge mates (possibly several) for a nonnull mate face.\n private static nonNullEdgeMate(_graph: HalfEdgeGraph, e: HalfEdge): HalfEdge | undefined {\n if (this.isNullFace (e))\n return undefined;\n let e1 = e.edgeMate;\n while (this.isNullFace(e1)){\n e1 = e1.faceSuccessor.edgeMate;\n if (e1 === e)\n return undefined;\n }\n return e1;\n }\n public static collectSignedLoopSetsInHalfEdgeGraph(graph: HalfEdgeGraph, zeroAreaTolerance: number = 1.0e-10): SignedLoops[] {\n const q = HalfEdgeGraphSearch.collectConnectedComponentsWithExteriorParityMasks(graph, undefined);\n const result: SignedLoops[] = [];\n const edgeMap = new Map<HalfEdge, LoopCurveLoopCurve>();\n for (const faceSeeds of q) {\n const componentAreas: SignedLoops = { positiveAreaLoops: [], negativeAreaLoops: [], slivers: [] };\n const edges: LoopCurveLoopCurve[] = [];\n for (const faceSeed of faceSeeds) {\n const loop = this.createLoopInFace(faceSeed, (he: HalfEdge, curveC: CurvePrimitive, loopC: Loop) => {\n if (this.isNullFace(he)) {\n // Ignore all edges of null faces.\n } else {\n const mate = this.nonNullEdgeMate(graph, he);\n if (mate !== undefined){\n const e = edgeMap.get(mate);\n if (e === undefined) {\n // Record this as loopA,edgeA of a shared edge to be completed later from the other side of the edge\n const e1 = new LoopCurveLoopCurve(loopC, curveC, undefined, undefined);\n edgeMap.set(he, e1);\n } else if (e instanceof LoopCurveLoopCurve) {\n e.setB(loopC, curveC);\n edges.push(e);\n edgeMap.delete(mate);\n }\n }\n }\n });\n this.collectSignedLoop(loop, componentAreas, zeroAreaTolerance);\n }\n componentAreas.edges = edges;\n result.push(componentAreas);\n edgeMap.clear();\n }\n return result;\n }\n}\n\nfunction sortAngle(curve: CurvePrimitive, fraction: number, reverse: boolean): number {\n const ray = curve.fractionToPointAndDerivative(fraction);\n const s = reverse ? -1.0 : 1.0;\n return Math.atan2(s * ray.direction.y, s * ray.direction.x);\n}\n\nfunction getFractionOnCurve(pair: CurveLocationDetailPair, curve: CurvePrimitive): number | undefined {\n if (pair.detailA.curve === curve)\n return pair.detailA.fraction;\n if (pair.detailB.curve === curve)\n return pair.detailB.fraction;\n return undefined;\n}\nfunction getDetailOnCurve(pair: CurveLocationDetailPair, curve: CurvePrimitive): CurveLocationDetail | undefined {\n if (pair.detailA.curve === curve)\n return pair.detailA;\n if (pair.detailB.curve === curve)\n return pair.detailB;\n return undefined;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"PlanarSubdivision.js","sourceRoot":"","sources":["../../../../src/curve/Query/PlanarSubdivision.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,6CAA0C;AAE1C,gDAA+D;AAC/D,4EAAyE;AACzE,oDAA4D;AAC5D,gEAAsF;AAEtF,kCAAgE;AAChE,4CAAyC;AAEzC;;GAEG;AAEH,MAAM,+CAA+C;IAArD;QACS,oBAAe,GAAG,IAAI,GAAG,EAA6C,CAAC;QAC9E,yDAAyD;QAClD,qBAAgB,GAAG,IAAI,GAAG,EAA0B,CAAC;QACpD,0BAAqB,GAAW,CAAC,CAAC;IA4B5C,CAAC;IA3BQ,oBAAoB,CAAC,SAAqC;QAC/D,IAAI,SAAS,KAAK,SAAS,EAAE;YAC3B,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;YACnD,IAAI,KAAK,KAAK,SAAS,EAAE;gBACvB,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,qBAAqB,EAAE,CAAC,CAAC;aACpE;SACF;IACH,CAAC;IACM,qBAAqB,CAAC,SAAqC,EAAE,IAA6B;QAC/F,IAAI,SAAS,EAAE;YACb,MAAM,UAAU,GAAG,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;YACvD,IAAI,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC;YACrC,IAAI,CAAC,UAAU,EAAE;gBACf,IAAI,CAAC,eAAe,CA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,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;IAC/B,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AAC9D,CAAC;AAED,SAAS,kBAAkB,CAAC,IAA6B,EAAE,KAAqB;IAC9E,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,KAAK,KAAK;QAC9B,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;IAC/B,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,KAAK,KAAK;QAC9B,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;IAC/B,OAAO,SAAS,CAAC;AACnB,CAAC;AACD,SAAS,gBAAgB,CAAC,IAA6B,EAAE,KAAqB;IAC5E,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,KAAK,KAAK;QAC9B,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,KAAK,KAAK;QAC9B,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { Geometry } from \"../../Geometry\";\nimport { Point3d } from \"../../geometry3d/Point3dVector3d\";\nimport { HalfEdge, HalfEdgeGraph } from \"../../topology/Graph\";\nimport { HalfEdgeGraphSearch } from \"../../topology/HalfEdgeGraphSearch\";\nimport { HalfEdgeGraphMerge } from \"../../topology/Merging\";\nimport { CurveLocationDetail, CurveLocationDetailPair } from \"../CurveLocationDetail\";\nimport { CurvePrimitive } from \"../CurvePrimitive\";\nimport { Loop, LoopCurveLoopCurve, SignedLoops } from \"../Loop\";\nimport { RegionOps } from \"../RegionOps\";\n\n/** @packageDocumentation\n * @module Curve\n */\n\nclass MapCurvePrimitiveToCurveLocatioNDetailPairArray {\n public primitiveToPair = new Map<CurvePrimitive, CurveLocationDetailPair[]>();\n // index assigned to this primitive for this calculation.\n public primitiveToIndex = new Map<CurvePrimitive, number>();\n private _numIndexedPrimitives: number = 0;\n public assignPrimitiveIndex(primitive: CurvePrimitive | undefined) {\n if (primitive !== undefined) {\n const index = this.primitiveToIndex.get(primitive);\n if (index === undefined) {\n this.primitiveToIndex.set(primitive, this._numIndexedPrimitives++);\n }\n }\n }\n public insertPrimitiveToPair(primitive: CurvePrimitive | undefined, pair: CurveLocationDetailPair) {\n if (primitive) {\n const priorPairs = this.primitiveToPair.get(primitive);\n this.assignPrimitiveIndex(primitive);\n if (!priorPairs) {\n this.primitiveToPair.set(primitive, [pair]);\n } else {\n priorPairs.push(pair);\n }\n }\n }\n public insertPair(pair: CurveLocationDetailPair) {\n const primitiveA = pair.detailA.curve;\n if (primitiveA)\n this.insertPrimitiveToPair(primitiveA, pair);\n const primitiveB = pair.detailB.curve;\n if (primitiveB)\n this.insertPrimitiveToPair(primitiveB, pair);\n }\n}\n/*\n function getDetailString(detail: CurveLocationDetail | undefined): string {\n if (!detail)\n return \"{}\";\n else return tagString(\"primitive\", this.primitiveToIndex.get(detail.curve!)) + tagString(\"f0\", detail.fraction) + tagString(\"f1\", detail.fraction1);\n }\n}\nfunction tagString(name: string, value: number | undefined): string {\n if (value !== undefined)\n return \"(\" + name + \" \" + value + \")\";\n return \"\";\n}\n*/\n/**\n * @internal\n */\nexport class PlanarSubdivision {\n public static assembleHalfEdgeGraph(_primitives: CurvePrimitive[], allPairs: CurveLocationDetailPair[]): HalfEdgeGraph {\n const detailByPrimitive = new MapCurvePrimitiveToCurveLocatioNDetailPairArray(); // map from key CurvePrimitive to CurveLocationDetailPair.\n for (const p of _primitives)\n detailByPrimitive.assignPrimitiveIndex(p);\n for (const pair of allPairs) {\n detailByPrimitive.insertPair(pair);\n }\n const graph = new HalfEdgeGraph();\n for (const entry of detailByPrimitive.primitiveToPair.entries()) {\n const p = entry[0];\n const details = entry[1];\n details.sort((pairA: CurveLocationDetailPair, pairB: CurveLocationDetailPair) => {\n const fractionA = getFractionOnCurve(pairA, p);\n const fractionB = getFractionOnCurve(pairB, p);\n if (fractionA === undefined || fractionB === undefined)\n return -1000.0;\n return fractionA - fractionB;\n });\n let detail0 = getDetailOnCurve(details[0], p)!;\n this.addHalfEdge(graph, p, p.startPoint (), 0.0, detail0.point, detail0.fraction);\n for (let i = 1; i < details.length; i++) {\n // create (both sides of) a graph edge . . .\n const detail1 = getDetailOnCurve(details[i], p)!;\n this.addHalfEdge(graph, p, detail0.point, detail0.fraction, detail1.point, detail1.fraction);\n detail0 = detail1;\n }\n this.addHalfEdge(graph, p, detail0.point, detail0.fraction, p.endPoint(), 1.0);\n }\n HalfEdgeGraphMerge.clusterAndMergeXYTheta(graph, (he: HalfEdge) => he.sortAngle!);\n return graph;\n }\n/**\n * Create a pair of mated half edges referencing an interval of a primitive\n * * no action if start and end points are identical.\n * @param graph containing graph.\n * @param p the curve\n * @param fraction0 starting fraction\n * @param point0 start point\n * @param fraction1 end fraction\n * @param point1 end point\n */\n private static addHalfEdge(graph: HalfEdgeGraph, p: CurvePrimitive, point0: Point3d, fraction0: number, point1: Point3d, fraction1: number) {\n if (!point0.isAlmostEqual (point1)){\n const halfEdge = graph.createEdgeXYAndZ(point0, 0, point1, 0);\n const detail01 = CurveLocationDetail.createCurveEvaluatedFractionFraction(p, fraction0, fraction1);\n const mate = halfEdge.edgeMate;\n halfEdge.edgeTag = detail01;\n halfEdge.sortData = 1.0;\n mate.edgeTag = detail01;\n mate.sortData = -1.0;\n halfEdge.sortAngle = sortAngle(detail01.curve!, detail01.fraction, false);\n mate.sortAngle = sortAngle(detail01.curve!, detail01.fraction1!, true);\n }\n }\n// based on computed (and toleranced) area, push the loop (pointer) onto the appropriate array of positive, negative, or sliver loops.\n // return the area (forced to zero if within tolerance)\n public static collectSignedLoop(loop: Loop, signedAreas: SignedLoops, zeroAreaTolerance: number = 1.0e-10): number{\n let area = RegionOps.computeXYArea(loop);\n if (area === undefined)\n area = 0;\n if (Math.abs(area) < zeroAreaTolerance)\n area = 0.0;\n (loop as any).computedAreaInPlanarSubdivision = area;\n if (area > 0)\n signedAreas.positiveAreaLoops.push(loop);\n else if (area < 0)\n signedAreas.negativeAreaLoops.push(loop);\n else\n signedAreas.slivers.push(loop);\n return area;\n }\n public static createLoopInFace(faceSeed: HalfEdge,\n announce?: (he: HalfEdge, curve: CurvePrimitive, loop: Loop) => void): Loop {\n let he = faceSeed;\n const loop = Loop.create();\n do {\n const detail = he.edgeTag as CurveLocationDetail;\n if (detail) {\n let curve;\n if (he.sortData! > 0)\n curve = detail.curve!.clonePartialCurve(detail.fraction, detail.fraction1!);\n else\n curve = detail.curve!.clonePartialCurve(detail.fraction1!, detail.fraction);\n if (curve) {\n if (announce !== undefined)\n announce(he, curve, loop);\n loop.tryAddChild(curve);\n }\n }\n he = he.faceSuccessor;\n } while (he !== faceSeed);\n return loop;\n }\n // Return true if there are only two edges in the face loop, and their start curvatures are the same.\n private static isNullFace(he: HalfEdge): boolean {\n const faceHasTwoEdges = (he.faceSuccessor.faceSuccessor === he);\n let faceIsBanana = false;\n if (faceHasTwoEdges) {\n const c0 = HalfEdgeGraphMerge.curvatureSortKey(he);\n const c1 = HalfEdgeGraphMerge.curvatureSortKey(he.faceSuccessor.edgeMate);\n if (!Geometry.isSameCoordinate(c0, c1)) // default tol!\n faceIsBanana = true; // heuristic: we could also check end curvatures, and/or higher derivatives...\n }\n return faceHasTwoEdges && !faceIsBanana;\n }\n // Look across edge mates (possibly several) for a nonnull mate face.\n private static nonNullEdgeMate(_graph: HalfEdgeGraph, e: HalfEdge): HalfEdge | undefined {\n if (this.isNullFace (e))\n return undefined;\n let e1 = e.edgeMate;\n while (this.isNullFace(e1)){\n e1 = e1.faceSuccessor.edgeMate;\n if (e1 === e)\n return undefined;\n }\n return e1;\n }\n public static collectSignedLoopSetsInHalfEdgeGraph(graph: HalfEdgeGraph, zeroAreaTolerance: number = 1.0e-10): SignedLoops[] {\n const q = HalfEdgeGraphSearch.collectConnectedComponentsWithExteriorParityMasks(graph, undefined);\n const result: SignedLoops[] = [];\n const edgeMap = new Map<HalfEdge, LoopCurveLoopCurve>();\n for (const faceSeeds of q) {\n const componentAreas: SignedLoops = { positiveAreaLoops: [], negativeAreaLoops: [], slivers: [] };\n const edges: LoopCurveLoopCurve[] = [];\n for (const faceSeed of faceSeeds) {\n const loop = this.createLoopInFace(faceSeed, (he: HalfEdge, curveC: CurvePrimitive, loopC: Loop) => {\n if (this.isNullFace(he)) {\n // Ignore all edges of null faces.\n } else {\n const mate = this.nonNullEdgeMate(graph, he);\n if (mate !== undefined){\n const e = edgeMap.get(mate);\n if (e === undefined) {\n // Record this as loopA,edgeA of a shared edge to be completed later from the other side of the edge\n const e1 = new LoopCurveLoopCurve(loopC, curveC, undefined, undefined);\n edgeMap.set(he, e1);\n } else if (e instanceof LoopCurveLoopCurve) {\n e.setB(loopC, curveC);\n edges.push(e);\n edgeMap.delete(mate);\n }\n }\n }\n });\n this.collectSignedLoop(loop, componentAreas, zeroAreaTolerance);\n }\n componentAreas.edges = edges;\n result.push(componentAreas);\n edgeMap.clear();\n }\n return result;\n }\n}\n\nfunction sortAngle(curve: CurvePrimitive, fraction: number, reverse: boolean): number {\n const ray = curve.fractionToPointAndDerivative(fraction);\n const s = reverse ? -1.0 : 1.0;\n return Math.atan2(s * ray.direction.y, s * ray.direction.x);\n}\n\nfunction getFractionOnCurve(pair: CurveLocationDetailPair, curve: CurvePrimitive): number | undefined {\n if (pair.detailA.curve === curve)\n return pair.detailA.fraction;\n if (pair.detailB.curve === curve)\n return pair.detailB.fraction;\n return undefined;\n}\nfunction getDetailOnCurve(pair: CurveLocationDetailPair, curve: CurvePrimitive): CurveLocationDetail | undefined {\n if (pair.detailA.curve === curve)\n return pair.detailA;\n if (pair.detailB.curve === curve)\n return pair.detailB;\n return undefined;\n}\n"]}
|
|
@@ -82,7 +82,7 @@ export declare class AngleSweep implements BeJSONFunctions {
|
|
|
82
82
|
/** Reverse the start and end angle in place. */
|
|
83
83
|
reverseInPlace(): void;
|
|
84
84
|
/** return a sweep for the "other" part of the circe.
|
|
85
|
-
* @param
|
|
85
|
+
* @param reverseDirection true to retain the start and move backwards, false to more forwards.
|
|
86
86
|
*/
|
|
87
87
|
cloneComplement(reverseDirection?: boolean, result?: AngleSweep): AngleSweep;
|
|
88
88
|
/** Restrict start and end angles into the range (-90,+90) in degrees. */
|
|
@@ -124,7 +124,7 @@ class AngleSweep {
|
|
|
124
124
|
/** Reverse the start and end angle in place. */
|
|
125
125
|
reverseInPlace() { const a = this._radians0; this._radians0 = this._radians1; this._radians1 = a; }
|
|
126
126
|
/** return a sweep for the "other" part of the circe.
|
|
127
|
-
* @param
|
|
127
|
+
* @param reverseDirection true to retain the start and move backwards, false to more forwards.
|
|
128
128
|
*/
|
|
129
129
|
cloneComplement(reverseDirection = false, result) {
|
|
130
130
|
const s = this.sweepRadians >= 0 ? 2.0 : -2.0;
|
|
@@ -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;;;;;;;;;;;;GAYG;AACH,MAAa,UAAU;IA+BrB;;;;;;;;;OASG;IACH,YAAoB,eAAuB,CAAC,EAAE,aAAqB,CAAC,IAAI,IAAI,CAAC,SAAS,GAAG,YAAY,CAAC,CAAC,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,CAAC,CAAC;IAtCrI,iEAAiE;IACjE,IAAW,YAAY,KAAK,OAAO,aAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IAC5E,+DAA+D;IAC/D,IAAW,UAAU,KAA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tC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACzB,OAAO,MAAM,CAAC;IAChB,CAAC;IACD;;;OAGG;IACI,MAAM;QACX,4DAA4D;QAC5D,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IAC9C,CAAC;IACD,qHAAqH;IAC9G,6BAA6B,CAAC,KAAiB;QACpD,OAAO,aAAK,CAAC,oCAAoC,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC;eAC7E,aAAK,CAAC,iCAAiC,CAAC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC;IACnH,CAAC;IACD,uGAAuG;IAChG,0BAA0B,CAAC,KAAiB;QACjD,OAAO,aAAK,CAAC,iCAAiC,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC;eAC1E,aAAK,CAAC,iCAAiC,CAAC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC;IACnH,CAAC;IACD;;;;;;OAMG;IACI,aAAa,CAAC,KAAiB,IAAa,OAAO,IAAI,CAAC,0BAA0B,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;CACpG;AAjTD,gCAiTC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module CartesianGeometry\n */\n\nimport { AngleSweepProps, BeJSONFunctions, Geometry } from \"../Geometry\";\nimport { Angle } from \"./Angle\";\nimport { GrowableFloat64Array } from \"./GrowableFloat64Array\";\n\n/**\n * An `AngleSweep` is a pair of angles at start and end of an interval.\n *\n * * For stroking purposes, the \"included interval\" is all angles numerically reached by theta = start + f*(end-start), where f is between 0 and 1.\n * * This stroking formula is simple numbers -- 2PI shifts are not involved.\n * * 2PI shifts do become important in the reverse mapping of an angle to a fraction.\n * * If (start < end) the angle proceeds CCW around the unit circle.\n * * If (end < start) the angle proceeds CW around the unit circle.\n * * Angles beyond 360 are fine as endpoints.\n * * (350,370) covers the same unit angles as (-10,10).\n * * (370,350) covers the same unit angles as (10,-10).\n * @public\n */\nexport class AngleSweep implements BeJSONFunctions {\n private _radians0: number;\n private _radians1: number;\n /** Read-property for degrees at the start of this AngleSweep. */\n public get startDegrees() { return Angle.radiansToDegrees(this._radians0); }\n /** Read-property for degrees at the end of this AngleSweep. */\n public get endDegrees() { return Angle.radiansToDegrees(this._radians1); }\n /** Read-property for signed start-to-end sweep in degrees. */\n public get sweepDegrees() { return Angle.radiansToDegrees(this._radians1 - this._radians0); }\n /** Read-property for degrees at the start of this AngleSweep. */\n public get startRadians() { return this._radians0; }\n /** Read-property for degrees at the end of this AngleSweep. */\n public get endRadians() { return this._radians1; }\n /** Read-property for signed start-to-end sweep in radians. */\n public get sweepRadians() { return this._radians1 - this._radians0; }\n /** Return the (strongly typed) start angle */\n public get startAngle() { return Angle.createRadians(this._radians0); }\n /** Return the (strongly typed) end angle */\n public get endAngle() { return Angle.createRadians(this._radians1); }\n /** Create a sweep as one of\n * * A clone of a given sweep\n * * 0 to given angle\n * * full circle if no arg given (sweep 0 to 360 degrees)\n */\n public static create(data?: AngleSweep | Angle): AngleSweep {\n if (data instanceof AngleSweep)\n return data.clone();\n if (data instanceof Angle)\n return new AngleSweep(0, data.radians);\n return AngleSweep.create360();\n }\n /** (private) constructor with start and end angles in radians.\n * * Use explicitly named static methods to clarify intent and units of inputs:\n *\n * * createStartEndRadians (startRadians:number, endRadians:number)\n * * createStartEndDegrees (startDegrees:number, endDegrees:number)\n * * createStartEnd (startAngle:Angle, endAngle:Angle)\n * * createStartSweepRadians (startRadians:number, sweepRadians:number)\n * * createStartSweepDegrees (startDegrees:number, sweepDegrees:number)\n * * createStartSweep (startAngle:Angle, sweepAngle:Angle)\n */\n private constructor(startRadians: number = 0, endRadians: number = 0) { this._radians0 = startRadians; this._radians1 = endRadians; }\n /** create an AngleSweep from start and end angles given in radians. */\n public static createStartEndRadians(startRadians: number = 0, endRadians: number = 2.0 * Math.PI, result?: AngleSweep): AngleSweep {\n result = result ? result : new AngleSweep();\n result.setStartEndRadians(startRadians, endRadians);\n return result;\n }\n /** Return the angle obtained by subtracting radians from this angle. */\n public cloneMinusRadians(radians: number): AngleSweep { return new AngleSweep(this._radians0 - radians, this._radians1 - radians); }\n /** create an AngleSweep from start and end angles given in degrees. */\n public static createStartEndDegrees(startDegrees: number = 0, endDegrees: number = 360, result?: AngleSweep): AngleSweep {\n return AngleSweep.createStartEndRadians(Angle.degreesToRadians(startDegrees), Angle.degreesToRadians(endDegrees), result);\n }\n /** create an angle sweep from strongly typed start and end angles */\n public static createStartEnd(startAngle: Angle, endAngle: Angle, result?: AngleSweep): AngleSweep {\n result = result ? result : new AngleSweep();\n result.setStartEndRadians(startAngle.radians, endAngle.radians);\n return result;\n }\n /** Create an angle sweep with limits given as (strongly typed) angles for start and sweep */\n public static createStartSweep(startAngle: Angle, sweepAngle: Angle, result?: AngleSweep): AngleSweep {\n return AngleSweep.createStartSweepRadians(startAngle.radians, sweepAngle.radians, result);\n }\n /** Return a sweep with limits interpolated between this and other. */\n public interpolate(fraction: number, other: AngleSweep): AngleSweep {\n return new AngleSweep(Geometry.interpolate(this._radians0, fraction, other._radians0), Geometry.interpolate(this._radians1, fraction, other._radians1));\n }\n /** create an AngleSweep from start and end angles given in radians. */\n public static createStartSweepRadians(startRadians: number = 0, sweepRadians: number = Math.PI, result?: AngleSweep): AngleSweep {\n result = result ? result : new AngleSweep();\n result.setStartEndRadians(startRadians, startRadians + sweepRadians);\n return result;\n }\n /** create an AngleSweep from start and sweep given in degrees. */\n public static createStartSweepDegrees(startDegrees: number = 0, sweepDegrees: number = 360, result?: AngleSweep): AngleSweep {\n return AngleSweep.createStartEndRadians(Angle.degreesToRadians(startDegrees), Angle.degreesToRadians(startDegrees + sweepDegrees), result);\n }\n /** directly set the start and end angles in radians */\n public setStartEndRadians(startRadians: number = 0, endRadians: number = 2.0 * Math.PI) {\n const delta = endRadians - startRadians;\n if (Angle.isFullCircleRadians(delta)) {\n endRadians = startRadians + (delta > 0 ? 2.0 : -2.0) * Math.PI;\n }\n this._radians0 = startRadians;\n this._radians1 = endRadians;\n }\n /** directly set the start and end angles in degrees */\n public setStartEndDegrees(startDegrees: number = 0, endDegrees: number = 360.0) {\n this.setStartEndRadians(Angle.degreesToRadians(startDegrees), Angle.degreesToRadians(endDegrees));\n }\n /** copy from other AngleSweep. */\n public setFrom(other: AngleSweep) { this._radians0 = other._radians0; this._radians1 = other._radians1; }\n /** create a full circle sweep (CCW). startRadians defaults to 0 */\n public static create360(startRadians?: number): AngleSweep {\n startRadians = startRadians ? startRadians : 0.0;\n return new AngleSweep(startRadians, startRadians + 2.0 * Math.PI);\n }\n /** create a sweep from the south pole to the north pole. */\n public static createFullLatitude() { return AngleSweep.createStartEndRadians(-0.5 * Math.PI, 0.5 * Math.PI); }\n /** Reverse the start and end angle in place. */\n public reverseInPlace() { const a = this._radians0; this._radians0 = this._radians1; this._radians1 = a; }\n /** return a sweep for the \"other\" part of the circe.\n * @param reverse true to retain the start and move backwards, false to more forwards.\n */\n public cloneComplement(reverseDirection: boolean = false, result?: AngleSweep): AngleSweep {\n const s = this.sweepRadians >= 0 ? 2.0 : -2.0;\n if (reverseDirection)\n return AngleSweep.createStartEndRadians(this.startRadians, this.endRadians - s * Math.PI, result);\n else\n return AngleSweep.createStartEndRadians(this.endRadians, this.startRadians + s * Math.PI, result);\n }\n /** Restrict start and end angles into the range (-90,+90) in degrees. */\n public capLatitudeInPlace() {\n const limit = 0.5 * Math.PI;\n this._radians0 = Geometry.clampToStartEnd(this._radians0, -limit, limit);\n this._radians1 = Geometry.clampToStartEnd(this._radians1, -limit, limit);\n }\n /** Ask if the sweep is counterclockwise, i.e. positive sweep */\n public get isCCW(): boolean { return this._radians1 >= this._radians0; }\n /** Ask if the sweep is a full circle. */\n public get isFullCircle(): boolean { return Angle.isFullCircleRadians(this.sweepRadians); }\n /** Ask if the sweep is a full sweep from south pole to north pole. */\n public get isFullLatitudeSweep(): boolean {\n const a = Math.PI * 0.5;\n return Angle.isAlmostEqualRadiansNoPeriodShift(this._radians0, -a)\n && Angle.isAlmostEqualRadiansNoPeriodShift(this._radians1, a);\n }\n /** return a clone of this sweep. */\n public clone(): AngleSweep { return new AngleSweep(this._radians0, this._radians1); }\n /** Convert fractional position in the sweep to radians. */\n public fractionToRadians(fraction: number) {\n return fraction < 0.5 ?\n this._radians0 + fraction * (this._radians1 - this._radians0)\n : this._radians1 + (fraction - 1.0) * (this._radians1 - this._radians0);\n }\n /** Convert fractional position in the sweep to strongly typed Angle object. */\n public fractionToAngle(fraction: number) {\n return Angle.createRadians(this.fractionToRadians(fraction));\n }\n /** return 2PI divided by the sweep radians (i.e. 360 degrees divided by sweep angle).\n * This is the number of fractional intervals required to cover a whole circle.\n */\n public fractionPeriod(): number {\n return Geometry.safeDivideFraction(Math.PI * 2.0, Math.abs(this._radians1 - this._radians0), 1.0);\n }\n /** return the fractionalized position of the angle,\n * computed without consideration of 2PI period.\n * That is, an angle that is numerically much beyond than the end angle\n * will produce a large fraction and an angle much beyond the start angle\n * will produce a large negative fraction.\n *\n */\n public angleToUnboundedFraction(theta: Angle): number {\n return Geometry.safeDivideFraction(theta.radians - this._radians0, this._radians1 - this._radians0, 1.0);\n }\n /** map an angle to a fractional coordinate which is:\n *\n * * the start angle is at fraction 0\n * * the end angle is at fraction 1\n * * interior angles are between 0 and 1\n * * all exterior angles are at fractions greater than 1\n * * the periodic jump is at full wraparound to the start angle\n */\n public angleToPositivePeriodicFraction(theta: Angle): number { return this.radiansToPositivePeriodicFraction(theta.radians); }\n /**\n * Convert each value in an array from radians to fraction.\n * @param data array that is input as radians, output as fractions\n */\n public radiansArrayToPositivePeriodicFractions(data: GrowableFloat64Array) {\n const n = data.length;\n for (let i = 0; i < n; i++) {\n data.reassign(i, this.radiansToPositivePeriodicFraction(data.atUncheckedIndex(i)));\n }\n }\n /**\n * Convert a radians value to a fraction that is always positive and can wrap. See `angleToPositivePeriodicFraction` for detailed description.\n * @param radians\n */\n public radiansToPositivePeriodicFraction(radians: number, zeroSweepDefault: number = 0.0): number {\n return AngleSweep.radiansToPositivePeriodicFractionStartEnd(radians, this._radians0, this._radians1, zeroSweepDefault);\n }\n /**\n * Convert a radians value to a fraction that is always positive and can wrap. See `angleToPositivePeriodicFraction` for detailed description.\n * @param radians\n */\n public static radiansToPositivePeriodicFractionStartEnd(radians: number, radians0: number, radians1: number, zeroSweepDefault: number = 0.0): number {\n if (Angle.isAlmostEqualRadiansAllowPeriodShift(radians, radians0))\n return 0.0;\n if (Angle.isAlmostEqualRadiansAllowPeriodShift(radians, radians1))\n return 1.0;\n const sweep = radians1 - radians0;\n const delta = radians - radians0;\n if (sweep > 0) {\n const delta1 = Angle.adjustRadians0To2Pi(delta);\n const fraction1 = Geometry.safeDivideFraction(delta1, sweep, zeroSweepDefault);\n return fraction1;\n }\n const delta2 = Angle.adjustRadians0To2Pi(-delta);\n const fraction2 = Geometry.safeDivideFraction(delta2, -sweep, zeroSweepDefault);\n return fraction2;\n }\n /** map an angle to a fractional coordinate which is:\n *\n * * the start angle is at fraction 0\n * * the end angle is at fraction 1\n * * interior angles are between 0 and 1\n * * small negative for angles just \"before\" the start angle\n * * more than one for angles just \"after\" the end angle\n * * the periodic jump is at the middle of the \"outside\" interval\n */\n public angleToSignedPeriodicFraction(theta: Angle): number {\n return this.radiansToSignedPeriodicFraction(theta.radians);\n }\n /**\n * Convert a radians value to a fraction, allowing wraparound. See `angleToSignedPeriodicFraction` for detailed description.\n */\n public radiansToSignedPeriodicFraction(radians: number): number {\n if (Angle.isAlmostEqualRadiansAllowPeriodShift(radians, this._radians0))\n return 0.0;\n if (Angle.isAlmostEqualRadiansAllowPeriodShift(radians, this._radians1))\n return 1.0;\n const sweep = this._radians1 - this._radians0;\n // measure from middle of interval ...\n const delta = radians - this._radians0 - 0.5 * sweep;\n if (sweep > 0) {\n const delta1 = Angle.adjustRadiansMinusPiPlusPi(delta);\n const fraction1 = 0.5 + Geometry.safeDivideFraction(delta1, sweep, 0.0);\n return fraction1;\n }\n const delta2 = Angle.adjustRadiansMinusPiPlusPi(-delta);\n const fraction = 0.5 + Geometry.safeDivideFraction(delta2, -sweep, 0.0);\n return fraction;\n }\n /** test if an angle is within the sweep */\n public isAngleInSweep(angle: Angle): boolean { return this.isRadiansInSweep(angle.radians); }\n /** test if radians are within sweep */\n public isRadiansInSweep(radians: number, allowPeriodShift: boolean = true): boolean {\n return AngleSweep.isRadiansInStartEnd(radians, this.startRadians, this.endRadians, allowPeriodShift);\n }\n /** test if radians are within sweep */\n public static isRadiansInStartEnd(radians: number, radians0: number, radians1: number, allowPeriodShift: boolean = true): boolean {\n // quick out for simple inside ...\n const delta0 = radians - radians0;\n const delta1 = radians - radians1;\n if (delta0 * delta1 <= 0.0)\n return true;\n\n if (radians0 === radians1)\n return allowPeriodShift ? Angle.isAlmostEqualRadiansAllowPeriodShift(radians, radians0) : Angle.isAlmostEqualRadiansNoPeriodShift(radians, radians0);\n return allowPeriodShift ? this.radiansToPositivePeriodicFractionStartEnd(radians, radians0, radians1, 1000.0) <= 1.0 : false;\n }\n\n /** set this AngleSweep from various sources:\n *\n * * if json is undefined, a full-circle sweep is returned.\n * * If json is an AngleSweep object it is cloned\n * * If json is an array of 2 numbers, those numbers are start and end angles in degrees.\n * * If `json.degrees` is an array of 2 numbers, those numbers are start and end angles in degrees.\n * * If `json.radians` is an array of 2 numbers, those numbers are start and end angles in radians.\n */\n public setFromJSON(json?: any) {\n if (!json)\n this.setStartEndRadians(); // default full circle\n else if (json instanceof AngleSweep)\n this.setFrom(json);\n else if (Geometry.isNumberArray(json.degrees, 2))\n this.setStartEndDegrees(json.degrees[0], json.degrees[1]);\n else if (Geometry.isNumberArray(json.radians, 2))\n this.setStartEndRadians(json.radians[0], json.radians[1]);\n else if (Geometry.isNumberArray(json, 2))\n this.setStartEndDegrees(json[0], json[1]);\n }\n /** create an AngleSweep from a json object. */\n public static fromJSON(json?: AngleSweepProps) {\n const result = AngleSweep.create360();\n result.setFromJSON(json);\n return result;\n }\n /**\n * Convert an AngleSweep to a JSON object.\n * @return {*} {degrees: [startAngleInDegrees, endAngleInDegrees}\n */\n public toJSON(): any {\n // return { degrees: [this.startDegrees, this.endDegrees] };\n return [this.startDegrees, this.endDegrees];\n }\n /** test if start and end angles match, with explicit name to clarify that there is no test for 360-degree shifts. */\n public isAlmostEqualAllowPeriodShift(other: AngleSweep): boolean {\n return Angle.isAlmostEqualRadiansAllowPeriodShift(this._radians0, other._radians0)\n && Angle.isAlmostEqualRadiansNoPeriodShift(this._radians1 - this._radians0, other._radians1 - other._radians0);\n }\n /** test if start and end angles match, explicit name to clarify that 360-degree shifts are allowed. */\n public isAlmostEqualNoPeriodShift(other: AngleSweep): boolean {\n return Angle.isAlmostEqualRadiansNoPeriodShift(this._radians0, other._radians0)\n && Angle.isAlmostEqualRadiansNoPeriodShift(this._radians1 - this._radians0, other._radians1 - other._radians0);\n }\n /** test if start and end angles match with radians tolerance.\n * * This is equivalent to isAlmostEqualNoPeriodShift.\n * * it is present for consistency with other classes\n * * It is recommended that all callers use one of he longer names to be clear of their intentions:\n * * * isAlmostEqualAllowPeriodShift\n * * * isAlmostEqualRadiansNoPeriodShift\n */\n public isAlmostEqual(other: AngleSweep): boolean { return this.isAlmostEqualNoPeriodShift(other); }\n}\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;;;;;;;;;;;;GAYG;AACH,MAAa,UAAU;IA+BrB;;;;;;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,CAAC,CAAC,CAAC;aACvD,IAAI,mBAAQ,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC;YACtC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9C,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,4DAA4D;QAC5D,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IAC9C,CAAC;IACD,qHAAqH;IAC9G,6BAA6B,CAAC,KAAiB;QACpD,OAAO,aAAK,CAAC,oCAAoC,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC;eAC7E,aAAK,CAAC,iCAAiC,CAAC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC;IACnH,CAAC;IACD,uGAAuG;IAChG,0BAA0B,CAAC,KAAiB;QACjD,OAAO,aAAK,CAAC,iCAAiC,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC;eAC1E,aAAK,CAAC,iCAAiC,CAAC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC;IACnH,CAAC;IACD;;;;;;OAMG;IACI,aAAa,CAAC,KAAiB,IAAa,OAAO,IAAI,CAAC,0BAA0B,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;CACpG;AAjTD,gCAiTC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module CartesianGeometry\n */\n\nimport { AngleSweepProps, BeJSONFunctions, Geometry } from \"../Geometry\";\nimport { Angle } from \"./Angle\";\nimport { GrowableFloat64Array } from \"./GrowableFloat64Array\";\n\n/**\n * An `AngleSweep` is a pair of angles at start and end of an interval.\n *\n * * For stroking purposes, the \"included interval\" is all angles numerically reached by theta = start + f*(end-start), where f is between 0 and 1.\n * * This stroking formula is simple numbers -- 2PI shifts are not involved.\n * * 2PI shifts do become important in the reverse mapping of an angle to a fraction.\n * * If (start < end) the angle proceeds CCW around the unit circle.\n * * If (end < start) the angle proceeds CW around the unit circle.\n * * Angles beyond 360 are fine as endpoints.\n * * (350,370) covers the same unit angles as (-10,10).\n * * (370,350) covers the same unit angles as (10,-10).\n * @public\n */\nexport class AngleSweep implements BeJSONFunctions {\n private _radians0: number;\n private _radians1: number;\n /** Read-property for degrees at the start of this AngleSweep. */\n public get startDegrees() { return Angle.radiansToDegrees(this._radians0); }\n /** Read-property for degrees at the end of this AngleSweep. */\n public get endDegrees() { return Angle.radiansToDegrees(this._radians1); }\n /** Read-property for signed start-to-end sweep in degrees. */\n public get sweepDegrees() { return Angle.radiansToDegrees(this._radians1 - this._radians0); }\n /** Read-property for degrees at the start of this AngleSweep. */\n public get startRadians() { return this._radians0; }\n /** Read-property for degrees at the end of this AngleSweep. */\n public get endRadians() { return this._radians1; }\n /** Read-property for signed start-to-end sweep in radians. */\n public get sweepRadians() { return this._radians1 - this._radians0; }\n /** Return the (strongly typed) start angle */\n public get startAngle() { return Angle.createRadians(this._radians0); }\n /** Return the (strongly typed) end angle */\n public get endAngle() { return Angle.createRadians(this._radians1); }\n /** Create a sweep as one of\n * * A clone of a given sweep\n * * 0 to given angle\n * * full circle if no arg given (sweep 0 to 360 degrees)\n */\n public static create(data?: AngleSweep | Angle): AngleSweep {\n if (data instanceof AngleSweep)\n return data.clone();\n if (data instanceof Angle)\n return new AngleSweep(0, data.radians);\n return AngleSweep.create360();\n }\n /** (private) constructor with start and end angles in radians.\n * * Use explicitly named static methods to clarify intent and units of inputs:\n *\n * * createStartEndRadians (startRadians:number, endRadians:number)\n * * createStartEndDegrees (startDegrees:number, endDegrees:number)\n * * createStartEnd (startAngle:Angle, endAngle:Angle)\n * * createStartSweepRadians (startRadians:number, sweepRadians:number)\n * * createStartSweepDegrees (startDegrees:number, sweepDegrees:number)\n * * createStartSweep (startAngle:Angle, sweepAngle:Angle)\n */\n private constructor(startRadians: number = 0, endRadians: number = 0) { this._radians0 = startRadians; this._radians1 = endRadians; }\n /** create an AngleSweep from start and end angles given in radians. */\n public static createStartEndRadians(startRadians: number = 0, endRadians: number = 2.0 * Math.PI, result?: AngleSweep): AngleSweep {\n result = result ? result : new AngleSweep();\n result.setStartEndRadians(startRadians, endRadians);\n return result;\n }\n /** Return the angle obtained by subtracting radians from this angle. */\n public cloneMinusRadians(radians: number): AngleSweep { return new AngleSweep(this._radians0 - radians, this._radians1 - radians); }\n /** create an AngleSweep from start and end angles given in degrees. */\n public static createStartEndDegrees(startDegrees: number = 0, endDegrees: number = 360, result?: AngleSweep): AngleSweep {\n return AngleSweep.createStartEndRadians(Angle.degreesToRadians(startDegrees), Angle.degreesToRadians(endDegrees), result);\n }\n /** create an angle sweep from strongly typed start and end angles */\n public static createStartEnd(startAngle: Angle, endAngle: Angle, result?: AngleSweep): AngleSweep {\n result = result ? result : new AngleSweep();\n result.setStartEndRadians(startAngle.radians, endAngle.radians);\n return result;\n }\n /** Create an angle sweep with limits given as (strongly typed) angles for start and sweep */\n public static createStartSweep(startAngle: Angle, sweepAngle: Angle, result?: AngleSweep): AngleSweep {\n return AngleSweep.createStartSweepRadians(startAngle.radians, sweepAngle.radians, result);\n }\n /** Return a sweep with limits interpolated between this and other. */\n public interpolate(fraction: number, other: AngleSweep): AngleSweep {\n return new AngleSweep(Geometry.interpolate(this._radians0, fraction, other._radians0), Geometry.interpolate(this._radians1, fraction, other._radians1));\n }\n /** create an AngleSweep from start and end angles given in radians. */\n public static createStartSweepRadians(startRadians: number = 0, sweepRadians: number = Math.PI, result?: AngleSweep): AngleSweep {\n result = result ? result : new AngleSweep();\n result.setStartEndRadians(startRadians, startRadians + sweepRadians);\n return result;\n }\n /** create an AngleSweep from start and sweep given in degrees. */\n public static createStartSweepDegrees(startDegrees: number = 0, sweepDegrees: number = 360, result?: AngleSweep): AngleSweep {\n return AngleSweep.createStartEndRadians(Angle.degreesToRadians(startDegrees), Angle.degreesToRadians(startDegrees + sweepDegrees), result);\n }\n /** directly set the start and end angles in radians */\n public setStartEndRadians(startRadians: number = 0, endRadians: number = 2.0 * Math.PI) {\n const delta = endRadians - startRadians;\n if (Angle.isFullCircleRadians(delta)) {\n endRadians = startRadians + (delta > 0 ? 2.0 : -2.0) * Math.PI;\n }\n this._radians0 = startRadians;\n this._radians1 = endRadians;\n }\n /** directly set the start and end angles in degrees */\n public setStartEndDegrees(startDegrees: number = 0, endDegrees: number = 360.0) {\n this.setStartEndRadians(Angle.degreesToRadians(startDegrees), Angle.degreesToRadians(endDegrees));\n }\n /** copy from other AngleSweep. */\n public setFrom(other: AngleSweep) { this._radians0 = other._radians0; this._radians1 = other._radians1; }\n /** create a full circle sweep (CCW). startRadians defaults to 0 */\n public static create360(startRadians?: number): AngleSweep {\n startRadians = startRadians ? startRadians : 0.0;\n return new AngleSweep(startRadians, startRadians + 2.0 * Math.PI);\n }\n /** create a sweep from the south pole to the north pole. */\n public static createFullLatitude() { return AngleSweep.createStartEndRadians(-0.5 * Math.PI, 0.5 * Math.PI); }\n /** Reverse the start and end angle in place. */\n public reverseInPlace() { const a = this._radians0; this._radians0 = this._radians1; this._radians1 = a; }\n /** return a sweep for the \"other\" part of the circe.\n * @param reverseDirection true to retain the start and move backwards, false to more forwards.\n */\n public cloneComplement(reverseDirection: boolean = false, result?: AngleSweep): AngleSweep {\n const s = this.sweepRadians >= 0 ? 2.0 : -2.0;\n if (reverseDirection)\n return AngleSweep.createStartEndRadians(this.startRadians, this.endRadians - s * Math.PI, result);\n else\n return AngleSweep.createStartEndRadians(this.endRadians, this.startRadians + s * Math.PI, result);\n }\n /** Restrict start and end angles into the range (-90,+90) in degrees. */\n public capLatitudeInPlace() {\n const limit = 0.5 * Math.PI;\n this._radians0 = Geometry.clampToStartEnd(this._radians0, -limit, limit);\n this._radians1 = Geometry.clampToStartEnd(this._radians1, -limit, limit);\n }\n /** Ask if the sweep is counterclockwise, i.e. positive sweep */\n public get isCCW(): boolean { return this._radians1 >= this._radians0; }\n /** Ask if the sweep is a full circle. */\n public get isFullCircle(): boolean { return Angle.isFullCircleRadians(this.sweepRadians); }\n /** Ask if the sweep is a full sweep from south pole to north pole. */\n public get isFullLatitudeSweep(): boolean {\n const a = Math.PI * 0.5;\n return Angle.isAlmostEqualRadiansNoPeriodShift(this._radians0, -a)\n && Angle.isAlmostEqualRadiansNoPeriodShift(this._radians1, a);\n }\n /** return a clone of this sweep. */\n public clone(): AngleSweep { return new AngleSweep(this._radians0, this._radians1); }\n /** Convert fractional position in the sweep to radians. */\n public fractionToRadians(fraction: number) {\n return fraction < 0.5 ?\n this._radians0 + fraction * (this._radians1 - this._radians0)\n : this._radians1 + (fraction - 1.0) * (this._radians1 - this._radians0);\n }\n /** Convert fractional position in the sweep to strongly typed Angle object. */\n public fractionToAngle(fraction: number) {\n return Angle.createRadians(this.fractionToRadians(fraction));\n }\n /** return 2PI divided by the sweep radians (i.e. 360 degrees divided by sweep angle).\n * This is the number of fractional intervals required to cover a whole circle.\n */\n public fractionPeriod(): number {\n return Geometry.safeDivideFraction(Math.PI * 2.0, Math.abs(this._radians1 - this._radians0), 1.0);\n }\n /** return the fractionalized position of the angle,\n * computed without consideration of 2PI period.\n * That is, an angle that is numerically much beyond than the end angle\n * will produce a large fraction and an angle much beyond the start angle\n * will produce a large negative fraction.\n *\n */\n public angleToUnboundedFraction(theta: Angle): number {\n return Geometry.safeDivideFraction(theta.radians - this._radians0, this._radians1 - this._radians0, 1.0);\n }\n /** map an angle to a fractional coordinate which is:\n *\n * * the start angle is at fraction 0\n * * the end angle is at fraction 1\n * * interior angles are between 0 and 1\n * * all exterior angles are at fractions greater than 1\n * * the periodic jump is at full wraparound to the start angle\n */\n public angleToPositivePeriodicFraction(theta: Angle): number { return this.radiansToPositivePeriodicFraction(theta.radians); }\n /**\n * Convert each value in an array from radians to fraction.\n * @param data array that is input as radians, output as fractions\n */\n public radiansArrayToPositivePeriodicFractions(data: GrowableFloat64Array) {\n const n = data.length;\n for (let i = 0; i < n; i++) {\n data.reassign(i, this.radiansToPositivePeriodicFraction(data.atUncheckedIndex(i)));\n }\n }\n /**\n * Convert a radians value to a fraction that is always positive and can wrap. See `angleToPositivePeriodicFraction` for detailed description.\n * @param radians\n */\n public radiansToPositivePeriodicFraction(radians: number, zeroSweepDefault: number = 0.0): number {\n return AngleSweep.radiansToPositivePeriodicFractionStartEnd(radians, this._radians0, this._radians1, zeroSweepDefault);\n }\n /**\n * Convert a radians value to a fraction that is always positive and can wrap. See `angleToPositivePeriodicFraction` for detailed description.\n * @param radians\n */\n public static radiansToPositivePeriodicFractionStartEnd(radians: number, radians0: number, radians1: number, zeroSweepDefault: number = 0.0): number {\n if (Angle.isAlmostEqualRadiansAllowPeriodShift(radians, radians0))\n return 0.0;\n if (Angle.isAlmostEqualRadiansAllowPeriodShift(radians, radians1))\n return 1.0;\n const sweep = radians1 - radians0;\n const delta = radians - radians0;\n if (sweep > 0) {\n const delta1 = Angle.adjustRadians0To2Pi(delta);\n const fraction1 = Geometry.safeDivideFraction(delta1, sweep, zeroSweepDefault);\n return fraction1;\n }\n const delta2 = Angle.adjustRadians0To2Pi(-delta);\n const fraction2 = Geometry.safeDivideFraction(delta2, -sweep, zeroSweepDefault);\n return fraction2;\n }\n /** map an angle to a fractional coordinate which is:\n *\n * * the start angle is at fraction 0\n * * the end angle is at fraction 1\n * * interior angles are between 0 and 1\n * * small negative for angles just \"before\" the start angle\n * * more than one for angles just \"after\" the end angle\n * * the periodic jump is at the middle of the \"outside\" interval\n */\n public angleToSignedPeriodicFraction(theta: Angle): number {\n return this.radiansToSignedPeriodicFraction(theta.radians);\n }\n /**\n * Convert a radians value to a fraction, allowing wraparound. See `angleToSignedPeriodicFraction` for detailed description.\n */\n public radiansToSignedPeriodicFraction(radians: number): number {\n if (Angle.isAlmostEqualRadiansAllowPeriodShift(radians, this._radians0))\n return 0.0;\n if (Angle.isAlmostEqualRadiansAllowPeriodShift(radians, this._radians1))\n return 1.0;\n const sweep = this._radians1 - this._radians0;\n // measure from middle of interval ...\n const delta = radians - this._radians0 - 0.5 * sweep;\n if (sweep > 0) {\n const delta1 = Angle.adjustRadiansMinusPiPlusPi(delta);\n const fraction1 = 0.5 + Geometry.safeDivideFraction(delta1, sweep, 0.0);\n return fraction1;\n }\n const delta2 = Angle.adjustRadiansMinusPiPlusPi(-delta);\n const fraction = 0.5 + Geometry.safeDivideFraction(delta2, -sweep, 0.0);\n return fraction;\n }\n /** test if an angle is within the sweep */\n public isAngleInSweep(angle: Angle): boolean { return this.isRadiansInSweep(angle.radians); }\n /** test if radians are within sweep */\n public isRadiansInSweep(radians: number, allowPeriodShift: boolean = true): boolean {\n return AngleSweep.isRadiansInStartEnd(radians, this.startRadians, this.endRadians, allowPeriodShift);\n }\n /** test if radians are within sweep */\n public static isRadiansInStartEnd(radians: number, radians0: number, radians1: number, allowPeriodShift: boolean = true): boolean {\n // quick out for simple inside ...\n const delta0 = radians - radians0;\n const delta1 = radians - radians1;\n if (delta0 * delta1 <= 0.0)\n return true;\n\n if (radians0 === radians1)\n return allowPeriodShift ? Angle.isAlmostEqualRadiansAllowPeriodShift(radians, radians0) : Angle.isAlmostEqualRadiansNoPeriodShift(radians, radians0);\n return allowPeriodShift ? this.radiansToPositivePeriodicFractionStartEnd(radians, radians0, radians1, 1000.0) <= 1.0 : false;\n }\n\n /** set this AngleSweep from various sources:\n *\n * * if json is undefined, a full-circle sweep is returned.\n * * If json is an AngleSweep object it is cloned\n * * If json is an array of 2 numbers, those numbers are start and end angles in degrees.\n * * If `json.degrees` is an array of 2 numbers, those numbers are start and end angles in degrees.\n * * If `json.radians` is an array of 2 numbers, those numbers are start and end angles in radians.\n */\n public setFromJSON(json?: any) {\n if (!json)\n this.setStartEndRadians(); // default full circle\n else if (json instanceof AngleSweep)\n this.setFrom(json);\n else if (Geometry.isNumberArray(json.degrees, 2))\n this.setStartEndDegrees(json.degrees[0], json.degrees[1]);\n else if (Geometry.isNumberArray(json.radians, 2))\n this.setStartEndRadians(json.radians[0], json.radians[1]);\n else if (Geometry.isNumberArray(json, 2))\n this.setStartEndDegrees(json[0], json[1]);\n }\n /** create an AngleSweep from a json object. */\n public static fromJSON(json?: AngleSweepProps) {\n const result = AngleSweep.create360();\n result.setFromJSON(json);\n return result;\n }\n /**\n * Convert an AngleSweep to a JSON object.\n * @return {*} {degrees: [startAngleInDegrees, endAngleInDegrees}\n */\n public toJSON(): any {\n // return { degrees: [this.startDegrees, this.endDegrees] };\n return [this.startDegrees, this.endDegrees];\n }\n /** test if start and end angles match, with explicit name to clarify that there is no test for 360-degree shifts. */\n public isAlmostEqualAllowPeriodShift(other: AngleSweep): boolean {\n return Angle.isAlmostEqualRadiansAllowPeriodShift(this._radians0, other._radians0)\n && Angle.isAlmostEqualRadiansNoPeriodShift(this._radians1 - this._radians0, other._radians1 - other._radians0);\n }\n /** test if start and end angles match, explicit name to clarify that 360-degree shifts are allowed. */\n public isAlmostEqualNoPeriodShift(other: AngleSweep): boolean {\n return Angle.isAlmostEqualRadiansNoPeriodShift(this._radians0, other._radians0)\n && Angle.isAlmostEqualRadiansNoPeriodShift(this._radians1 - this._radians0, other._radians1 - other._radians0);\n }\n /** test if start and end angles match with radians tolerance.\n * * This is equivalent to isAlmostEqualNoPeriodShift.\n * * it is present for consistency with other classes\n * * It is recommended that all callers use one of he longer names to be clear of their intentions:\n * * * isAlmostEqualAllowPeriodShift\n * * * isAlmostEqualRadiansNoPeriodShift\n */\n public isAlmostEqual(other: AngleSweep): boolean { return this.isAlmostEqualNoPeriodShift(other); }\n}\n"]}
|
|
@@ -56,7 +56,7 @@ export declare class ClusterableArray extends GrowableBlockedArray {
|
|
|
56
56
|
*
|
|
57
57
|
* ** simple coordinate blocks (x,y) or (x,y,z) would work fine but have occasional performance problems because points with same x would generate big blocks of
|
|
58
58
|
* candidates for clusters.
|
|
59
|
-
* ** The usual solution is to u value which is a dot product along some skew direction and have the blocks contain (u,x,y) or (u,x,y,z) for 2d versus 3d.
|
|
59
|
+
* ** The usual solution is to sort by u value, which is a dot product along some skew direction, and have the blocks contain (u,x,y) or (u,x,y,z) for 2d versus 3d.
|
|
60
60
|
* ** apply setupPrimaryClusterSort to prepare that!!!
|
|
61
61
|
* * After a simple lexical sort, consecutive blocks that are within tolerance in the 0 component
|
|
62
62
|
* are inspected. Within that candidate set, all blocks that are within tolerance for ALL components are clustered.
|
|
@@ -88,9 +88,9 @@ export declare class ClusterableArray extends GrowableBlockedArray {
|
|
|
88
88
|
*/
|
|
89
89
|
createIndexClusterToClusterStart(clusteredBlocks: Uint32Array): Uint32Array;
|
|
90
90
|
/**
|
|
91
|
-
* Sort terminator-delimited subsets of an array of indices into the table, using a single
|
|
92
|
-
* @param blockedIndices
|
|
93
|
-
* @param
|
|
91
|
+
* Sort terminator-delimited subsets of an array of indices into the table, using a single data value as sort key.
|
|
92
|
+
* @param blockedIndices indices, organized as blocks of good indices terminated by the clusterTerminator. Each block is individually sorted on return.
|
|
93
|
+
* @param dataIndex index of the data key, e.g., if the sort key is the first extraData (angle) after x and y coordinate data, pass dataIndex = 2.
|
|
94
94
|
*/
|
|
95
95
|
sortSubsetsBySingleKey(blockedIndices: Uint32Array, dataIndex: number): void;
|
|
96
96
|
/**
|
|
@@ -123,7 +123,7 @@ class ClusterableArray extends GrowableBlockedArray_1.GrowableBlockedArray {
|
|
|
123
123
|
*
|
|
124
124
|
* ** simple coordinate blocks (x,y) or (x,y,z) would work fine but have occasional performance problems because points with same x would generate big blocks of
|
|
125
125
|
* candidates for clusters.
|
|
126
|
-
* ** The usual solution is to u value which is a dot product along some skew direction and have the blocks contain (u,x,y) or (u,x,y,z) for 2d versus 3d.
|
|
126
|
+
* ** The usual solution is to sort by u value, which is a dot product along some skew direction, and have the blocks contain (u,x,y) or (u,x,y,z) for 2d versus 3d.
|
|
127
127
|
* ** apply setupPrimaryClusterSort to prepare that!!!
|
|
128
128
|
* * After a simple lexical sort, consecutive blocks that are within tolerance in the 0 component
|
|
129
129
|
* are inspected. Within that candidate set, all blocks that are within tolerance for ALL components are clustered.
|
|
@@ -281,9 +281,9 @@ class ClusterableArray extends GrowableBlockedArray_1.GrowableBlockedArray {
|
|
|
281
281
|
return clusterToClusterStart;
|
|
282
282
|
}
|
|
283
283
|
/**
|
|
284
|
-
* Sort terminator-delimited subsets of an array of indices into the table, using a single
|
|
285
|
-
* @param blockedIndices
|
|
286
|
-
* @param
|
|
284
|
+
* Sort terminator-delimited subsets of an array of indices into the table, using a single data value as sort key.
|
|
285
|
+
* @param blockedIndices indices, organized as blocks of good indices terminated by the clusterTerminator. Each block is individually sorted on return.
|
|
286
|
+
* @param dataIndex index of the data key, e.g., if the sort key is the first extraData (angle) after x and y coordinate data, pass dataIndex = 2.
|
|
287
287
|
*/
|
|
288
288
|
sortSubsetsBySingleKey(blockedIndices, dataIndex) {
|
|
289
289
|
const dataOffset = 1 + dataIndex;
|
|
@@ -293,7 +293,7 @@ class ClusterableArray extends GrowableBlockedArray_1.GrowableBlockedArray {
|
|
|
293
293
|
const numK = blockedIndices.length;
|
|
294
294
|
for (let kEnd = 0; kEnd < numK; kEnd++) {
|
|
295
295
|
if (blockedIndices[kEnd] === ClusterableArray.clusterTerminator) {
|
|
296
|
-
// sort blockedIndices[kBegin
|
|
296
|
+
// bubble sort blockedIndices[kBegin <= k < kEnd].
|
|
297
297
|
// (search for minimum remaining, swap . . )
|
|
298
298
|
for (let k0 = kBegin; k0 + 1 < kEnd; k0++) {
|
|
299
299
|
key0 = this.getWithinBlock(blockedIndices[k0], dataOffset);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClusterableArray.js","sourceRoot":"","sources":["../../../src/numerics/ClusterableArray.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,0CAAuC;AACvC,6EAA0E;AAC1E,mEAAgE;AAChE,qEAAkE;AAClE,mEAAwD;AACxD,mEAAwD;AAExD;;;;GAIG;AACH,MAAa,gBAAiB,SAAQ,2CAAoB;IAcxD;;;;OAIG;IACH,YAAmB,qBAA6B,EAAE,oBAA4B,EAAE,oBAA4B;QAC1G,KAAK,CAAC,CAAC,GAAG,qBAAqB,GAAG,oBAAoB,EAAE,oBAAoB,CAAC,CAAC;QAC9E,IAAI,CAAC,qBAAqB,GAAG,oBAAoB,CAAC;QAClD,IAAI,CAAC,sBAAsB,GAAG,qBAAqB,CAAC;IACtD,CAAC;IAjBD,6CAA6C;IACtC,MAAM,CAAC,mBAAmB,CAAC,KAAa;QAC7C,IAAI,CAAC,GAAG,GAAG,CAAC;QACZ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE;YAAE,CAAC,IAAI,gBAAgB,CAAC,aAAa,CAAC;QACpE,OAAO,CAAC,CAAC;IACX,CAAC;IAaD;;OAEG;IACa,QAAQ,CAAC,IAAc;QACrC,MAAM,EAAE,GAAG,IAAI,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;QACpC,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,GAAG,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACtD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;YACxB,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAA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AO,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC/C,CAAC;;AArBD,uCAAuC;AAChB,mCAAY,GAAG,UAAU,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Numerics\n */\n\nimport { Geometry } from \"../Geometry\";\nimport { GrowableBlockedArray } from \"../geometry3d/GrowableBlockedArray\";\nimport { GrowableXYArray } from \"../geometry3d/GrowableXYArray\";\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\nimport { Point2d } from \"../geometry3d/Point2dVector2d\";\nimport { Point3d } from \"../geometry3d/Point3dVector3d\";\n\n/**\n * Blocked array with operations to sort and cluster with a tolerance.\n * * Primary sorting is along an \"arbitrary\" sort vector.\n * @internal\n */\nexport class ClusterableArray extends GrowableBlockedArray {\n // (This is pretty strange)\n // The sort vector is (1,c, c*c, ...)\n // Setting c = 1 makes it 1,1,1 which may be useful for visual scans during debug.\n // c with some non-obvious digits makes it unlikely that there will be multiple points on a perpendicular to the sort vector.\n private static readonly _vectorFactor = 0.8732; // use 1.0 to rig easy tests.\n /** Return a component of the sort vector. */\n public static sortVectorComponent(index: number): number {\n let c = 1.0;\n for (let i = 1; i < index; i++) c *= ClusterableArray._vectorFactor;\n return c;\n }\n private _numCoordinatePerPoint: number;\n private _numExtraDataPerPoint: number;\n /**\n * @param numCoordinatePerPoint number of coordinates per point\n * @param numExtraDataPerPoint of extra data values per point.\n * @param initialBlockCapacity predicted number of points. (This does not have to be accurate)\n */\n public constructor(numCoordinatePerPoint: number, numExtraDataPerPoint: number, initialBlockCapacity: number) {\n super(1 + numCoordinatePerPoint + numExtraDataPerPoint, initialBlockCapacity);\n this._numExtraDataPerPoint = numExtraDataPerPoint;\n this._numCoordinatePerPoint = numCoordinatePerPoint;\n }\n /** load a block, placing data[i] at block[i+1] to allow sort coordinate first.\n * @param data array of numDataPerBlock values.\n */\n public override addBlock(data: number[]) {\n const i0 = this.newBlockIndex() + 1;\n const n = Math.min(this.numPerBlock - 1, data.length);\n for (let i = 0; i < n; i++)\n this._data[i0 + i] = data[i];\n }\n /** add a block directly with 1 to 5 listed content parameters.\n * This assumes numDataPerPoint is sufficient for the parameters provided.\n */\n public addDirect(x0: number, x1?: number, x2?: number, x3?: number, x4?: number) {\n const i0 = this.newBlockIndex();\n this._data[i0 + 1] = x0;\n if (x1 !== undefined) this._data[i0 + 2] = x1;\n if (x2 !== undefined) this._data[i0 + 3] = x2;\n if (x3 !== undefined) this._data[i0 + 4] = x3;\n if (x4 !== undefined) this._data[i0 + 5] = x4;\n }\n\n /** add a block directly from a Point2d with 0 to 3 extras\n * This assumes numDataPerPoint is sufficient for the parameters provided.\n */\n public addPoint2d(xy: Point2d, a?: number, b?: number, c?: number) {\n const i0 = this.newBlockIndex();\n this._data[i0 + 1] = xy.x;\n this._data[i0 + 2] = xy.y;\n if (a !== undefined)\n this._data[i0 + 3] = a;\n if (b !== undefined)\n this._data[i0 + 4] = b;\n if (c !== undefined)\n this._data[i0 + 5] = c;\n }\n\n /** add a block with directly from a Point2d with 0 to 3 extras\n * This assumes numDataPerPoint is sufficient for the parameters provided.\n */\n public addPoint3d(xyz: Point3d, a?: number, b?: number, c?: number) {\n const i0 = this.newBlockIndex();\n this._data[i0 + 1] = xyz.x;\n this._data[i0 + 2] = xyz.y;\n this._data[i0 + 3] = xyz.z;\n if (a !== undefined)\n this._data[i0 + 4] = a;\n if (b !== undefined)\n this._data[i0 + 5] = b;\n if (c !== undefined)\n this._data[i0 + 6] = c;\n }\n /** Get the xy coordinates by point index. */\n public getPoint2d(blockIndex: number, result?: Point2d): Point2d {\n const i0 = this.blockIndexToDoubleIndex(blockIndex);\n return Point2d.create(this._data[i0 + 1], this._data[i0 + 2], result);\n }\n /** Get the xyZ coordinates by point index. */\n public getPoint3d(blockIndex: number, result?: Point3d): Point3d {\n const i0 = this.blockIndexToDoubleIndex(blockIndex);\n return Point3d.create(this._data[i0 + 1], this._data[i0 + 2], this._data[i0 + 3], result);\n }\n /** Return a single extra data value */\n public getExtraData(blockIndex: number, i: number): number {\n const i0 = this.blockIndexToDoubleIndex(blockIndex);\n return this._data[i0 + 1 + this._numCoordinatePerPoint + i];\n }\n /** Return a single data value */\n public getData(blockIndex: number, i: number): number {\n const i0 = this.blockIndexToDoubleIndex(blockIndex);\n return this._data[i0 + i];\n }\n\n /** Set a single extra data value */\n public setExtraData(blockIndex: number, i: number, value: number): void {\n const i0 = this.blockIndexToDoubleIndex(blockIndex);\n this._data[i0 + 1 + this._numCoordinatePerPoint + i] = value;\n }\n\n /** this value is used as cluster terminator in the Uint232Array of indices. */\n public static readonly clusterTerminator = 0xFFffFFff;\n /** Test if `x` is the cluster terminator value. */\n public static isClusterTerminator(x: number): boolean { return x === ClusterableArray.clusterTerminator; }\n /** Return an array giving clusters of blocks with similar coordinates.\n *\n * * The contents of each block is assumed to be set up so the primary sort coordinate is first.\n *\n * ** simple coordinate blocks (x,y) or (x,y,z) would work fine but have occasional performance problems because points with same x would generate big blocks of\n * candidates for clusters.\n * ** The usual solution is to u value which is a dot product along some skew direction and have the blocks contain (u,x,y) or (u,x,y,z) for 2d versus 3d.\n * ** apply setupPrimaryClusterSort to prepare that!!!\n * * After a simple lexical sort, consecutive blocks that are within tolerance in the 0 component\n * are inspected. Within that candidate set, all blocks that are within tolerance for ALL components are clustered.\n * * In the output cluster array, clusters are terminated a invalid index. Test for the invalid index with GrowableBlockArray.isClusterTerminator (x)\n */\n public clusterIndicesLexical(clusterTolerance: number = Geometry.smallMetricDistance): Uint32Array {\n // install primary sort key\n this.setupPrimaryClusterSort();\n // presort by all coordinates ....\n const firstSort = this.sortIndicesLexical();\n const clusterIndices = new Uint32Array(2 * firstSort.length); // worst case: no duplicates, each index goes in followed by terminator.\n let m = 0; // number of cluster indices\n const n = this.numBlocks; // and this must match firstSort.length !!\n let clusterStartBlockIndex = 0;\n let candidateBlockIndex = 0;\n let barrierU = 0.0;\n let i = 0;\n let j = 0;\n\n const k0 = 1; // beginning of active column for distance\n const k1 = 1 + this._numCoordinatePerPoint;\n for (i = 0; i < n; i++) {\n clusterStartBlockIndex = firstSort[i];\n if (!ClusterableArray.isClusterTerminator(clusterStartBlockIndex)) {\n // unused block, so it becomes a cluster...\n clusterIndices[m++] = clusterStartBlockIndex;\n barrierU = this.component(clusterStartBlockIndex, 0) + clusterTolerance;\n firstSort[i] = ClusterableArray.clusterTerminator;\n for (j = i + 1; j < n; j++) {\n candidateBlockIndex = firstSort[j];\n if (candidateBlockIndex === ClusterableArray.clusterTerminator) continue; // nearby in sort direction but already in a cluster.\n if (this.component(candidateBlockIndex, 0) >= barrierU) break;\n if (this.distanceBetweenSubBlocks(clusterStartBlockIndex, candidateBlockIndex, k0, k1) < clusterTolerance) {\n clusterIndices[m++] = candidateBlockIndex; // The candidate is in the block\n firstSort[j] = ClusterableArray.clusterTerminator; // and it will not be reused as future block base\n }\n }\n clusterIndices[m++] = ClusterableArray.clusterTerminator;\n }\n }\n // Alas, the clusterIndices array has fluff at the end. So it has to be copied.\n return clusterIndices.slice(0, m);\n }\n /** setup (overwrite!!) the \"0\" component with the dot product of numClusterCoordinate later components with a non-axis aligned vector.\n * This is normally called before clusterIndicesLexical.\n */\n public setupPrimaryClusterSort() {\n const nb = this.numBlocks;\n const nc = this._numCoordinatePerPoint;\n const vector = new Float64Array(nc);\n vector[0] = 1.0;\n for (let c = 1; c < nc; c++) vector[c] = vector[c - 1] * ClusterableArray._vectorFactor;\n let k = 0;\n let dot = 0.0;\n const data = this._data;\n for (let b = 0; b < nb; b++) {\n k = this.blockIndexToDoubleIndex(b);\n dot = 0.0;\n for (let c = 0; c < nc; c++) { dot += vector[c] * data[k + 1 + c]; }\n data[k] = dot;\n }\n }\n /** Convert the cluster data to an array of tuples with point i in the form\n * `[i, primarySortCoordinate, [x,y,..], [extraData0, extraData1, ...]]`\n */\n public toJSON(): any[] {\n const result: any[] = [];\n for (let b = 0; b < this.numBlocks; b++) {\n let i = this.blockIndexToDoubleIndex(b);\n const chunk: any[] = [b, this._data[i++]];\n const coordinates = [];\n for (let c = 0; c < this._numCoordinatePerPoint; c++)coordinates.push(this._data[i++]);\n chunk.push(coordinates);\n for (let c = 0; c < this._numExtraDataPerPoint; c++)\n chunk.push(this._data[i++]);\n result.push(chunk);\n }\n return result;\n }\n /**\n * Return an array of indices from block index to cluster index.\n * @param clusteredBlocks clusters of block indices followed by separators.\n */\n public createIndexBlockToClusterIndex(clusteredBlocks: Uint32Array): Uint32Array {\n const numBlocks = this.numBlocks;\n const blockToCluster = new Uint32Array(numBlocks);\n blockToCluster.fill(ClusterableArray.clusterTerminator);\n let numCluster = 0;\n for (const b of clusteredBlocks) {\n if (b >= numBlocks) {\n numCluster++;\n } else {\n blockToCluster[b] = numCluster;\n }\n }\n return blockToCluster;\n }\n /**\n * Return an array of indices from block index to index of its cluster's start in the cluster index array.\n * @param clusteredBlocks clusters of block indices followed by separators.\n */\n public createIndexBlockToClusterStart(clusteredBlocks: Uint32Array): Uint32Array {\n const n = clusteredBlocks.length;\n const numBlocks = this.numBlocks;\n const blockToClusterStart = new Uint32Array(numBlocks);\n const terminator = ClusterableArray.clusterTerminator;\n blockToClusterStart.fill(terminator);\n let clusterStart = 0;\n for (let i = 0; i < n; i++) {\n const k = clusteredBlocks[i];\n if (k > numBlocks) {\n clusterStart = i + 1;\n } else {\n blockToClusterStart[k] = clusterStart;\n }\n }\n return blockToClusterStart;\n }\n /** count the clusters in the clusteredBlocks array. */\n public countClusters(clusteredBlocks: Uint32Array): number {\n let numClusters = 0;\n const terminator = ClusterableArray.clusterTerminator;\n for (const b of clusteredBlocks) {\n if (b === terminator)\n numClusters++;\n }\n return numClusters;\n }\n /** create a reverse index: given a cluster index k, clusterToClusterStart[k] is the place\n * the cluster's block indices appear in clusterBlocks\n */\n public createIndexClusterToClusterStart(clusteredBlocks: Uint32Array): Uint32Array {\n let numCluster = this.countClusters(clusteredBlocks);\n const clusterToClusterStart = new Uint32Array(numCluster);\n const terminator = ClusterableArray.clusterTerminator;\n clusterToClusterStart.fill(terminator);\n const n = clusteredBlocks.length;\n let clusterStart = 0;\n for (let i = 0; i < n; i++) {\n const k = clusteredBlocks[i];\n if (k === terminator) {\n clusterStart = i + 1;\n } else if (i === clusterStart) {\n clusterToClusterStart[numCluster++] = clusterStart;\n }\n }\n return clusterToClusterStart;\n }\n\n /**\n * Sort terminator-delimited subsets of an array of indices into the table, using a single extraData index as sort key.\n * @param blockedIndices [in] indices, organized as blocks of good indices terminated by the clusterTerminator.\n * @param extraDataIndex index of the extra data key.\n */\n public sortSubsetsBySingleKey(blockedIndices: Uint32Array, dataIndex: number) {\n const dataOffset = 1 + dataIndex;\n let kBegin = 0;\n let swap;\n let key0, key1;\n const numK = blockedIndices.length;\n for (let kEnd = 0; kEnd < numK; kEnd++) {\n if (blockedIndices[kEnd] === ClusterableArray.clusterTerminator) {\n // sort blockedIndices[kBegin ,= k < kEnd].\n // (search for minimum remaining, swap . . )\n for (let k0 = kBegin; k0 + 1 < kEnd; k0++) {\n key0 = this.getWithinBlock(blockedIndices[k0], dataOffset);\n for (let k1 = k0 + 1; k1 < kEnd; k1++) {\n key1 = this.getWithinBlock(blockedIndices[k1], dataOffset);\n if (key1 < key0) {\n swap = blockedIndices[k0];\n blockedIndices[k0] = blockedIndices[k1];\n blockedIndices[k1] = swap;\n key0 = key1;\n }\n }\n }\n kBegin = kEnd + 1;\n }\n }\n }\n /**\n * Returns packed points with indices mapping old to new.\n * @param data points to cluster.\n */\n public static clusterPoint3dArray(data: Point3d[], tolerance: number = Geometry.smallMetricDistance):\n PackedPointsWithIndex {\n const clusterArray = new ClusterableArray(3, 0, data.length);\n data.forEach((p: Point3d) => {\n clusterArray.addDirect(p.x, p.y, p.z);\n });\n const order = clusterArray.clusterIndicesLexical(tolerance);\n const result = new PackedPointsWithIndex(data.length);\n let currentClusterIndex = 0;\n let numThisCluster = 0;\n order.forEach((k: number) => {\n if (ClusterableArray.isClusterTerminator(k)) {\n currentClusterIndex++;\n numThisCluster = 0;\n } else {\n if (numThisCluster === 0)\n result.packedPoints.push(data[k].clone());\n result.oldToNew[k] = currentClusterIndex;\n numThisCluster++;\n }\n });\n return result;\n }\n\n /**\n * Returns number array with indices mapping old to new.\n * @param data numbers to cluster.\n */\n public static clusterNumberArray(data: number[], tolerance: number = Geometry.smallMetricDistance): PackedNumbersWithIndex {\n const clusterArray = new ClusterableArray(1, 0, data.length);\n data.forEach((x: number) => {clusterArray.addDirect(x);});\n const order = clusterArray.clusterIndicesLexical(tolerance);\n const result = new PackedNumbersWithIndex(data.length);\n let currentClusterIndex = 0;\n let numThisCluster = 0;\n order.forEach((k: number) => {\n if (ClusterableArray.isClusterTerminator(k)) {\n currentClusterIndex++;\n numThisCluster = 0;\n } else {\n if (numThisCluster === 0)\n result.packedNumbers.push(data[k]);\n result.oldToNew[k] = currentClusterIndex;\n numThisCluster++;\n }\n });\n return result;\n }\n\n /**\n * Returns packed points with indices mapping old to new.\n * @param data points to cluster.\n */\n public static clusterGrowablePoint2dArray(source: GrowableXYArray, tolerance: number = Geometry.smallMetricDistance): PackedPoint2dsWithIndex {\n const clusterArray = new ClusterableArray(2, 0, source.length);\n const p = Point2d.create();\n const numSourcePoint = source.length;\n for (let i = 0; i < numSourcePoint; i++) {\n source.getPoint2dAtUncheckedPointIndex(i, p);\n clusterArray.addDirect(p.x, p.y);\n }\n const order = clusterArray.clusterIndicesLexical(tolerance);\n const numPackedPoints = clusterArray.countClusters(order);\n const result = new PackedPoint2dsWithIndex(source.length, numPackedPoints);\n let currentClusterIndex = 0;\n let numThisCluster = 0;\n order.forEach((k: number) => {\n if (ClusterableArray.isClusterTerminator(k)) {\n currentClusterIndex++;\n numThisCluster = 0;\n } else {\n if (numThisCluster === 0) // This is the first encounter with a new cluster\n result.growablePackedPoints.pushFromGrowableXYArray(source, k);\n result.oldToNew[k] = currentClusterIndex;\n numThisCluster++;\n }\n });\n return result;\n }\n\n /**\n * Returns packed points with indices mapping old to new.\n * @param data points to cluster.\n */\n public static clusterGrowablePoint3dArray(source: GrowableXYZArray, tolerance: number = Geometry.smallMetricDistance):\n PackedPointsWithIndex {\n const clusterArray = new ClusterableArray(3, 0, source.length);\n const p = Point3d.create();\n const numSourcePoint = source.length;\n for (let i = 0; i < numSourcePoint; i++) {\n source.getPoint3dAtUncheckedPointIndex(i, p);\n clusterArray.addDirect(p.x, p.y, p.z);\n }\n const order = clusterArray.clusterIndicesLexical(tolerance);\n const result = new PackedPointsWithIndex(source.length);\n const numPackedPoints = clusterArray.countClusters(order);\n result.growablePackedPoints = new GrowableXYZArray(numPackedPoints);\n let currentClusterIndex = 0;\n let numThisCluster = 0;\n order.forEach((k: number) => {\n if (ClusterableArray.isClusterTerminator(k)) {\n currentClusterIndex++;\n numThisCluster = 0;\n } else {\n if (numThisCluster === 0) // This is the first encounter with a new cluster\n result.growablePackedPoints!.pushFromGrowableXYZArray(source, k);\n result.oldToNew[k] = currentClusterIndex;\n numThisCluster++;\n }\n });\n return result;\n }\n}\n\n/**\n * @internal\n */\nfunction updateIndices(indices: number[], oldToNew: Uint32Array): boolean {\n let numErrors = 0;\n indices.forEach((value: number, i: number, data: number[]) => {\n if (value < oldToNew.length) {\n data[i] = oldToNew[value];\n } else numErrors++;\n });\n return numErrors === 0;\n}\n\n/**\n * Data carrier class for\n * * packedPoints = an array of Point3d\n * * oldToNew = array of indices from some prior Point3d[] to the packed points.\n * @internal\n */\nclass PackedPointsWithIndex {\n /** Array of Point3d */\n public packedPoints: Point3d[];\n /** array of coordinates packed in GrowableXYZArray */\n public growablePackedPoints: GrowableXYZArray | undefined;\n /** mapping from old point index to new point index. */\n public oldToNew: Uint32Array;\n /** integer value for unknown index. */\n public static readonly invalidIndex = 0xFFFFffff;\n\n /** construct a PackedPoints object with\n * * empty packedPoints array\n * * oldToNew indices all initialized to PackedPoints.invalidIndex\n */\n constructor(numOldIndexEntry: number) {\n this.packedPoints = [];\n this.oldToNew = new Uint32Array(numOldIndexEntry);\n for (let i = 0; i < numOldIndexEntry; i++) {\n this.oldToNew[i] = PackedPointsWithIndex.invalidIndex;\n }\n }\n /**\n * Use the oldToNew array to update an array of \"old\" indices.\n * @param indices array of indices into prepacked array.\n * @returns true if all input indices were valid for the oldToNew array.\n */\n public updateIndices(indices: number[]): boolean {\n return updateIndices(indices, this.oldToNew);\n }\n}\n\n/**\n * @internal\n */\nclass PackedPoint2dsWithIndex {\n /** array of coordinates packed in GrowableXYArray */\n public growablePackedPoints: GrowableXYArray;\n /** mapping from old point index to new point index. */\n public oldToNew: Uint32Array;\n /** integer value for unknown index. */\n public static readonly invalidIndex = 0xFFFFffff;\n\n /** construct a PackedPoints object with\n * * empty packedPoints array\n * * oldToNew indices all initialized to PackedPoints.invalidIndex\n */\n constructor(numOldIndexEntry: number, numPackedPoints: number) {\n this.growablePackedPoints = new GrowableXYArray(numPackedPoints);\n this.oldToNew = new Uint32Array(numOldIndexEntry);\n for (let i = 0; i < numOldIndexEntry; i++) {\n this.oldToNew[i] = PackedPoint2dsWithIndex.invalidIndex;\n }\n }\n /**\n * Use the oldToNew array to update an array of \"old\" indices.\n * @param indices array of indices into prepacked array.\n * @returns true if all input indices were valid for the oldToNew array.\n */\n public updateIndices(indices: number[]): boolean {\n return updateIndices(indices, this.oldToNew);\n }\n}\n\n/**\n * @internal\n */\n class PackedNumbersWithIndex {\n /** Array of numbers */\n public packedNumbers: number[];\n /** mapping from old point index to new point index. */\n public oldToNew: Uint32Array;\n /** integer value for unknown index. */\n public static readonly invalidIndex = 0xFFFFffff;\n\n /** construct a PackedNumbers object with\n * * empty packedNumbers array\n * * oldToNew indices all initialized to PackedNumbers.invalidIndex\n */\n constructor(numOldIndexEntry: number) {\n this.packedNumbers = [];\n this.oldToNew = new Uint32Array(numOldIndexEntry);\n for (let i = 0; i < numOldIndexEntry; i++) {\n this.oldToNew[i] = PackedPointsWithIndex.invalidIndex;\n }\n }\n /**\n * Use the oldToNew array to update an array of \"old\" indices.\n * @param indices array of indices into prepacked array.\n * @returns true if all input indices were valid for the oldToNew array.\n */\n public updateIndices(indices: number[]): boolean {\n return updateIndices(indices, this.oldToNew);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ClusterableArray.js","sourceRoot":"","sources":["../../../src/numerics/ClusterableArray.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,0CAAuC;AACvC,6EAA0E;AAC1E,mEAAgE;AAChE,qEAAkE;AAClE,mEAAwD;AACxD,mEAAwD;AAExD;;;;GAIG;AACH,MAAa,gBAAiB,SAAQ,2CAAoB;IAcxD;;;;OAIG;IACH,YAAmB,qBAA6B,EAAE,oBAA4B,EAAE,oBAA4B;QAC1G,KAAK,CAAC,CAAC,GAAG,qBAAqB,GAAG,oBAAoB,EAAE,oBAAoB,CAAC,CAAC;QAC9E,IAAI,CAAC,qBAAqB,GAAG,oBAAoB,CAAC;QAClD,IAAI,CAAC,sBAAsB,GAAG,qBAAqB,CAAC;IACtD,CAAC;IAjBD,6CAA6C;IACtC,MAAM,CAAC,mBAAmB,CAAC,KAAa;QAC7C,IAAI,CAAC,GAAG,GAAG,CAAC;QACZ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE;YAAE,CAAC,IAAI,gBAAgB,CAAC,aAAa,CAAC;QACpE,OAAO,CAAC,CAAC;IACX,CAAC;IAaD;;OAEG;IACa,QAAQ,CAAC,IAAc;QACrC,MAAM,EAAE,GAAG,IAAI,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;QACpC,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,GAAG,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACtD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;YACxB,IAAI,C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C;IACD;;;;OAIG;IACI,aAAa,CAAC,OAAiB;QACpC,OAAO,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC/C,CAAC;;AArBD,uCAAuC;AAChB,mCAAY,GAAG,UAAU,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Numerics\n */\n\nimport { Geometry } from \"../Geometry\";\nimport { GrowableBlockedArray } from \"../geometry3d/GrowableBlockedArray\";\nimport { GrowableXYArray } from \"../geometry3d/GrowableXYArray\";\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\nimport { Point2d } from \"../geometry3d/Point2dVector2d\";\nimport { Point3d } from \"../geometry3d/Point3dVector3d\";\n\n/**\n * Blocked array with operations to sort and cluster with a tolerance.\n * * Primary sorting is along an \"arbitrary\" sort vector.\n * @internal\n */\nexport class ClusterableArray extends GrowableBlockedArray {\n // (This is pretty strange)\n // The sort vector is (1,c, c*c, ...)\n // Setting c = 1 makes it 1,1,1 which may be useful for visual scans during debug.\n // c with some non-obvious digits makes it unlikely that there will be multiple points on a perpendicular to the sort vector.\n private static readonly _vectorFactor = 0.8732; // use 1.0 to rig easy tests.\n /** Return a component of the sort vector. */\n public static sortVectorComponent(index: number): number {\n let c = 1.0;\n for (let i = 1; i < index; i++) c *= ClusterableArray._vectorFactor;\n return c;\n }\n private _numCoordinatePerPoint: number;\n private _numExtraDataPerPoint: number;\n /**\n * @param numCoordinatePerPoint number of coordinates per point\n * @param numExtraDataPerPoint of extra data values per point.\n * @param initialBlockCapacity predicted number of points. (This does not have to be accurate)\n */\n public constructor(numCoordinatePerPoint: number, numExtraDataPerPoint: number, initialBlockCapacity: number) {\n super(1 + numCoordinatePerPoint + numExtraDataPerPoint, initialBlockCapacity);\n this._numExtraDataPerPoint = numExtraDataPerPoint;\n this._numCoordinatePerPoint = numCoordinatePerPoint;\n }\n /** load a block, placing data[i] at block[i+1] to allow sort coordinate first.\n * @param data array of numDataPerBlock values.\n */\n public override addBlock(data: number[]) {\n const i0 = this.newBlockIndex() + 1;\n const n = Math.min(this.numPerBlock - 1, data.length);\n for (let i = 0; i < n; i++)\n this._data[i0 + i] = data[i];\n }\n /** add a block directly with 1 to 5 listed content parameters.\n * This assumes numDataPerPoint is sufficient for the parameters provided.\n */\n public addDirect(x0: number, x1?: number, x2?: number, x3?: number, x4?: number) {\n const i0 = this.newBlockIndex();\n this._data[i0 + 1] = x0;\n if (x1 !== undefined) this._data[i0 + 2] = x1;\n if (x2 !== undefined) this._data[i0 + 3] = x2;\n if (x3 !== undefined) this._data[i0 + 4] = x3;\n if (x4 !== undefined) this._data[i0 + 5] = x4;\n }\n\n /** add a block directly from a Point2d with 0 to 3 extras\n * This assumes numDataPerPoint is sufficient for the parameters provided.\n */\n public addPoint2d(xy: Point2d, a?: number, b?: number, c?: number) {\n const i0 = this.newBlockIndex();\n this._data[i0 + 1] = xy.x;\n this._data[i0 + 2] = xy.y;\n if (a !== undefined)\n this._data[i0 + 3] = a;\n if (b !== undefined)\n this._data[i0 + 4] = b;\n if (c !== undefined)\n this._data[i0 + 5] = c;\n }\n\n /** add a block with directly from a Point2d with 0 to 3 extras\n * This assumes numDataPerPoint is sufficient for the parameters provided.\n */\n public addPoint3d(xyz: Point3d, a?: number, b?: number, c?: number) {\n const i0 = this.newBlockIndex();\n this._data[i0 + 1] = xyz.x;\n this._data[i0 + 2] = xyz.y;\n this._data[i0 + 3] = xyz.z;\n if (a !== undefined)\n this._data[i0 + 4] = a;\n if (b !== undefined)\n this._data[i0 + 5] = b;\n if (c !== undefined)\n this._data[i0 + 6] = c;\n }\n /** Get the xy coordinates by point index. */\n public getPoint2d(blockIndex: number, result?: Point2d): Point2d {\n const i0 = this.blockIndexToDoubleIndex(blockIndex);\n return Point2d.create(this._data[i0 + 1], this._data[i0 + 2], result);\n }\n /** Get the xyZ coordinates by point index. */\n public getPoint3d(blockIndex: number, result?: Point3d): Point3d {\n const i0 = this.blockIndexToDoubleIndex(blockIndex);\n return Point3d.create(this._data[i0 + 1], this._data[i0 + 2], this._data[i0 + 3], result);\n }\n /** Return a single extra data value */\n public getExtraData(blockIndex: number, i: number): number {\n const i0 = this.blockIndexToDoubleIndex(blockIndex);\n return this._data[i0 + 1 + this._numCoordinatePerPoint + i];\n }\n /** Return a single data value */\n public getData(blockIndex: number, i: number): number {\n const i0 = this.blockIndexToDoubleIndex(blockIndex);\n return this._data[i0 + i];\n }\n\n /** Set a single extra data value */\n public setExtraData(blockIndex: number, i: number, value: number): void {\n const i0 = this.blockIndexToDoubleIndex(blockIndex);\n this._data[i0 + 1 + this._numCoordinatePerPoint + i] = value;\n }\n\n /** this value is used as cluster terminator in the Uint232Array of indices. */\n public static readonly clusterTerminator = 0xFFffFFff;\n /** Test if `x` is the cluster terminator value. */\n public static isClusterTerminator(x: number): boolean { return x === ClusterableArray.clusterTerminator; }\n /** Return an array giving clusters of blocks with similar coordinates.\n *\n * * The contents of each block is assumed to be set up so the primary sort coordinate is first.\n *\n * ** simple coordinate blocks (x,y) or (x,y,z) would work fine but have occasional performance problems because points with same x would generate big blocks of\n * candidates for clusters.\n * ** The usual solution is to sort by u value, which is a dot product along some skew direction, and have the blocks contain (u,x,y) or (u,x,y,z) for 2d versus 3d.\n * ** apply setupPrimaryClusterSort to prepare that!!!\n * * After a simple lexical sort, consecutive blocks that are within tolerance in the 0 component\n * are inspected. Within that candidate set, all blocks that are within tolerance for ALL components are clustered.\n * * In the output cluster array, clusters are terminated a invalid index. Test for the invalid index with GrowableBlockArray.isClusterTerminator (x)\n */\n public clusterIndicesLexical(clusterTolerance: number = Geometry.smallMetricDistance): Uint32Array {\n // install primary sort key\n this.setupPrimaryClusterSort();\n // presort by all coordinates ....\n const firstSort = this.sortIndicesLexical();\n const clusterIndices = new Uint32Array(2 * firstSort.length); // worst case: no duplicates, each index goes in followed by terminator.\n let m = 0; // number of cluster indices\n const n = this.numBlocks; // and this must match firstSort.length !!\n let clusterStartBlockIndex = 0;\n let candidateBlockIndex = 0;\n let barrierU = 0.0;\n let i = 0;\n let j = 0;\n\n const k0 = 1; // beginning of active column for distance\n const k1 = 1 + this._numCoordinatePerPoint;\n for (i = 0; i < n; i++) {\n clusterStartBlockIndex = firstSort[i];\n if (!ClusterableArray.isClusterTerminator(clusterStartBlockIndex)) {\n // unused block, so it becomes a cluster...\n clusterIndices[m++] = clusterStartBlockIndex;\n barrierU = this.component(clusterStartBlockIndex, 0) + clusterTolerance;\n firstSort[i] = ClusterableArray.clusterTerminator;\n for (j = i + 1; j < n; j++) {\n candidateBlockIndex = firstSort[j];\n if (candidateBlockIndex === ClusterableArray.clusterTerminator) continue; // nearby in sort direction but already in a cluster.\n if (this.component(candidateBlockIndex, 0) >= barrierU) break;\n if (this.distanceBetweenSubBlocks(clusterStartBlockIndex, candidateBlockIndex, k0, k1) < clusterTolerance) {\n clusterIndices[m++] = candidateBlockIndex; // The candidate is in the block\n firstSort[j] = ClusterableArray.clusterTerminator; // and it will not be reused as future block base\n }\n }\n clusterIndices[m++] = ClusterableArray.clusterTerminator;\n }\n }\n // Alas, the clusterIndices array has fluff at the end. So it has to be copied.\n return clusterIndices.slice(0, m);\n }\n /** setup (overwrite!!) the \"0\" component with the dot product of numClusterCoordinate later components with a non-axis aligned vector.\n * This is normally called before clusterIndicesLexical.\n */\n public setupPrimaryClusterSort() {\n const nb = this.numBlocks;\n const nc = this._numCoordinatePerPoint;\n const vector = new Float64Array(nc);\n vector[0] = 1.0;\n for (let c = 1; c < nc; c++) vector[c] = vector[c - 1] * ClusterableArray._vectorFactor;\n let k = 0;\n let dot = 0.0;\n const data = this._data;\n for (let b = 0; b < nb; b++) {\n k = this.blockIndexToDoubleIndex(b);\n dot = 0.0;\n for (let c = 0; c < nc; c++) { dot += vector[c] * data[k + 1 + c]; }\n data[k] = dot;\n }\n }\n /** Convert the cluster data to an array of tuples with point i in the form\n * `[i, primarySortCoordinate, [x,y,..], [extraData0, extraData1, ...]]`\n */\n public toJSON(): any[] {\n const result: any[] = [];\n for (let b = 0; b < this.numBlocks; b++) {\n let i = this.blockIndexToDoubleIndex(b);\n const chunk: any[] = [b, this._data[i++]];\n const coordinates = [];\n for (let c = 0; c < this._numCoordinatePerPoint; c++)coordinates.push(this._data[i++]);\n chunk.push(coordinates);\n for (let c = 0; c < this._numExtraDataPerPoint; c++)\n chunk.push(this._data[i++]);\n result.push(chunk);\n }\n return result;\n }\n /**\n * Return an array of indices from block index to cluster index.\n * @param clusteredBlocks clusters of block indices followed by separators.\n */\n public createIndexBlockToClusterIndex(clusteredBlocks: Uint32Array): Uint32Array {\n const numBlocks = this.numBlocks;\n const blockToCluster = new Uint32Array(numBlocks);\n blockToCluster.fill(ClusterableArray.clusterTerminator);\n let numCluster = 0;\n for (const b of clusteredBlocks) {\n if (b >= numBlocks) {\n numCluster++;\n } else {\n blockToCluster[b] = numCluster;\n }\n }\n return blockToCluster;\n }\n /**\n * Return an array of indices from block index to index of its cluster's start in the cluster index array.\n * @param clusteredBlocks clusters of block indices followed by separators.\n */\n public createIndexBlockToClusterStart(clusteredBlocks: Uint32Array): Uint32Array {\n const n = clusteredBlocks.length;\n const numBlocks = this.numBlocks;\n const blockToClusterStart = new Uint32Array(numBlocks);\n const terminator = ClusterableArray.clusterTerminator;\n blockToClusterStart.fill(terminator);\n let clusterStart = 0;\n for (let i = 0; i < n; i++) {\n const k = clusteredBlocks[i];\n if (k > numBlocks) {\n clusterStart = i + 1;\n } else {\n blockToClusterStart[k] = clusterStart;\n }\n }\n return blockToClusterStart;\n }\n /** count the clusters in the clusteredBlocks array. */\n public countClusters(clusteredBlocks: Uint32Array): number {\n let numClusters = 0;\n const terminator = ClusterableArray.clusterTerminator;\n for (const b of clusteredBlocks) {\n if (b === terminator)\n numClusters++;\n }\n return numClusters;\n }\n /** create a reverse index: given a cluster index k, clusterToClusterStart[k] is the place\n * the cluster's block indices appear in clusterBlocks\n */\n public createIndexClusterToClusterStart(clusteredBlocks: Uint32Array): Uint32Array {\n let numCluster = this.countClusters(clusteredBlocks);\n const clusterToClusterStart = new Uint32Array(numCluster);\n const terminator = ClusterableArray.clusterTerminator;\n clusterToClusterStart.fill(terminator);\n const n = clusteredBlocks.length;\n let clusterStart = 0;\n for (let i = 0; i < n; i++) {\n const k = clusteredBlocks[i];\n if (k === terminator) {\n clusterStart = i + 1;\n } else if (i === clusterStart) {\n clusterToClusterStart[numCluster++] = clusterStart;\n }\n }\n return clusterToClusterStart;\n }\n\n /**\n * Sort terminator-delimited subsets of an array of indices into the table, using a single data value as sort key.\n * @param blockedIndices indices, organized as blocks of good indices terminated by the clusterTerminator. Each block is individually sorted on return.\n * @param dataIndex index of the data key, e.g., if the sort key is the first extraData (angle) after x and y coordinate data, pass dataIndex = 2.\n */\n public sortSubsetsBySingleKey(blockedIndices: Uint32Array, dataIndex: number) {\n const dataOffset = 1 + dataIndex;\n let kBegin = 0;\n let swap;\n let key0, key1;\n const numK = blockedIndices.length;\n for (let kEnd = 0; kEnd < numK; kEnd++) {\n if (blockedIndices[kEnd] === ClusterableArray.clusterTerminator) {\n // bubble sort blockedIndices[kBegin <= k < kEnd].\n // (search for minimum remaining, swap . . )\n for (let k0 = kBegin; k0 + 1 < kEnd; k0++) {\n key0 = this.getWithinBlock(blockedIndices[k0], dataOffset);\n for (let k1 = k0 + 1; k1 < kEnd; k1++) {\n key1 = this.getWithinBlock(blockedIndices[k1], dataOffset);\n if (key1 < key0) {\n swap = blockedIndices[k0];\n blockedIndices[k0] = blockedIndices[k1];\n blockedIndices[k1] = swap;\n key0 = key1;\n }\n }\n }\n kBegin = kEnd + 1;\n }\n }\n }\n /**\n * Returns packed points with indices mapping old to new.\n * @param data points to cluster.\n */\n public static clusterPoint3dArray(data: Point3d[], tolerance: number = Geometry.smallMetricDistance):\n PackedPointsWithIndex {\n const clusterArray = new ClusterableArray(3, 0, data.length);\n data.forEach((p: Point3d) => {\n clusterArray.addDirect(p.x, p.y, p.z);\n });\n const order = clusterArray.clusterIndicesLexical(tolerance);\n const result = new PackedPointsWithIndex(data.length);\n let currentClusterIndex = 0;\n let numThisCluster = 0;\n order.forEach((k: number) => {\n if (ClusterableArray.isClusterTerminator(k)) {\n currentClusterIndex++;\n numThisCluster = 0;\n } else {\n if (numThisCluster === 0)\n result.packedPoints.push(data[k].clone());\n result.oldToNew[k] = currentClusterIndex;\n numThisCluster++;\n }\n });\n return result;\n }\n\n /**\n * Returns number array with indices mapping old to new.\n * @param data numbers to cluster.\n */\n public static clusterNumberArray(data: number[], tolerance: number = Geometry.smallMetricDistance): PackedNumbersWithIndex {\n const clusterArray = new ClusterableArray(1, 0, data.length);\n data.forEach((x: number) => {clusterArray.addDirect(x);});\n const order = clusterArray.clusterIndicesLexical(tolerance);\n const result = new PackedNumbersWithIndex(data.length);\n let currentClusterIndex = 0;\n let numThisCluster = 0;\n order.forEach((k: number) => {\n if (ClusterableArray.isClusterTerminator(k)) {\n currentClusterIndex++;\n numThisCluster = 0;\n } else {\n if (numThisCluster === 0)\n result.packedNumbers.push(data[k]);\n result.oldToNew[k] = currentClusterIndex;\n numThisCluster++;\n }\n });\n return result;\n }\n\n /**\n * Returns packed points with indices mapping old to new.\n * @param data points to cluster.\n */\n public static clusterGrowablePoint2dArray(source: GrowableXYArray, tolerance: number = Geometry.smallMetricDistance): PackedPoint2dsWithIndex {\n const clusterArray = new ClusterableArray(2, 0, source.length);\n const p = Point2d.create();\n const numSourcePoint = source.length;\n for (let i = 0; i < numSourcePoint; i++) {\n source.getPoint2dAtUncheckedPointIndex(i, p);\n clusterArray.addDirect(p.x, p.y);\n }\n const order = clusterArray.clusterIndicesLexical(tolerance);\n const numPackedPoints = clusterArray.countClusters(order);\n const result = new PackedPoint2dsWithIndex(source.length, numPackedPoints);\n let currentClusterIndex = 0;\n let numThisCluster = 0;\n order.forEach((k: number) => {\n if (ClusterableArray.isClusterTerminator(k)) {\n currentClusterIndex++;\n numThisCluster = 0;\n } else {\n if (numThisCluster === 0) // This is the first encounter with a new cluster\n result.growablePackedPoints.pushFromGrowableXYArray(source, k);\n result.oldToNew[k] = currentClusterIndex;\n numThisCluster++;\n }\n });\n return result;\n }\n\n /**\n * Returns packed points with indices mapping old to new.\n * @param data points to cluster.\n */\n public static clusterGrowablePoint3dArray(source: GrowableXYZArray, tolerance: number = Geometry.smallMetricDistance):\n PackedPointsWithIndex {\n const clusterArray = new ClusterableArray(3, 0, source.length);\n const p = Point3d.create();\n const numSourcePoint = source.length;\n for (let i = 0; i < numSourcePoint; i++) {\n source.getPoint3dAtUncheckedPointIndex(i, p);\n clusterArray.addDirect(p.x, p.y, p.z);\n }\n const order = clusterArray.clusterIndicesLexical(tolerance);\n const result = new PackedPointsWithIndex(source.length);\n const numPackedPoints = clusterArray.countClusters(order);\n result.growablePackedPoints = new GrowableXYZArray(numPackedPoints);\n let currentClusterIndex = 0;\n let numThisCluster = 0;\n order.forEach((k: number) => {\n if (ClusterableArray.isClusterTerminator(k)) {\n currentClusterIndex++;\n numThisCluster = 0;\n } else {\n if (numThisCluster === 0) // This is the first encounter with a new cluster\n result.growablePackedPoints!.pushFromGrowableXYZArray(source, k);\n result.oldToNew[k] = currentClusterIndex;\n numThisCluster++;\n }\n });\n return result;\n }\n}\n\n/**\n * @internal\n */\nfunction updateIndices(indices: number[], oldToNew: Uint32Array): boolean {\n let numErrors = 0;\n indices.forEach((value: number, i: number, data: number[]) => {\n if (value < oldToNew.length) {\n data[i] = oldToNew[value];\n } else numErrors++;\n });\n return numErrors === 0;\n}\n\n/**\n * Data carrier class for\n * * packedPoints = an array of Point3d\n * * oldToNew = array of indices from some prior Point3d[] to the packed points.\n * @internal\n */\nclass PackedPointsWithIndex {\n /** Array of Point3d */\n public packedPoints: Point3d[];\n /** array of coordinates packed in GrowableXYZArray */\n public growablePackedPoints: GrowableXYZArray | undefined;\n /** mapping from old point index to new point index. */\n public oldToNew: Uint32Array;\n /** integer value for unknown index. */\n public static readonly invalidIndex = 0xFFFFffff;\n\n /** construct a PackedPoints object with\n * * empty packedPoints array\n * * oldToNew indices all initialized to PackedPoints.invalidIndex\n */\n constructor(numOldIndexEntry: number) {\n this.packedPoints = [];\n this.oldToNew = new Uint32Array(numOldIndexEntry);\n for (let i = 0; i < numOldIndexEntry; i++) {\n this.oldToNew[i] = PackedPointsWithIndex.invalidIndex;\n }\n }\n /**\n * Use the oldToNew array to update an array of \"old\" indices.\n * @param indices array of indices into prepacked array.\n * @returns true if all input indices were valid for the oldToNew array.\n */\n public updateIndices(indices: number[]): boolean {\n return updateIndices(indices, this.oldToNew);\n }\n}\n\n/**\n * @internal\n */\nclass PackedPoint2dsWithIndex {\n /** array of coordinates packed in GrowableXYArray */\n public growablePackedPoints: GrowableXYArray;\n /** mapping from old point index to new point index. */\n public oldToNew: Uint32Array;\n /** integer value for unknown index. */\n public static readonly invalidIndex = 0xFFFFffff;\n\n /** construct a PackedPoints object with\n * * empty packedPoints array\n * * oldToNew indices all initialized to PackedPoints.invalidIndex\n */\n constructor(numOldIndexEntry: number, numPackedPoints: number) {\n this.growablePackedPoints = new GrowableXYArray(numPackedPoints);\n this.oldToNew = new Uint32Array(numOldIndexEntry);\n for (let i = 0; i < numOldIndexEntry; i++) {\n this.oldToNew[i] = PackedPoint2dsWithIndex.invalidIndex;\n }\n }\n /**\n * Use the oldToNew array to update an array of \"old\" indices.\n * @param indices array of indices into prepacked array.\n * @returns true if all input indices were valid for the oldToNew array.\n */\n public updateIndices(indices: number[]): boolean {\n return updateIndices(indices, this.oldToNew);\n }\n}\n\n/**\n * @internal\n */\n class PackedNumbersWithIndex {\n /** Array of numbers */\n public packedNumbers: number[];\n /** mapping from old point index to new point index. */\n public oldToNew: Uint32Array;\n /** integer value for unknown index. */\n public static readonly invalidIndex = 0xFFFFffff;\n\n /** construct a PackedNumbers object with\n * * empty packedNumbers array\n * * oldToNew indices all initialized to PackedNumbers.invalidIndex\n */\n constructor(numOldIndexEntry: number) {\n this.packedNumbers = [];\n this.oldToNew = new Uint32Array(numOldIndexEntry);\n for (let i = 0; i < numOldIndexEntry; i++) {\n this.oldToNew[i] = PackedPointsWithIndex.invalidIndex;\n }\n }\n /**\n * Use the oldToNew array to update an array of \"old\" indices.\n * @param indices array of indices into prepacked array.\n * @returns true if all input indices were valid for the oldToNew array.\n */\n public updateIndices(indices: number[]): boolean {\n return updateIndices(indices, this.oldToNew);\n }\n}\n"]}
|
|
@@ -353,10 +353,10 @@ export declare class HalfEdge {
|
|
|
353
353
|
/** Returns Returns true if the face has positive area in xy parts. */
|
|
354
354
|
static testFacePositiveAreaXY(node: HalfEdge): boolean;
|
|
355
355
|
/** Return true if x and y coordinates of this and other are exactly equal */
|
|
356
|
-
isEqualXY(other: XAndY): boolean;
|
|
357
|
-
/** Return
|
|
356
|
+
isEqualXY(other: XAndY | HalfEdge): boolean;
|
|
357
|
+
/** Return distance between xy coordinates of this and other node */
|
|
358
358
|
distanceXY(other: HalfEdge): number;
|
|
359
|
-
/** Return
|
|
359
|
+
/** Return distance between xyz coordinates of this and other node */
|
|
360
360
|
distanceXYZ(other: HalfEdge): number;
|
|
361
361
|
/**
|
|
362
362
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Graph.d.ts","sourceRoot":"","sources":["../../../src/topology/Graph.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AASvD;;;;;;;;;;GAUG;AACH,oBAAY,YAAY;IACtB;;;;OAIG;IACH,QAAQ,IAAa;IACrB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