2

我使用点来创建平面,然后取交点形成多面体,并使用这些多面体构造 nef 多面体。在我大约 2500 个多面体中,有一个似乎导致了段错误。

这是具有相同输入的复制:

#include <iostream>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Convex_hull_3/dual/halfspace_intersection_3.h>
#include <CGAL/Nef_polyhedron_3.h>

typedef CGAL::Exact_predicates_exact_constructions_kernel K;
typedef K::Plane_3 Plane_3;
typedef K::Point_3 Point_3;
typedef CGAL::Polyhedron_3<K> Polyhedron_3;
typedef CGAL::Nef_polyhedron_3<K> Nef_polyhedron;

int main()
{

    Plane_3 planes[5];


    planes[0] = Plane_3(Point_3(-1024, 1192, -80),
                        Point_3(-1024, 1192, -88),
                        Point_3(-1152, 1216, -88));

    planes[1] = Plane_3(Point_3(-1152, 1216, -88),
                        Point_3(-1152, 1200, -88),
                        Point_3(-1152, 1200, -80));

    planes[2] = Plane_3(Point_3(-1024, 1192, -88),
                        Point_3(-1152, 1200, -88),
                        Point_3(-1152, 1216, -88));

    planes[3] = Plane_3(Point_3(-1024, 1192, -80),
                        Point_3(-1152, 1200, -80),
                        Point_3(-1024, 1192, -88));

    planes[4] = Plane_3(Point_3(-1152, 1216, -88),
                        Point_3(-1152, 1200, -80),
                        Point_3(-1024, 1192, -80));


    CGAL::halfspace_intersection_3(std::begin(planes), std::end(planes), P);
    assert(P.is_closed());

    for (Polyhedron_3::Point_iterator pIt = P.points_begin(); pIt != P.points_end(); ++pIt)
    {
        std::cout << *pIt << std::endl;
    }

    std::cout << '\n';

    Nef_polyhedron newNef(P);
}
4

0 回答 0