我正在使用CGAL对多面体进行几何运算。特别是我使用Polyhedron_3和Nef_polyhedron_3以及以下内核等....:
#include "CGAL/Simple_cartesian.h"
#include "CGAL/Polyhedron_3.h"
#include "CGAL/Nef_polyhedron_3.h"
#include "CGAL/Gmpz.h"
#include "CGAL/Polyhedron_incremental_builder_3.h"
#include "CGAL/IO/Polyhedron_iostream.h"
namespace ARECGAL
{
typedef CGAL::Simple_cartesian<CGAL::Gmpz> Kernel;
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
typedef CGAL::Nef_polyhedron_3<Kernel> Nef_Polyhedron;
typedef Polyhedron::HalfedgeDS HalfedgeDS;
typedef Nef_Polyhedron::Vector_3 Vector_3;
typedef Nef_Polyhedron::Aff_transformation_3 Aff_transformation_3;
}
我正在使用这种方法进行交叉:
Polyhedron intersection(Polyhedron & i_poly1,Polyhedron & i_poly2)
{
try
{
if (i_poly1.is_closed() && i_poly2.is_closed())
{
Nef_Polyhedron NP1(i_poly1);
Nef_Polyhedron NP2(i_poly2);
Nef_Polyhedron NP = NP1 * NP2;
//useless code for the topic
}
else
{
throw Utils::ProcessControl::AREException(notClosedGeoErrorMsg,
__FUNCTION__,
notClosedGeoErrorValue);
}
}
catch (Utils::ProcessControl::AREException & exception)
{
throw exception;
}
}
使用以下输入:
OFF
8 12 0
-2e+07 -2e+07 1.00006e+07
-2e+07 2e+07 1.00008e+07
2e+07 -2e+07 1.00001e+07
2e+07 2e+07 1.00005e+07
-2e+07 -2e+07 4e+07
-2e+07 2e+07 4e+07
2e+07 -2e+07 4e+07
2e+07 2e+07 4e+07
3 2 0 1
3 3 2 1
3 5 4 6
3 5 6 7
3 2 4 0
3 2 6 4
3 0 5 1
3 0 4 5
3 3 6 2
3 3 7 6
3 1 7 3
3 1 5 7
OFF
8 12 0
-2e+07 -2e+07 -1.99998e+07
-2e+07 2e+07 -1.99998e+07
2e+07 -2e+07 -1.99998e+07
2e+07 2e+07 -1.99998e+07
-2e+07 -2e+07 6.99999e+07
-2e+07 2e+07 6.99999e+07
2e+07 -2e+07 6.99999e+07
2e+07 2e+07 6.99999e+07
3 2 0 1
3 3 2 1
3 5 4 6
3 5 6 7
3 2 4 0
3 2 6 4
3 0 5 1
3 0 4 5
3 3 6 2
3 3 7 6
3 1 7 3
3 1 5 7
它在第一个Polyhedron崩溃到Nef_polyhedron转换时启动以下断言(在调试模式下):
terminate called after throwing an instance of 'CGAL::Assertion_exception'
what(): CGAL ERROR: assertion violation!
Expr: h.has_on(p)
File: /home/giorgio/Scrivania/Librerie/CGAL-4.4/include/CGAL/Nef_3/SNC_intersection.h
Line: 377
出了什么问题?
谢谢你, 乔治