Subject: CGAL users discussion list
List archive
- From: "Isabel" <>
- To: <>
- Subject: RE: [cgal-discuss] bug in boolean operations
- Date: Mon, 23 Jul 2007 15:54:34 +0200
Hi Peter,
I have a problem. I use
Polyhedron_3 P;
std::cin >> P;
Nef_polyhedron N(P);
I can't create the Nef_polyhedron. Why? I need a precondition? There isn't
any error message but my program fail.
About the boolean difference, I think that the correct difference is
'cubmincyl.off' (I make this with rhino 4.0), where the cube has a correct
hole, and not the other file.
Thanks, Isabel.
De: Peter Hachenberger
[mailto:]
Enviado el: viernes, 20 de julio de 2007 14:26
Asunto: Re: [cgal-discuss] bug in boolean operations
Hi Isabel,
the operation takes a lot of time since you use the OFF_to_nef_3 function,
which tries to convert every OFF file no matter how problematic it is. This
function is not designed for efficiency but for robustness (I improved the
efficiency of the function recently and will put it in CGAL-3.3.1). Try to
use
Polyhedron_3 P;
std::cin >> P;
Nef_polyhedron N(P);
This function is much faster, but has some restrictions on the input. If you
have problems with these restrictions, I might can help you get around these
problems.
I looked at cubeminclyinder.off in my viewer. It looks fine to me. Can you
be more specific about what you think is wrong with it?
Peter
On Fri, 2007-07-20 at 11:20 +0200, Isabel wrote:
> Hi all.
> I think that I find a bug in boolean operation, the difference of a
> cube and a cylinder is not correct. There are
> facets in holes. See 'cubemincylinder.off'
> I convert to Nef_Polyhedron_3 my two polyhedrons, a cube and a
> cylinder. This operation spend a lot of time.
>
> this is the code:
> typedef CGAL::Homogeneous<CGAL::Gmpz> Kernel;
>
> typedef CGAL::Nef_polyhedron_3<Kernel> Nef_3;
>
> typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
>
> typedef Kernel::Point_3 Point;
>
> typedef Kernel::Vector_3 Vector;
>
> typedef Polyhedron::Vertex_iterator Vertex_iterator;
>
> typedef Polyhedron::Facet_iterator Facet_iterator;
>
> typedef CGAL::Nef_polyhedron_3<Kernel> Nef_polyhedron;
>
>
>
> int main( int argc, char **argv) {
>
> Polyhedron P1, P2, P;
>
> const char* name = "cin";
>
> istream* p_in1 = &cin;
>
> istream* p_in2 = &cin;
>
> ifstream in1, in2;
>
> in1.open( ".\\cube.off");
>
> p_in1 = &in1;
>
> Nef_3 N1;
>
> std::size_t discarded = CGAL::OFF_to_nef_3 ( *p_in1, N1, true);
>
> in2.open( ".\\cylinder.off");
>
> p_in2 = &in2;
>
> Nef_3 N2;
>
> discarded = CGAL::OFF_to_nef_3 ( *p_in2, N2, true);
>
> Nef_3 N3;
>
> std::cout << "boolean operation in NEF3..." << std::endl;
>
> N3 = N1 - N2;
>
> std::cout << "Convert to polyhedron..." << std::endl;
>
> if(N3.is_simple()) {
>
> N3.convert_to_Polyhedron(P);
>
> std::cout << N3;
>
> const char* oname = "cout";
>
> ostream* p_out = &cout;
>
> ofstream out;
>
> out.open( "cubemincylinder.off");
>
> p_out = &out;
>
> CGAL::set_ascii_mode( *p_out);
>
> (*p_out) << P;
>
> }
>
> else {
>
> std::cout << N3;
>
> }
>
> return 0;
>
> }
>
> Thanks Isabel
>
>
--
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:
cubmincyl.off
Description: Binary data
- bug in boolean operations, Isabel, 07/20/2007
- Re: [cgal-discuss] bug in boolean operations, Peter Hachenberger, 07/20/2007
- RE: [cgal-discuss] bug in boolean operations, Isabel, 07/23/2007
- RE: [cgal-discuss] bug in boolean operations, Peter Hachenberger, 07/30/2007
- RE: [cgal-discuss] bug in boolean operations, Isabel, 07/30/2007
- RE: [cgal-discuss] bug in boolean operations, Peter Hachenberger, 07/30/2007
- RE: [cgal-discuss] bug in boolean operations, Isabel, 07/30/2007
- RE: [cgal-discuss] bug in boolean operations, Peter Hachenberger, 07/30/2007
- RE: [cgal-discuss] bug in boolean operations, Isabel, 07/23/2007
- Re: [cgal-discuss] bug in boolean operations, Peter Hachenberger, 07/20/2007
Archive powered by MHonArc 2.6.16.