CGAL Polyhedron_3 和 Nef_polyhedron_3 相交

问题描述 投票:0回答:1

我正在使用 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 

怎么了?

谢谢你, 乔治

c++ computational-geometry cgal
1个回答
0
投票

这个问题你解决了吗?我也遇到了同样的问题,不知道怎么解决

© www.soinside.com 2019 - 2024. All rights reserved.