Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Slicing/splitting/cutting polyhedral meshes

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Slicing/splitting/cutting polyhedral meshes


Chronological Thread 
  • From: Vinicius Azevedo <>
  • To: cgal-discuss <>
  • Subject: Re: [cgal-discuss] Slicing/splitting/cutting polyhedral meshes
  • Date: Fri, 3 Jul 2015 10:45:02 -0400

Hi Amir,

Sorry for taking long to answer. So the code currently available on CUSP for cutting meshes doesn't works right now. The problem seems to be on the function that computes the intersection between the plane and the current triangle mesh primitive. To cut geometries using CGAL you must use the polyhedron_cut_plane_3 function, which is defined inside the polyhedron_cut_plane_3.h file. This part of the code is where the things go wrong:

Halfedge_handle start = h;
do {
   h->vertex()->point() = construct_point( plane, h->next()->opposite()->facet()->plane(), h->opposite()->facet()->plane());
   h = h->next();
} while ( h != start);

This function basically computes the intersection point from 3 planes: the cutting plane and the two planes that pass through the current edge. The function construct_point is:

 operator()( const Plane_3& p, const Plane_3& q, const Plane_3& r) const { 
   Object obj = intersection( p, q);
   Line_3 line;
   if ( assign( line, obj)) {
        obj = intersection( r, line);
        Point_3 pt;
        if ( assign( pt, obj)) {
            return pt;
        }
   }
   std::cerr << "ERROR: coplanar planes used for computing " "intersecting point." << std::endl;
   std::cerr << "       Return ORIGIN. Don't trust result." << std::endl;
   return ORIGIN;
}

Which fails to compute a valid intersection point between the cutting plane and the geometry edge. I think there's a way to solve this simply, but my inexperience with cusp prevented me from solving the problem efficiently. Instead, what I did was compute the intersection point by using a projection directly on function halfedgeDSCutComponent. So I've replaced all the instances that created empty vertices (Vertex()) by Vertex(pred.plane().projection(g->vertex()->point())). However I could find some cases where this approach didn't work. Anyways, I'm pasting a code snippet here: http://pastebin.com/ajpzch8k
 
Vinicius C. Azevedo.

On Thu, Jul 2, 2015 at 1:47 AM, Aamir <> wrote:
Hi Vinicius Azevedo,

If you can help me in either case it would highly be appreciated.

Regards
Aamir



--
View this message in context: http://cgal-discuss.949826.n4.nabble.com/Slicing-splitting-cutting-polyhedral-meshes-tp4660731p4660964.html
Sent from the cgal-discuss mailing list archive at Nabble.com.

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss






Archive powered by MHonArc 2.6.18.

Top of Page