From b4ef756d25d5aab45342e9674ec7542c953b0e0e Mon Sep 17 00:00:00 2001 From: "Saeed.Torabi" <114527638+saeeedtorabi@users.noreply.github.com> Date: Wed, 15 Oct 2025 11:21:12 -0400 Subject: [PATCH 1/5] Add log for verifyVoronoiTopology --- .../saeed-torabi-voronoi-test_2025-10-15-15-20.json | 10 ++++++++++ core/geometry/src/test/topology/Voronoi.test.ts | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 common/changes/@itwin/core-geometry/saeed-torabi-voronoi-test_2025-10-15-15-20.json diff --git a/common/changes/@itwin/core-geometry/saeed-torabi-voronoi-test_2025-10-15-15-20.json b/common/changes/@itwin/core-geometry/saeed-torabi-voronoi-test_2025-10-15-15-20.json new file mode 100644 index 000000000000..9d7216f28509 --- /dev/null +++ b/common/changes/@itwin/core-geometry/saeed-torabi-voronoi-test_2025-10-15-15-20.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@itwin/core-geometry", + "comment": "", + "type": "none" + } + ], + "packageName": "@itwin/core-geometry" +} \ No newline at end of file diff --git a/core/geometry/src/test/topology/Voronoi.test.ts b/core/geometry/src/test/topology/Voronoi.test.ts index fd40896357be..3fe04aa388e3 100644 --- a/core/geometry/src/test/topology/Voronoi.test.ts +++ b/core/geometry/src/test/topology/Voronoi.test.ts @@ -115,7 +115,7 @@ function verifyVoronoiTopology(ck: Checker, v: Voronoi): void { if (ck.testExactNumber(vFaces.length, testPoints.length, "findContainingFaceXY returned one entry per point")) { for (let i = 0; i < vFaces.length; i++) { const vFace = vFaces[i]; - if (ck.testDefined(vFace, "interior point containing face found")) { + if (ck.testDefined(vFace, `expect point ${JSON.stringify(testPoints[i].toJSON())} to be found in an interior Voronoi face`)) { const dGenerator = v.getInputGraph.allHalfEdges[vFace.faceTag]; let closestPoints = searcher.searchForClosestPoint(testPoints[i], Number.POSITIVE_INFINITY) as CurveLocationDetail[] | undefined; if (ck.testDefined(closestPoints, "closest Delaunay vertex found")) { @@ -926,7 +926,7 @@ describe("Voronoi", () => { const graph = PolyfaceQuery.convertToHalfEdgeGraph(mesh); const testPoints: Point3d[] = []; for (let i = 0; i < 100; i++) // sample some interior points - testPoints.push(Point3d.create(getRandomNumberScaled(side, 1/side), getRandomNumberScaled(side, 1/side))); + testPoints.push(Point3d.create(getRandomNumberScaled(side, 1 / side), getRandomNumberScaled(side, 1 / side))); testPoints.push(Point3d.create(-1, -1)); // and one exterior point GeometryCoreTestIO.createAndCaptureXYCircle(allGeometry, testPoints, 0.1); const containingFaces = HalfEdgeGraphSearch.findContainingFaceXY(graph, testPoints) as (HalfEdge | undefined)[] | undefined; From 636cc97a9dab9cfc42959172ffbd59dc4bcc1edc Mon Sep 17 00:00:00 2001 From: "Saeed.Torabi" <114527638+saeeedtorabi@users.noreply.github.com> Date: Wed, 15 Oct 2025 11:45:28 -0400 Subject: [PATCH 2/5] Log test name --- .../src/test/topology/Voronoi.test.ts | 76 +++++++++++-------- 1 file changed, 45 insertions(+), 31 deletions(-) diff --git a/core/geometry/src/test/topology/Voronoi.test.ts b/core/geometry/src/test/topology/Voronoi.test.ts index 3fe04aa388e3..2573c13d6b69 100644 --- a/core/geometry/src/test/topology/Voronoi.test.ts +++ b/core/geometry/src/test/topology/Voronoi.test.ts @@ -3,7 +3,7 @@ import * as fs from "fs"; * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ -import { describe, expect, it } from "vitest"; +import { describe, expect, it, test } from "vitest"; import { InterpolationCurve3d, InterpolationCurve3dOptions } from "../../bspline/InterpolationCurve3d"; import { ClipUtilities } from "../../clipping/ClipUtils"; import { Arc3d } from "../../curve/Arc3d"; @@ -62,10 +62,20 @@ function visualizeGraphEdges(allGeometry: GeometryQuery[], graph: HalfEdgeGraph, * @param showDelaunay whether to visualize the Delaunay triangulation. * @param showClippers whether to visualize the curve-based Voronoi super faces as UnionRegions derived from the clippers instead. */ -function visualizeAndVerifyCurveBasedVoronoiDiagram(ck: Checker, allGeometry: GeometryQuery[], path: CurveChain, strokeOptions?: StrokeOptions, distanceTol?: number, bbox?: LowAndHighXY, showDelaunay?: boolean, showClippers?: boolean): void { +function visualizeAndVerifyCurveBasedVoronoiDiagram( + ck: Checker, + allGeometry: GeometryQuery[], + path: CurveChain, + strokeOptions?: StrokeOptions, + distanceTol?: number, + bbox?: LowAndHighXY, + showDelaunay?: boolean, + showClippers?: boolean, + testName?: string, +): void { const voronoi = Voronoi.createFromCurveChain(path, strokeOptions, distanceTol, bbox); if (ck.testDefined(voronoi, "created Voronoi instance")) { - verifyVoronoiTopology(ck, voronoi); + verifyVoronoiTopology(ck, voronoi, testName); ck.testTrue(voronoi.isCurveBased, "Voronoi instance is curve-based"); if (showDelaunay) GeometryCoreTestIO.captureCloneGeometry(allGeometry, PolyfaceBuilder.graphToPolyface(voronoi.getInputGraph, undefined, undefined, () => true)); @@ -98,7 +108,7 @@ function visualizeAndVerifyCurveBasedVoronoiDiagram(ck: Checker, allGeometry: Ge } /** Verify the faces of the Voronoi graph consist of points closest to the expected Delaunay vertex. */ -function verifyVoronoiTopology(ck: Checker, v: Voronoi): void { +function verifyVoronoiTopology(ck: Checker, v: Voronoi, testName?: string): void { const dVertices = v.getInputGraph.collectVertexLoops(); const searcher = Point3dArrayRangeTreeContext.createCapture(dVertices, undefined, undefined, true); if (ck.testDefined(searcher, "searcher for Delaunay vertices is defined")) { @@ -115,7 +125,11 @@ function verifyVoronoiTopology(ck: Checker, v: Voronoi): void { if (ck.testExactNumber(vFaces.length, testPoints.length, "findContainingFaceXY returned one entry per point")) { for (let i = 0; i < vFaces.length; i++) { const vFace = vFaces[i]; - if (ck.testDefined(vFace, `expect point ${JSON.stringify(testPoints[i].toJSON())} to be found in an interior Voronoi face`)) { + const errorMessage = + testName ? + `expect point ${JSON.stringify(testPoints[i].toJSON())} to be found in an interior Voronoi face for test ${testName}` : + `expect point ${JSON.stringify(testPoints[i].toJSON())} to be found in an interior Voronoi face`; + if (ck.testDefined(vFace, errorMessage)) { const dGenerator = v.getInputGraph.allHalfEdges[vFace.faceTag]; let closestPoints = searcher.searchForClosestPoint(testPoints[i], Number.POSITIVE_INFINITY) as CurveLocationDetail[] | undefined; if (ck.testDefined(closestPoints, "closest Delaunay vertex found")) { @@ -212,7 +226,7 @@ describe("Voronoi", () => { visualizeGraphEdges(allGeometry, voronoiGraph); ck.testExactNumber(voronoiGraph.collectFaceLoops().length, 3, "voronoiGraph should have 3 faces"); ck.testExactNumber(voronoiGraph.allHalfEdges.length / 2, 7, "voronoiGraph should have 7 edges"); - verifyVoronoiTopology(ck, voronoi); + verifyVoronoiTopology(ck, voronoi, "ColinearPoints0"); } let dx = 6; @@ -229,7 +243,7 @@ describe("Voronoi", () => { visualizeGraphEdges(allGeometry, voronoiGraph, dx); ck.testExactNumber(voronoiGraph.collectFaceLoops().length, 3, "voronoiGraph should have 3 faces"); ck.testExactNumber(voronoiGraph.allHalfEdges.length / 2, 7, "voronoiGraph should have 7 edges"); - verifyVoronoiTopology(ck, voronoi); + verifyVoronoiTopology(ck, voronoi, "ColinearPoints1"); } dx += 5; @@ -246,7 +260,7 @@ describe("Voronoi", () => { visualizeGraphEdges(allGeometry, voronoiGraph, dx); ck.testExactNumber(voronoiGraph.collectFaceLoops().length, 3, "voronoiGraph should have 3 faces"); ck.testExactNumber(voronoiGraph.allHalfEdges.length / 2, 5, "voronoiGraph should have 5 edges"); - verifyVoronoiTopology(ck, voronoi); + verifyVoronoiTopology(ck, voronoi, "ColinearPoints2"); } dx += 6; @@ -263,7 +277,7 @@ describe("Voronoi", () => { visualizeGraphEdges(allGeometry, voronoiGraph, dx); ck.testExactNumber(voronoiGraph.collectFaceLoops().length, 3, "voronoiGraph should have 3 faces"); ck.testExactNumber(voronoiGraph.allHalfEdges.length / 2, 7, "voronoiGraph should have 7 edges"); - verifyVoronoiTopology(ck, voronoi); + verifyVoronoiTopology(ck, voronoi, "ColinearPoints3"); } // 3d single edge graph @@ -281,7 +295,7 @@ describe("Voronoi", () => { visualizeGraphEdges(allGeometry, voronoiGraph, dx); ck.testExactNumber(voronoiGraph.collectFaceLoops().length, 3, "voronoiGraph should have 3 faces"); ck.testExactNumber(voronoiGraph.allHalfEdges.length / 2, 7, "voronoiGraph should have 7 edges"); - verifyVoronoiTopology(ck, voronoi); + verifyVoronoiTopology(ck, voronoi, "ColinearPoints4"); } dx += 9; @@ -300,7 +314,7 @@ describe("Voronoi", () => { visualizeGraphEdges(allGeometry, voronoiGraph, dx); ck.testExactNumber(voronoiGraph.collectFaceLoops().length, 4, "voronoiGraph should have 4 faces"); ck.testExactNumber(voronoiGraph.allHalfEdges.length / 2, 10, "voronoiGraph should have 10 edges"); - verifyVoronoiTopology(ck, voronoi); + verifyVoronoiTopology(ck, voronoi, "ColinearPoints4"); } dx += 11; points = [[-1, -1], [1, 1], [4, 4]]; @@ -318,7 +332,7 @@ describe("Voronoi", () => { visualizeGraphEdges(allGeometry, voronoiGraph, dx); ck.testExactNumber(voronoiGraph.collectFaceLoops().length, 4, "voronoiGraph should have 4 faces"); ck.testExactNumber(voronoiGraph.allHalfEdges.length / 2, 10, "voronoiGraph should have 10 edges"); - verifyVoronoiTopology(ck, voronoi); + verifyVoronoiTopology(ck, voronoi, "ColinearPoints5"); } dx += 9; @@ -339,7 +353,7 @@ describe("Voronoi", () => { visualizeGraphEdges(allGeometry, voronoiGraph, dx); ck.testExactNumber(voronoiGraph.collectFaceLoops().length, 5, "voronoiGraph should have 5 faces"); ck.testExactNumber(voronoiGraph.allHalfEdges.length / 2, 13, "voronoiGraph should have 13 edges"); - verifyVoronoiTopology(ck, voronoi); + verifyVoronoiTopology(ck, voronoi, "ColinearPoints6"); } GeometryCoreTestIO.saveGeometry(allGeometry, "Voronoi", "ColinearPoints"); @@ -372,7 +386,7 @@ describe("Voronoi", () => { visualizeGraphEdges(allGeometry, voronoiGraph); ck.testExactNumber(voronoiGraph.collectFaceLoops().length, 4, "voronoiGraph should have 4 faces"); ck.testExactNumber(voronoiGraph.allHalfEdges.length / 2, 10, "voronoiGraph should have 10 edges"); - verifyVoronoiTopology(ck, voronoi); + verifyVoronoiTopology(ck, voronoi, "GraphWith1Triangle0"); } const dy = 8; @@ -399,7 +413,7 @@ describe("Voronoi", () => { visualizeGraphEdges(allGeometry, voronoiGraph, dx); ck.testExactNumber(voronoiGraph.collectFaceLoops().length, 4, "voronoiGraph from points should have 4 faces"); ck.testExactNumber(voronoiGraph.allHalfEdges.length / 2, 10, "voronoiGraph from points should have 10 edges"); - verifyVoronoiTopology(ck, voronoi); + verifyVoronoiTopology(ck, voronoi, "GraphWith1Triangle1"); } } @@ -416,7 +430,7 @@ describe("Voronoi", () => { visualizeGraphEdges(allGeometry, voronoiGraph, dx); ck.testExactNumber(voronoiGraph.collectFaceLoops().length, 4, "voronoiGraph for 3d should have 4 faces"); ck.testExactNumber(voronoiGraph.allHalfEdges.length / 2, 10, "voronoiGraph for 3d should have 10 edges"); - verifyVoronoiTopology(ck, voronoi); + verifyVoronoiTopology(ck, voronoi, "GraphWith1Triangle2"); } } @@ -433,7 +447,7 @@ describe("Voronoi", () => { visualizeGraphEdges(allGeometry, voronoiGraph, dx); ck.testExactNumber(voronoiGraph.collectFaceLoops().length, 4, "voronoiGraph from points should have 4 faces"); ck.testExactNumber(voronoiGraph.allHalfEdges.length / 2, 10, "voronoiGraph from points should have 10 edges"); - verifyVoronoiTopology(ck, voronoi); + verifyVoronoiTopology(ck, voronoi, "GraphWith1Triangle3"); } } @@ -475,7 +489,7 @@ describe("Voronoi", () => { visualizeGraphEdges(allGeometry, voronoiGraph); ck.testExactNumber(voronoiGraph.collectFaceLoops().length, 5, "voronoiGraph should have 5 faces"); ck.testExactNumber(voronoiGraph.allHalfEdges.length / 2, 13, "voronoiGraph should have 13 edges"); - verifyVoronoiTopology(ck, voronoi); + verifyVoronoiTopology(ck, voronoi, "GraphWith2Triangles0"); } const dy = 11; @@ -502,7 +516,7 @@ describe("Voronoi", () => { visualizeGraphEdges(allGeometry, voronoiGraph, dx); ck.testExactNumber(voronoiGraph.collectFaceLoops().length, 5, "voronoiGraph should have 5 faces"); ck.testExactNumber(voronoiGraph.allHalfEdges.length / 2, 13, "voronoiGraph should have 13 edges"); - verifyVoronoiTopology(ck, voronoi); + verifyVoronoiTopology(ck, voronoi, "GraphWith2Triangles1"); } } @@ -518,7 +532,7 @@ describe("Voronoi", () => { visualizeGraphEdges(allGeometry, voronoiGraph, dx); ck.testExactNumber(voronoiGraph.collectFaceLoops().length, 5, "voronoiGraph should have 5 faces"); ck.testExactNumber(voronoiGraph.allHalfEdges.length / 2, 12, "voronoiGraph should have 12 edges"); - verifyVoronoiTopology(ck, voronoi); + verifyVoronoiTopology(ck, voronoi, "GraphWith2Triangles2"); } } @@ -535,7 +549,7 @@ describe("Voronoi", () => { visualizeGraphEdges(allGeometry, voronoiGraph, dx); ck.testExactNumber(voronoiGraph.collectFaceLoops().length, 5, "voronoiGraph for 3d should have 5 faces"); ck.testExactNumber(voronoiGraph.allHalfEdges.length / 2, 12, "voronoiGraph for 3d should have 12 edges"); - verifyVoronoiTopology(ck, voronoi); + verifyVoronoiTopology(ck, voronoi, "GraphWith2Triangles3"); } } @@ -552,7 +566,7 @@ describe("Voronoi", () => { visualizeGraphEdges(allGeometry, voronoiGraph, dx); ck.testExactNumber(voronoiGraph.collectFaceLoops().length, 5, "voronoiGraph from points should have 5 faces"); ck.testExactNumber(voronoiGraph.allHalfEdges.length / 2, 13, "voronoiGraph from points should have 13 edges"); - verifyVoronoiTopology(ck, voronoi); + verifyVoronoiTopology(ck, voronoi, "GraphWith2Triangles4"); } } @@ -569,7 +583,7 @@ describe("Voronoi", () => { visualizeGraphEdges(allGeometry, voronoiGraph, dx); ck.testExactNumber(voronoiGraph.collectFaceLoops().length, 5, "voronoiGraph from points should have 5 faces"); ck.testExactNumber(voronoiGraph.allHalfEdges.length / 2, 13, "voronoiGraph from points should have 13 edges"); - verifyVoronoiTopology(ck, voronoi); + verifyVoronoiTopology(ck, voronoi, "GraphWith2Triangles5"); } } @@ -595,7 +609,7 @@ describe("Voronoi", () => { visualizeGraphEdges(allGeometry, voronoiGraph); ck.testExactNumber(voronoiGraph.collectFaceLoops().length, 6, "voronoiGraph should have 6 faces"); ck.testExactNumber(voronoiGraph.allHalfEdges.length / 2, 16, "voronoiGraph should have 16 edges"); - verifyVoronoiTopology(ck, voronoi); + verifyVoronoiTopology(ck, voronoi, "GraphWith3Triangles0"); } } @@ -612,7 +626,7 @@ describe("Voronoi", () => { visualizeGraphEdges(allGeometry, voronoiGraph, dx); ck.testExactNumber(voronoiGraph.collectFaceLoops().length, 6, "voronoiGraph for 3d should have 6 faces"); ck.testExactNumber(voronoiGraph.allHalfEdges.length / 2, 16, "voronoiGraph for 3d should have 16 edges"); - verifyVoronoiTopology(ck, voronoi); + verifyVoronoiTopology(ck, voronoi, "GraphWith3Triangles1"); } } @@ -629,7 +643,7 @@ describe("Voronoi", () => { visualizeGraphEdges(allGeometry, voronoiGraph, dx); ck.testExactNumber(voronoiGraph.collectFaceLoops().length, 6, "voronoiGraph should have 6 faces"); ck.testExactNumber(voronoiGraph.allHalfEdges.length / 2, 16, "voronoiGraph should have 16 edges"); - verifyVoronoiTopology(ck, voronoi); + verifyVoronoiTopology(ck, voronoi, "GraphWith3Triangles2"); } } @@ -655,7 +669,7 @@ describe("Voronoi", () => { visualizeGraphEdges(allGeometry, voronoiGraph); ck.testExactNumber(voronoiGraph.collectFaceLoops().length, 6, "voronoiGraph should have 6 faces"); ck.testExactNumber(voronoiGraph.allHalfEdges.length / 2, 16, "voronoiGraph should have 16 edges"); - verifyVoronoiTopology(ck, voronoi); + verifyVoronoiTopology(ck, voronoi, "GraphWith4Triangles0"); } } @@ -672,7 +686,7 @@ describe("Voronoi", () => { visualizeGraphEdges(allGeometry, voronoiGraph, dx); ck.testExactNumber(voronoiGraph.collectFaceLoops().length, 6, "voronoiGraph for 3d should have 6 faces"); ck.testExactNumber(voronoiGraph.allHalfEdges.length / 2, 16, "voronoiGraph for 3d should have 16 edges"); - verifyVoronoiTopology(ck, voronoi); + verifyVoronoiTopology(ck, voronoi, "GraphWith4Triangles1"); } } @@ -689,7 +703,7 @@ describe("Voronoi", () => { visualizeGraphEdges(allGeometry, voronoiGraph, dx); ck.testExactNumber(voronoiGraph.collectFaceLoops().length, 6, "voronoiGraph should have 6 faces"); ck.testExactNumber(voronoiGraph.allHalfEdges.length / 2, 16, "voronoiGraph should have 16 edges"); - verifyVoronoiTopology(ck, voronoi); + verifyVoronoiTopology(ck, voronoi, "GraphWith4Triangles2"); } } @@ -715,7 +729,7 @@ describe("Voronoi", () => { visualizeGraphEdges(allGeometry, voronoiGraph); ck.testExactNumber(voronoiGraph.collectFaceLoops().length, 11, "voronoiGraph should have 11 faces"); ck.testExactNumber(voronoiGraph.allHalfEdges.length / 2, 31, "voronoiGraph should have 31 edges"); - verifyVoronoiTopology(ck, voronoi); + verifyVoronoiTopology(ck, voronoi, "GraphWithManyTriangles0"); } } @@ -735,7 +749,7 @@ describe("Voronoi", () => { visualizeGraphEdges(allGeometry, voronoiGraph, dx); ck.testExactNumber(voronoiGraph.collectFaceLoops().length, 11, "voronoiGraph for 3d should have 11 faces"); ck.testExactNumber(voronoiGraph.allHalfEdges.length / 2, 31, "voronoiGraph for 3d should have 31 edges"); - verifyVoronoiTopology(ck, voronoi); + verifyVoronoiTopology(ck, voronoi, "GraphWithManyTriangles1"); } } From adca92e53f04374d67e71a0a924ecff921ae53c8 Mon Sep 17 00:00:00 2001 From: "Saeed.Torabi" <114527638+saeeedtorabi@users.noreply.github.com> Date: Wed, 15 Oct 2025 11:46:21 -0400 Subject: [PATCH 3/5] Removed test import --- core/geometry/src/test/topology/Voronoi.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/geometry/src/test/topology/Voronoi.test.ts b/core/geometry/src/test/topology/Voronoi.test.ts index 2573c13d6b69..1dc04ffced00 100644 --- a/core/geometry/src/test/topology/Voronoi.test.ts +++ b/core/geometry/src/test/topology/Voronoi.test.ts @@ -3,7 +3,7 @@ import * as fs from "fs"; * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ -import { describe, expect, it, test } from "vitest"; +import { describe, expect, it } from "vitest"; import { InterpolationCurve3d, InterpolationCurve3dOptions } from "../../bspline/InterpolationCurve3d"; import { ClipUtilities } from "../../clipping/ClipUtils"; import { Arc3d } from "../../curve/Arc3d"; From 5dded2a1986458b13d4cef48a7ce1f27e9ad94a8 Mon Sep 17 00:00:00 2001 From: "Saeed.Torabi" <114527638+saeeedtorabi@users.noreply.github.com> Date: Wed, 15 Oct 2025 13:36:44 -0400 Subject: [PATCH 4/5] Added fixed points for the tests --- .../src/test/topology/Voronoi.test.ts | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/core/geometry/src/test/topology/Voronoi.test.ts b/core/geometry/src/test/topology/Voronoi.test.ts index 1dc04ffced00..8501d06184d0 100644 --- a/core/geometry/src/test/topology/Voronoi.test.ts +++ b/core/geometry/src/test/topology/Voronoi.test.ts @@ -115,9 +115,22 @@ function verifyVoronoiTopology(ck: Checker, v: Voronoi, testName?: string): void const vRange = HalfEdgeGraphOps.graphRangeXY(v.getVoronoiGraph); const dRange = v.getInputGraphRange; const testPoints: Point2d[] = []; - for (let i = 0; i < 50; i++) { // concentrate test points in the input graph range - testPoints.push(Point2d.create(getRandomNumber(vRange.low.x, vRange.high.x), getRandomNumber(vRange.low.y, vRange.high.y))); - testPoints.push(Point2d.create(getRandomNumber(dRange.low.x, dRange.high.x), getRandomNumber(dRange.low.y, dRange.high.y))); + if (GeometryCoreTestIO.enableLongTests) { + for (let i = 0; i < 50; i++) { // concentrate random test points in the input graph range + testPoints.push( + Point2d.create(getRandomNumber(vRange.low.x, vRange.high.x), getRandomNumber(vRange.low.y, vRange.high.y)), + ); + testPoints.push( + Point2d.create(getRandomNumber(dRange.low.x, dRange.high.x), getRandomNumber(dRange.low.y, dRange.high.y)), + ); + } + } else { // concentrate fixed test points in the input graph range + for (let i = 0.1; i <= 0.9; i += 0.2) { + for (let j = 0.1; j <= 0.9; j += 0.2) { + testPoints.push(vRange.fractionToPoint(i, j)); + testPoints.push(dRange.fractionToPoint(i, j)); + } + } } // verify the Voronoi condition via Monte Carlo method const vFaces = HalfEdgeGraphSearch.findContainingFaceXY(v.getVoronoiGraph, testPoints) as (HalfEdge | undefined)[] | undefined; @@ -314,7 +327,7 @@ describe("Voronoi", () => { visualizeGraphEdges(allGeometry, voronoiGraph, dx); ck.testExactNumber(voronoiGraph.collectFaceLoops().length, 4, "voronoiGraph should have 4 faces"); ck.testExactNumber(voronoiGraph.allHalfEdges.length / 2, 10, "voronoiGraph should have 10 edges"); - verifyVoronoiTopology(ck, voronoi, "ColinearPoints4"); + verifyVoronoiTopology(ck, voronoi, "ColinearPoints5"); } dx += 11; points = [[-1, -1], [1, 1], [4, 4]]; @@ -332,7 +345,7 @@ describe("Voronoi", () => { visualizeGraphEdges(allGeometry, voronoiGraph, dx); ck.testExactNumber(voronoiGraph.collectFaceLoops().length, 4, "voronoiGraph should have 4 faces"); ck.testExactNumber(voronoiGraph.allHalfEdges.length / 2, 10, "voronoiGraph should have 10 edges"); - verifyVoronoiTopology(ck, voronoi, "ColinearPoints5"); + verifyVoronoiTopology(ck, voronoi, "ColinearPoints6"); } dx += 9; @@ -353,7 +366,7 @@ describe("Voronoi", () => { visualizeGraphEdges(allGeometry, voronoiGraph, dx); ck.testExactNumber(voronoiGraph.collectFaceLoops().length, 5, "voronoiGraph should have 5 faces"); ck.testExactNumber(voronoiGraph.allHalfEdges.length / 2, 13, "voronoiGraph should have 13 edges"); - verifyVoronoiTopology(ck, voronoi, "ColinearPoints6"); + verifyVoronoiTopology(ck, voronoi, "ColinearPoints7"); } GeometryCoreTestIO.saveGeometry(allGeometry, "Voronoi", "ColinearPoints"); From 982e55090d893632e06566196bb3618dbb2ef786 Mon Sep 17 00:00:00 2001 From: "Saeed.Torabi" <114527638+saeeedtorabi@users.noreply.github.com> Date: Wed, 15 Oct 2025 13:38:37 -0400 Subject: [PATCH 5/5] modified step --- core/geometry/src/test/topology/Voronoi.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/geometry/src/test/topology/Voronoi.test.ts b/core/geometry/src/test/topology/Voronoi.test.ts index 8501d06184d0..cb4a88331362 100644 --- a/core/geometry/src/test/topology/Voronoi.test.ts +++ b/core/geometry/src/test/topology/Voronoi.test.ts @@ -125,8 +125,8 @@ function verifyVoronoiTopology(ck: Checker, v: Voronoi, testName?: string): void ); } } else { // concentrate fixed test points in the input graph range - for (let i = 0.1; i <= 0.9; i += 0.2) { - for (let j = 0.1; j <= 0.9; j += 0.2) { + for (let i = 0.1; i <= 0.9; i += 0.1) { + for (let j = 0.1; j <= 0.9; j += 0.1) { testPoints.push(vRange.fractionToPoint(i, j)); testPoints.push(dRange.fractionToPoint(i, j)); }