fixing generated indices of coplanar convex_hull_3

adding a small test
This commit is contained in:
Sven Oesau 2025-12-01 16:11:56 +01:00
parent 0fc710e95d
commit 4c1400d2fb
2 changed files with 10 additions and 3 deletions

View File

@ -62,9 +62,9 @@ void copy_ch2_to_face_graph(const std::list<P>& CH_2,
for(std::size_t i = 1; i < CH_2.size()-1; ++i){ for(std::size_t i = 1; i < CH_2.size()-1; ++i){
CGAL::internal::resize(its.faces[i-1], 3); CGAL::internal::resize(its.faces[i-1], 3);
its.faces[i-1][0] = static_cast<Index>(i); its.faces[i-1][0] = static_cast<Index>(i - 1);
its.faces[i-1][1] = static_cast<Index>(i + 1); its.faces[i-1][1] = static_cast<Index>(i);
its.faces[i-1][2] = static_cast<Index>(i + 2); its.faces[i-1][2] = static_cast<Index>(i + 1);
} }
} }

View File

@ -186,6 +186,13 @@ int main()
Triangle_3 ch_triangle; Triangle_3 ch_triangle;
assert(CGAL::assign(ch_triangle, ch_object)); assert(CGAL::assign(ch_triangle, ch_object));
std::vector<Point_3> pts;
std::vector<std::array<int, 3> > faces;
CGAL::convex_hull_3(points.begin(), points.end(), pts, faces);
assert(faces.size() == 1);
for (int i : faces[0])
assert(0 <= i && i <= 2);
std::cout << "Testing hull of four points " << std::endl; std::cout << "Testing hull of four points " << std::endl;
Point_3 p4(1, 1, 1); Point_3 p4(1, 1, 1);
points.push_back(p4); points.push_back(p4);