diff --git a/src/db/db/dbEdge.h b/src/db/db/dbEdge.h index 8ae6990e3..b9cf5b92a 100644 --- a/src/db/db/dbEdge.h +++ b/src/db/db/dbEdge.h @@ -858,7 +858,7 @@ public: coord_type distance (const db::point &p) const { // the distance is computed from - // d = (a x b) / sqrt (a * a) + // d = (a x b) / |a| // where b = p - p1, a = p2 - p1 if (is_degenerate ()) { // for safety handle this case - without a reasonable result @@ -866,7 +866,7 @@ public: } else { // compute the distance as described above area_type axb = coord_traits::vprod (m_p2.x (), m_p2.y (), p.x (), p.y (), m_p1.x (), m_p1.y ()); - double d = double (axb) / double (length ()); + double d = double (axb) / double_length (); // and round return coord_traits::rounded (d); } @@ -929,7 +929,7 @@ public: distance_type distance_abs (const db::point &p) const { // the distance is computed from - // d = (a x b) / sqrt (a * a) + // d = (a x b) / |a| // where b = p - p1, a = p2 - p1 if (is_degenerate ()) { // for safety handle this case - without a reasonable result @@ -937,7 +937,7 @@ public: } else { // compute the distance as described above area_type axb = coord_traits::vprod (m_p2.x (), m_p2.y (), p.x (), p.y (), m_p1.x (), m_p1.y ()); - double d = fabs (double (axb)) / double (length ()); + double d = fabs (double (axb)) / double_length (); // and round return coord_traits::rounded_distance (d); } diff --git a/src/db/unit_tests/dbPolygonToolsTests.cc b/src/db/unit_tests/dbPolygonToolsTests.cc index 44ef123db..dab78ba79 100644 --- a/src/db/unit_tests/dbPolygonToolsTests.cc +++ b/src/db/unit_tests/dbPolygonToolsTests.cc @@ -1327,7 +1327,7 @@ TEST(105) EXPECT_EQ (smooth (p, 0, false).to_string (), "(0,0;0,1000;100,1000;100,1100;800,1100;800,1000;2000,1000;2000,0)"); EXPECT_EQ (smooth (p, 50, false).to_string (), "(0,0;0,1000;100,1000;100,1100;800,1100;800,1000;2000,1000;2000,0)"); EXPECT_EQ (smooth (p, 80, false).to_string (), "(0,0;0,1000;100,1100;800,1100;800,1000;2000,1000;2000,0)"); - EXPECT_EQ (smooth (p, 90, false).to_string (), "(0,0;100,1100;800,1100;800,1000;2000,1000;2000,0)"); + EXPECT_EQ (smooth (p, 90, false).to_string (), "(0,0;0,1000;800,1100;800,1000;2000,1000;2000,0)"); EXPECT_EQ (smooth (p, 100, false).to_string (), "(0,0;0,1000;2000,1000;2000,0)"); EXPECT_EQ (smooth (p, 100, true).to_string (), "(0,0;0,1000;100,1000;100,1100;800,1100;800,1000;2000,1000;2000,0)"); } diff --git a/src/db/unit_tests/dbRegionTests.cc b/src/db/unit_tests/dbRegionTests.cc index 04b3dc90b..762778004 100644 --- a/src/db/unit_tests/dbRegionTests.cc +++ b/src/db/unit_tests/dbRegionTests.cc @@ -2998,3 +2998,24 @@ TEST(issue_909) EXPECT_EQ (r.to_string (), "(0,0;0,100;100,100;100,0);(0,0;0,300;200,300;200,0)"); } +TEST(issue_2208) +{ + db::Point points[] = { + db::Point (-36, -2698), + db::Point (-3226, 492), + db::Point (-2871, 847), + db::Point (-746, -1278), + db::Point (-751, -1283), + db::Point (-746, -1288), + db::Point (-741, -1283), + db::Point (319, -2343) + }; + + db::Region r; + db::Polygon p; + p.assign_hull (points + 0, points + sizeof (points) / sizeof (points [0])); + r.insert (p); + + db::EdgePairs ep = r.width_check (500); + EXPECT_EQ (ep.to_string (), "(-1046,-1688;-1151,-1583)|(-751,-1283;-746,-1288)"); +} diff --git a/testdata/bool/special2_au1.oas b/testdata/bool/special2_au1.oas index a5f502f42..94dec0a71 100644 Binary files a/testdata/bool/special2_au1.oas and b/testdata/bool/special2_au1.oas differ diff --git a/testdata/bool/special2_au1_tz.oas b/testdata/bool/special2_au1_tz.oas index 3290873a0..8d15b5a43 100644 Binary files a/testdata/bool/special2_au1_tz.oas and b/testdata/bool/special2_au1_tz.oas differ diff --git a/testdata/bool/special2_au2.oas b/testdata/bool/special2_au2.oas index 8b2e223d4..2d848e8a3 100644 Binary files a/testdata/bool/special2_au2.oas and b/testdata/bool/special2_au2.oas differ diff --git a/testdata/bool/special2_au2_tz.oas b/testdata/bool/special2_au2_tz.oas index 1e82c2993..e8d64c5e8 100644 Binary files a/testdata/bool/special2_au2_tz.oas and b/testdata/bool/special2_au2_tz.oas differ diff --git a/testdata/bool/special2_au3.oas b/testdata/bool/special2_au3.oas index 861bc779c..03e5474c5 100644 Binary files a/testdata/bool/special2_au3.oas and b/testdata/bool/special2_au3.oas differ diff --git a/testdata/bool/special2_au3_tz.oas b/testdata/bool/special2_au3_tz.oas index 8af391f06..13738de85 100644 Binary files a/testdata/bool/special2_au3_tz.oas and b/testdata/bool/special2_au3_tz.oas differ diff --git a/testdata/bool/special2_au4.oas b/testdata/bool/special2_au4.oas index e8580a4f1..d0af59d1e 100644 Binary files a/testdata/bool/special2_au4.oas and b/testdata/bool/special2_au4.oas differ diff --git a/testdata/bool/special2_au4_tz.oas b/testdata/bool/special2_au4_tz.oas index 8f595465e..736658e70 100644 Binary files a/testdata/bool/special2_au4_tz.oas and b/testdata/bool/special2_au4_tz.oas differ diff --git a/testdata/bool/special2_au5.oas b/testdata/bool/special2_au5.oas index 50fa6a864..452de1bb7 100644 Binary files a/testdata/bool/special2_au5.oas and b/testdata/bool/special2_au5.oas differ diff --git a/testdata/bool/special2_au5_tz.oas b/testdata/bool/special2_au5_tz.oas index a374b17aa..ea96cd1ad 100644 Binary files a/testdata/bool/special2_au5_tz.oas and b/testdata/bool/special2_au5_tz.oas differ diff --git a/testdata/dxf/issue_1592b_au.oas.gz b/testdata/dxf/issue_1592b_au.oas.gz index a55226a25..14d015c71 100644 Binary files a/testdata/dxf/issue_1592b_au.oas.gz and b/testdata/dxf/issue_1592b_au.oas.gz differ