Skip to Content.
Sympa Menu

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

Subject: CGAL users discussion list

List archive

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


Chronological Thread 
  • From: "Mengda Wu" <>
  • To:
  • Subject: Re: [cgal-discuss] Re: Nef_polyhedron: cannot convert to an enriched polyhedron
  • Date: Tue, 8 Apr 2008 13:08:39 -0700
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=Xjx892OGmWIQ1KBkaU+Ip7Y/fmeAd2tbJfbsCNJr+SG0VFM2CllA4xInYJCLClk0oefHqz2sRfxnRsChc3n4/7FNM9gKFNxYzY/FABwEzefV1JDYsIE+yhw3p0n17MaEFc694/yguhywaKxQY62BC4Pmo3pRBxqssZ/jUAkNSME=

Yeah. Could you please tell me how I can turn off the unite of coplanar triangles? So I can
keep these triangles unchanged during the union operation.

I like the triangulation of facets of more than three vertices in conversion to Polyhedron_3.
So I would like to keep this feature.

Thank you so much for your help!
Mengda

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

Nef polyhedra are represented uniquely, i.e., If you have coplanar
triangles then they are united to a single facet. We thought of this as
a feature, but sometime people don't like it. Also if we output the
results with floating-point coordinates, facets with more than three
vertices often are not coplanar any more with these coordinates. So I
changed the output in such a way that facets with more than three
vertices are triangulated in the conversion to Polyhedron_3. If you
don't like it, I can tell you how to turn it off. I should offer this as
a regular option in the next release.


Peter


On Mon, 2008-04-07 at 17:36 -0700, Mengda Wu wrote:
> 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
>         >
>
>


--

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




Archive powered by MHonArc 2.6.16.

Top of Page