Skip to Content.
Sympa Menu

cgal-discuss - Re: Nef_polyhedron: cannot convert to an enriched polyhedron

Subject: CGAL users discussion list

List archive

Re: Nef_polyhedron: cannot convert to an enriched polyhedron


Chronological Thread 
  • From: "Mengda Wu" <>
  • To: "Peter Hachenberger" <>
  • Cc:
  • Subject: Re: Nef_polyhedron: cannot convert to an enriched polyhedron
  • Date: Mon, 7 Apr 2008 17:36:37 -0700
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=gdMbW1po3lOv8PBidOB8ZY248OvP2+odezcjUZLwmVAy/kjUCyAFK1JdJ4CZDkjiWZaQXLIuEAGksJRr9b8rajCvrfn7pn6sCN7xMgJKKO7vN2ARvB2OmmnmZMMCbWd96nTBCmudmhLCtGdgQ1wH5cAyhDXnZvsHOJTxXBtnMDo=

Hi Peter,

   Thanks a lot! It works for me this way.

   I have a question of the result. I had two closed polyhedra. One is
a complex shape (mesh1.off) and the other is a cylinder (mesh2.off). Please see
the attached image (unionbefore.png) for them.
I unioned them together using the code like this:
 
  Polyhedron mesh1;
  Polyhedron mesh2;
  //load mesh1 and mesh2 here
  Nef_Polyhedron model1(mesh1);
  Nef_Polyhedron model2(mesh2);

  model1 = model1 + model2;

  if( model1.is_simple() )
  {
    model1.convert_to_Polyhedron(mesh1);
  }

  I got the result shown in the attached image (unionafter.png). The union operation is successful
but the triangles on one of the face of the cylinder (pointed by a white arrow in the image) are all changed
to weird shapes. I thought the union operation should not affect the triangles there.

  I am wondering why this happened. Is it possible to keep the triangles there intact?

Thanks,
Mengda

2008/4/7, Peter Hachenberger <>:
Hi Mengda,

you are right. In convert_to_Polyhedron the type of
Polyhedron is hard wired to Polyhedron_3<Kernel>, which
does not allow different items. That surely is more restrictive than I
want it to be. Please try to overwrite the function in your file
Nef_polyhedron_3.h by

  template<typename Polyhedron>
  void convert_to_Polyhedron(Polyhedron& P) {
   typedef typename Polyhedron::HalfedgeDS HalfedgeDS;
   CGAL_precondition(is_simple());
   P.clear();
   Build_polyhedron<HalfedgeDS> bp(*this);
   P.delegate(bp);
  }

Please tell me whether it worked.


Peter


On Mon, 2008-04-07 at 00:47 -0700, Mengda Wu wrote:
> Sorry. I forgot to attach last time. Here it is.
>
> Thanks,
> Mengda
>
> ---------- Forwarded message ----------
> From: Mengda Wu <>
> Date: 2008-4-7 0:43
> Subject: Nef_polyhedron: cannot convert to an enriched polyhedron
> To:
>
> Hi Peter,
>
>   Thanks a lot for your explanations. I am testing the results.
>
>   But I have an side problem because of which I cannot try the union
> operation.
> I am using an enriched polyhedron, which enriches the contents of
> vertices,
> halfedges, and facets in the polyhedron (see attach). But I cannot
> compile when
> I try to use convert_to_Polyhedron function.
>
> error C2664:
> 'CGAL::Nef_polyhedron_3<Kernel_>::convert_to_Polyhedron' : cannot
> convert parameter 1 from 'MyCGALprogram::Enriched_Polyhedron' to
> 'CGAL::Polyhedron_3<PolyhedronTraits_3> &
>
> It seems that the Nef_polyhedron_3
> has been hardcoded to use the CGAL::Polyhedron_3. Is there a way to
> get around of this?
>
> Thanks,
> Mengda
>
> 2008/4/5, Peter Hachenberger <>:
>         Hi Mengda,
>
>         in the latest CGAL version the Nef polyhedra are getting
>         triangulated if
>         you convert them to polyhedral surfaces. If you want that
>         conversion
>         anyway to put the resulting polyhedron out as an off file in
>         the end,
>         then there should only be one problem. Not every Nef
>         polyhedron can be
>         converted to a polyhedral surface. Look into the user manual
>         for details
>         on that.
>
>         Peter
>
>
>         On Sat, 2008-04-05 at 14:59 -0700, Mengda Wu wrote:
>         > Hi there,
>         >
>         >    I have two polyhedra which are triangular, manifold, and
>         have one
>         > overlap region. I am wondering whether
>         > I can get a polyhedron which is union of the two, also
>         triangular and
>         > manifold through Nef_polyhedron union operation.
>         > How can I ensure the faces near the joint are triangular?
>         >
>         > Thanks,
>         > Mengda
>
>
>         --
>         You are currently subscribed to cgal-discuss.
>         To unsubscribe or access the archives, go to
>         https://lists-sop.inria.fr/wws/info/cgal-discuss
>


Attachment: unionbefore.png
Description: PNG image

Attachment: unionafter.png
Description: PNG image

Attachment: mesh1.off
Description: Binary data

Attachment: mesh2.off
Description: Binary data




Archive powered by MHonArc 2.6.16.

Top of Page