Skip to Content.
Sympa Menu

cgal-discuss - Re: Re: [cgal-discuss] .nef3 file format

Subject: CGAL users discussion list

List archive

Re: Re: [cgal-discuss] .nef3 file format


Chronological Thread 
  • From:
  • To:
  • Subject: Re: Re: [cgal-discuss] .nef3 file format
  • Date: Sat, 15 Dec 2007 21:39:21 +0100


> On 12/10/07,
>
>
> <>
> wrote:
> > If not, is there a code example that iterates over
> > all of the exterior facets and provide both the
> > exterior polygon boundary and the any internal
> > polygon hole boundaries?
>
> Hi Wayne,
>
> The K-3D method to convert the Nef3 polyhedra back to K3-D mesh format
> requires exactly this info. The source can be seen on
> http://k3d.svn.sourceforge.net/viewvc/k3d/trunk/modules/booleans/conversion.cpp?view=markup
>
> The to_mesh function on line 128 puts the points and the indices for
> face and hole loops in the arrays that are declared at the start of
> the function. Note that I am quite new to CGAL, and this probably is
> not the best method to convert from Nef3.

Bart:

Thank you for the pointer into your code. I never really
understood it because I wasn't too sure what the K-3D
data structures were.

The algorithm I use is thus:

foreach facet in facets {
if facet.volume.mark {
# We have a facet to be displayed:
shalfedges := facet.shalfedges
# Extract normal:
nx := -facet.a
ny := -facet.b
nz := -facet.c
# Visit each boundary/hole:
is_outer := true
is_hole := false
for shalfedge in shalfedges {
# Iterate around the boundary/hole:
stop := shalfedge
do {
vertex := shalfedge.source.vertex
shalfedge := shalfedge.prev
} until shalfedge == stop
is_hole := true
is_outer := false
}
}
}

I think the mail list manager is going to squeeze out
my pretty indentation, so you might have to reindent it
using the braces as a cue.

Cheers,

-Wayne



Archive powered by MHonArc 2.6.16.

Top of Page