Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Polyhedron_3 and Nef_polyhedron_3 difference for holed polyhedrons

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Polyhedron_3 and Nef_polyhedron_3 difference for holed polyhedrons


Chronological Thread 
  • From: Giles Bathgate <>
  • To:
  • Subject: Re: [cgal-discuss] Polyhedron_3 and Nef_polyhedron_3 difference for holed polyhedrons
  • Date: Fri, 6 Jun 2014 11:41:47 +0100

This might be relevant:
http://cgal-discuss.949826.n4.nabble.com/Multiple-volumes-Bug-converting-Nef-polyhedron-to-Polyhedron-3-td4658599.html

On 6 June 2014 11:19, GiorgioCGAL
<>
wrote:
> Hi,
> I am trying to use CGAL in order to perform the difference of two
> polyhedrons. I work with Polyhedron_3 with the kernel
> CGAL::Simple_cartesian<CGAL::Gmpq> and I convert the polyhedrons to
> Nef_polyhedron_3 for performing the difference operation.
>
> #include <CGAL/Simple_cartesian.h>
> #include <CGAL/Polyhedron_3.h>
> #include <CGAL/Nef_polyhedron_3.h>
> #include <CGAL/Gmpq.h>
> #include <CGAL/Polyhedron_incremental_builder_3.h>
> #include <CGAL/IO/Polyhedron_iostream.h>
>
> typedef CGAL::Simple_cartesian<CGAL::Gmpq> Kernel;
> typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
> typedef CGAL::Nef_polyhedron_3<Kernel> Nef_Polyhedron;
> typedef Polyhedron::HalfedgeDS HalfedgeDS;
>
> Polyhedron diff(Polyhedron & i_poly1, Polyhedron & i_poly2)
> {
> try
> {
> if (i_poly1.is_closed())
> {
> Nef_Polyhedron NP1(i_poly1);
> Nef_Polyhedron NP2(i_poly2);
> Nef_Polyhedron o_NP = NP1 - NP2;
> Polyhedron o_poly;
> o_NP.convert_to_Polyhedron(o_poly);
> return o_poly;
> }
> else
> {
> throw Utils::ProcessControl::AREException(
> "At least one geometry is not
> closed.", __FUNCTION__);
> }
> }
> catch (Utils::ProcessControl::AREException & exception)
> {
> throw exception;
> }
> }
>
> It works fine but when I try to perform the difference between A and B and B
> is strictly inside A (generating an holed polyhedron) the orientation of the
> facets of the contour of the hole is not as I would expect.
>
> According to the documentation
> “The convention is that the halfedges are oriented counterclockwise around
> facets as seen from the outside of the polyhedron. An implication is that
> the halfedges are oriented clockwise around the vertices. The notion of the
> solid side of a facet as defined by the halfedge orientation extends to
> polyhedral surfaces with border edges although they do not define a closed
> object. If normal vectors are considered for the facets, normals point
> outwards (following the right-hand rule).”
>
> I would expect that the normal of the facets on the hole of the resulting
> polyhedron (following the right-hand rule) will point to the hole itself but
> they point to the interior of the solid.
> What I am missing? There is a more suitable kernel for working with holed
> polyhedron and that is consistent with the right-hand rule?
>
> Thank you in advance,
> Giorgio
>
>
>
>
> --
> View this message in context:
> http://cgal-discuss.949826.n4.nabble.com/Polyhedron-3-and-Nef-polyhedron-3-difference-for-holed-polyhedrons-tp4659409.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