8000 Add polygon test showing bad tessellation result + fix by kintel · Pull Request #824 · elalish/manifold · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add polygon test showing bad tessellation result + fix #824

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/polygon/src/polygon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,10 @@ class EarClip {
float SignedDist(VertItr v, glm::vec2 unit, float precision) const {
float d = determinant2x2(unit, v->pos - pos);
if (std::abs(d) < precision) {
d = glm::max(d, determinant2x2(unit, v->right->pos - pos));
d = glm::max(d, determinant2x2(unit, v->left->pos - pos));
float dR = determinant2x2(unit, v->right->pos - pos);
if (std::abs(dR) > precision) return dR;
float dL = determinant2x2(unit, v->left->pos - pos);
if (std::abs(dL) > precision) return dL;
}
return d;
}
Expand Down
51 changes: 51 additions & 0 deletions test/polygon_corpus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4747,3 +4747,54 @@ TEST(Polygon, Woodgrain2) {
});
TestPoly(polys, 9, 0.00145);
}

TEST(Polygon, Separate_Quad_And_Tri) {
Polygons polys;
polys.push_back({{3, 0}, {3, 1}, {2, 0}});
polys.push_back({{0.2, 0.8}, {0.8, 0.8}, {1, 1}, {0, 1}});
TestPoly(polys, 3);
}

TEST(Polygon, Very_Branchy_With_hole) {
Polygons polys;
polys.push_back({
{-12.383395, 191.627597},
{-45.085282, 233.569954},
{-49.061051, 241.121459},
{-55.214156, 240.296329},
{-59.061922, 241.234954},
{-60.674552, 242.992235},
{-61.063571, 242.635239},
{-61.073658, 243.020877},
{-61.636008, 243.147031},
{-62.268425, 240.330262},
{-61.609029, 240.203785},
{-59.2187, 240.610881},
{-55.133, 239.584},
{-50.566424, 240.105481},
{-45.687, 232.57},
{-12.291, 189.141},
{0, 170},
{40.7437697, 229.300974},
{55.7083522, 236.787552},
{80.252253, 248.42422},
{79.4563048, 248.689086},
{56.830082, 238.344589},
{63.6074538, 247.073547},
{70.3643318, 251.593951},
{76.0529064, 252.091121},
{79.4563, 248.69},
{75.981, 253.138},
{69.6668222, 252.703022},
{62.3134, 248.079},
{54.8726126, 238.495329},
{38.62879, 230.54576},
{0, 180},
});
polys.push_back({
{-61.065936, 242.624693},
{-59.65022, 241.08199},
{-61.482003, 240.77002},
});
TestPoly(polys, 35);
}
Loading
0