Skip to content

Commit 94d2503

Browse files
committed
Fixing legacy shape engine related bug.
Skewed test results until diagnosed as a real bug.
1 parent 8d9270d commit 94d2503

File tree

2 files changed

+7
-19
lines changed

2 files changed

+7
-19
lines changed

Common/shapeEngine/shapeLibrary.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2395,7 +2395,7 @@ public PathD processCorners(bool previewMode, bool cornerCheck, int cornerSegmen
23952395
computeCage();
23962396
computeTips(0, 0);
23972397
processEdgesForRounding();
2398-
return processCorners_actual(previewMode, cornerCheck, cornerSegments, optimizeCorners, resolution, iCPA, oCPA,
2398+
return legacy_processCorners_actual(previewMode, cornerCheck, cornerSegments, optimizeCorners, resolution, iCPA, oCPA,
23992399
iCV, iCVariation_scalar, oCV, oCVariation_scalar);
24002400
}
24012401

UnitTests/ShapeEngineTests.cs

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1597,28 +1597,16 @@ public static void customOrthoOuterRoundingTest()
15971597
shape.setShape(shapeSettings.getInt(ShapeSettings.properties_i.shapeIndex), customShape);
15981598
// Check the shape settings are in the shape.
15991599
Assert.That(shape.shapeIndex, Is.EqualTo((int)ShapeLibrary.shapeNames_all.GEOCORE));
1600-
PathD out_ = shape.processCorners(false, false, 90, 1, .01);
1600+
PathD out_ = shape.processCorners(false, false, 90, 1, .5);
16011601
SvgWriter svgSrc = new SvgWriter();
16021602
SvgUtils.AddSolution(svgSrc, new() { out_ }, true);
16031603
SvgUtils.SaveToFile(svgSrc, root_loc + "customortho_outer.svg", FillRule.NonZero, 800, 800, 10);
16041604
// Corners can have duplicate points.
16051605
PathD clean = GeoWrangler.removeDuplicates(out_);
1606-
// Assert.That(clean.Count, Is.EqualTo(115));
1606+
Assert.That(clean.Count, Is.EqualTo(121));
16071607
// Check expected area
16081608
double area = Clipper.Area(out_);
1609-
// Call the private legacy routine directly
1610-
var (legacyPath, legacyArea) = LegacyReflectionHelper.InvokeLegacy(
1611-
shape,
1612-
previewMode: false,
1613-
cornerCheck: false,
1614-
cornerSegments: 90,
1615-
optimizeCorners: 0, // optimization off
1616-
resolution: 0.01,
1617-
iCPA: false,
1618-
oCPA: false,
1619-
iCV: 0, iCVariation_scalar: 0, oCV: 0, oCVariation_scalar: 0
1620-
);
1621-
// Assert.That(Math.Abs(-(Math.PI * 10 * 10) - area), Is.LessThanOrEqualTo(0.15));
1609+
Assert.That(Math.Abs(-(Math.PI * 10 * 10) - area), Is.LessThanOrEqualTo(0.15));
16221610
RectD bounds = Clipper.GetBounds(clean);
16231611
Assert.That(bounds.Width, Is.GreaterThanOrEqualTo(19.99));
16241612
Assert.That(bounds.Height, Is.GreaterThanOrEqualTo(19.99));
@@ -1651,10 +1639,10 @@ public static void customOrthoInnerRoundingTest()
16511639
// Corners can have duplicate points.
16521640
PathD clean = GeoWrangler.removeDuplicates(out_);
16531641
// Check point count - start and end points are the same.
1654-
Assert.That(clean.Count, Is.EqualTo(69));
1642+
Assert.That(clean.Count, Is.EqualTo(68));
16551643
// Check expected area
16561644
double area = Clipper.Area(out_);
1657-
Assert.That(Math.Abs(-252.23 - area), Is.LessThanOrEqualTo(0.01));
1645+
Assert.That(Math.Abs(-252.8 - area), Is.LessThanOrEqualTo(0.01));
16581646
RectD bounds = Clipper.GetBounds(out_);
16591647
Assert.That(bounds.Width, Is.EqualTo(15));
16601648
Assert.That(bounds.Height, Is.EqualTo(20));
@@ -1687,7 +1675,7 @@ public static void customOrthoTipsTest()
16871675
// Corners can have duplicate points.
16881676
PathD clean = GeoWrangler.removeDuplicates(out_);
16891677
// Check point count - start and end points are the same.
1690-
Assert.That(clean.Count, Is.EqualTo(85));
1678+
Assert.That(clean.Count, Is.EqualTo(83));
16911679
// Check expected area
16921680
double area = Clipper.Area(out_);
16931681
Assert.That(Math.Abs(-((10 + 5) * (20 + 7)) - area), Is.LessThanOrEqualTo(0.001));

0 commit comments

Comments
 (0)