Subject: CGAL users discussion list
List archive
- From: GIS Worx <>
- To:
- Subject: Re: [cgal-discuss] Facet soup to solids
- Date: Thu, 10 May 2012 10:40:16 -0700
Thank you for the help Sebastien. It is much appreciated.
I can confirm by skipping past the hidden simplify() call, I do indeed get the 3 volumes, and the face being preserved. I should be able to go on from here.
Cheers!
On Wed, May 9, 2012 at 11:54 PM, Sebastien Loriot (GeometryFactory) <> wrote:
If you don't mark the volume, you have 3 volumes (2 for the interior of the cubes, 1 for the volume outside the cubes on one side of theOn 05/09/2012 10:54 PM, GIS Worx wrote:
Here's a simple example of what I mean:
I have 13 faces (not all explicitly defined for simplicity here), 6
stitch into one cube, 6 stitch into another cube, one does not nicely
stitch into either cube. The two cubes touch along a face, I would like
to see the two cube output, not simply the simplified union of the two
cubes.
///
CGAL::Nef_nary_union_3<CGALNefPolyhedron> nary_union;
typedef CGALNefPolyhedron::Point_3 Point3;
typedef CGALNefPolyhedron::Vector_3 Vector3;
//These define a first unit cube
Point3 face1[4] =
{Point3(0,0,0),Point3(0,1,0),Point3(1,1,0),Point3(1,0,0)};
Point3 face2[4] =
{Point3(0,1,0),Point3(0,0,0),Point3(0,0,1),Point3(0,1,1)};
Point3 face3[4] =
{Point3(1,0,0),Point3(1,1,0),Point3(1,1,1),Point3(1,0,1)};
Point3 face4[4] =
{Point3(0,0,0),Point3(1,0,0),Point3(1,0,1),Point3(0,0,1)};
Point3 face5[4] =
{Point3(1,1,0),Point3(0,1,0),Point3(0,1,1),Point3(1,1,1)};
Point3 face6[4] =
{Point3(0,0,1),Point3(1,0,1),Point3(1,1,1),Point3(0,1,1)};
CGALNefPolyhedron currNef1(&face1[0], &face1[0]+4, Vector3(0,0,-1));
if(!currNef1.is_empty()) { nary_union.add_polyhedron(currNef1); }
CGALNefPolyhedron currNef2(&face2[0], &face2[0]+4, Vector3(-1,0,0));
if(!currNef2.is_empty()) { nary_union.add_polyhedron(currNef2); }
CGALNefPolyhedron currNef3(&face3[0], &face3[0]+4, Vector3(1,0,0));
if(!currNef3.is_empty()) { nary_union.add_polyhedron(currNef3); }
CGALNefPolyhedron currNef4(&face4[0], &face4[0]+4, Vector3(0,-1,0));
if(!currNef4.is_empty()) { nary_union.add_polyhedron(currNef4); }
CGALNefPolyhedron currNef5(&face5[0], &face5[0]+4, Vector3(0,1,0));
if(!currNef5.is_empty()) { nary_union.add_polyhedron(currNef5); }
CGALNefPolyhedron currNef6(&face6[0], &face6[0]+4, Vector3(0,0,1));
if(!currNef6.is_empty()) { nary_union.add_polyhedron(currNef6); }
//Here's the first cube
CGALNefPolyhedron firstCube = nary_union.get_union();
//These define an irrelevant face that touches the cubes
Point3 face7[4] =
{Point3(0,0,0),Point3(10,0,0),Point3(10,10,0),Point3(0,10,0)};
CGALNefPolyhedron extraFace(&face7[0], &face7[0]+4, Vector3(0,0,1));
//This defines a unit cube next to the first
CGALNefPolyhedron::Aff_transformation_3 transl(CGAL::TRANSLATION,
Vector3(1, 0, 0));
CGALNefPolyhedron secondCube(firstCube);
secondCube.transform(transl);
CGAL::Nef_nary_union_3<CGALNefPolyhedron> scene;
scene.add_polyhedron(firstCube);
scene.add_polyhedron(secondCube);
scene.add_polyhedron(extraFace);
CGALNefPolyhedron scene_union = scene.get_union();
CGAL::Mark_bounded_volumes<CGALNefPolyhedron> mbv (true);
scene_union.delegate(mbv);
size_t numVols = scene_union.number_of_volumes();
size_t numFaces = scene_union.number_of_facets();
size_t numSFaces = scene_union.number_of_sfaces();
size_t numVertices = scene_union.number_of_vertices();
size_t numLoops = scene_union.number_of_shalfloops();
///
This example is the one I was referring to in my earlier post, what I'd
expect to see is numVols=4 and numFaces=13.
plane7) and 12 faces (the common face of the cube has been merged).
If you mark the volume, delegate will by default also call simplify and
then the face shared by the cubes disappear. Which leads to 2 volumes
and 7 faces.In that case, you need to use Nef.
In answer to your questions:
The input will not be necessarily clean like this, although we can
assume that there is no ugly intersections between input facets. Solids
will not necessarily be valid 2-manifolds when other solids are also
taken into consideration. We could have some dangling faces (facets) at
the end of the process, not all input faces are guaranteed to
participate in a solid. I need to be able to navigate the populated data
structure so that I can determine which input faces contributed to what
solid construction and also to retrieve the dangling/isolated faces. The
touching facets between solids may not be perfectly matched (there may
be a small cube sitting along side a very large cube (only part of the
facet being shared).
The general goal is to go from an unorganized collection of faces to a
collection containing as many constructed solids as possible as well as
the remaining faces.
Sebastien.
Thanks!
On Tue, May 8, 2012 at 11:40 PM, Sebastien Loriot (GeometryFactory)< <mailto:>> wrote:http://www.cgal.org/Manual/__latest/doc_html/cgal_manual/__Linear_cell_complex/Chapter___main.html
Do you have a minimal example to share?
I am not sure to fully understand what your input are.
Is the facet shared by your cubes perfectly match (in term of
coordinates of the vertices) in each cube?
Could you have some dangling edges later on?
Do you have some boolean operation to do on this structure then
of is it simply to navigate inside?
I am asking these questions because you might be interested by these
packages:
<http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Linear_cell_complex/Chapter_main.html>
http://www.cgal.org/Manual/__latest/doc_html/cgal_manual/__Combinatorial_map/Chapter___main.html
<http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Combinatorial_map/Chapter_main.html>
Sebastien.
On 05/09/2012 12:38 AM, GIS Worx wrote:
Thank you for the suggestion Cody.
So I've attempted to construct a simple example, with two unit
cubes,
constructing each using the Nef_polyhedra constructor that takes a
boundary and a normal as a separate Nef polyhedron, and then
adding it
to a Nef_nary_union_3. Looking at the methods in this class, it
doesn't
appear that any calls to .simplify() are made, I would assume
this is
what you mean by regularizing the result.
However, inspecting the result of the Nef_nary_union of these 12
faces
defining two cubes (which are touching along a face), I see
number_of_facets() = 6 and number_of_volumes() = 2. Based on the
manual
descriptions, I would hope to see the answers here be 12, and 4,
so that
I have two independent cubes in the result.
There doesn't seem to be anything I can do to prevent the loss
of that
shared face.
On Tue, May 8, 2012 at 10:59 AM, Cody Rose <
<mailto:><mailto: <mailto:>>> wrote:
Would taking the union without regularizing the result do
what you need?
On May 8, 2012, at 10:38 AM, GIS Worx <
<mailto:>https://lists-sop.inria.fr/__wws/info/cgal-discuss<mailto: <mailto:>>> wrote:
> Hi everyone,
>
> I've spent quite a bit of time reading documentation and trying
to devise a way to accomplish the following:
>
> Given a bag of planar facets, seal them, where possible, into
closed polyhedrons, and return the remnants, as well as the
newly
constructed polyhedrons.
>
> Reading the Polyhedron_3 and Nef_Polyhedron documentation, it
seems like the approach that comes closest is this:
>
> Use Nef_Polyhedron to define each facet, and then take the union
of every facet, then the closed volumes can be marked and it's
possible to iterate through the results. My problem with
this method
is that it will remove 'seams' between solids according to
the union
operation.
>
> If you imagine a two cubes, side by side, each defined by six
faces, I would like two cubes back, each represented by six
faces,
not a single unified solid.
>
> I am not immediately concerned with performance, which can be
solved externally to this particular problem.
>
> Is there a pathway to accomplish this within CGAL that I am
missing? Is there a way to 'merge' two Nef_Polyhedra in a
way that
will maintain shared faces?
>
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go tohttps://lists-sop.inria.fr/__wws/info/cgal-discuss
<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>
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss
- [cgal-discuss] Facet soup to solids, GIS Worx, 05/08/2012
- Re: [cgal-discuss] Facet soup to solids, Cody Rose, 05/08/2012
- Re: [cgal-discuss] Facet soup to solids, GIS Worx, 05/09/2012
- Re: [cgal-discuss] Facet soup to solids, Sebastien Loriot (GeometryFactory), 05/09/2012
- Re: [cgal-discuss] Facet soup to solids, GIS Worx, 05/09/2012
- Re: [cgal-discuss] Facet soup to solids, Sebastien Loriot (GeometryFactory), 05/10/2012
- Re: [cgal-discuss] Facet soup to solids, GIS Worx, 05/10/2012
- Re: [cgal-discuss] Facet soup to solids, Sebastien Loriot (GeometryFactory), 05/10/2012
- Re: [cgal-discuss] Facet soup to solids, GIS Worx, 05/09/2012
- Re: [cgal-discuss] Facet soup to solids, Sebastien Loriot (GeometryFactory), 05/09/2012
- Re: [cgal-discuss] Facet soup to solids, GIS Worx, 05/09/2012
- Re: [cgal-discuss] Facet soup to solids, Cody Rose, 05/08/2012
Archive powered by MHonArc 2.6.16.