Assertion: CGAL/Interval_nt.h:88: !(i>s)

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Assertion: CGAL/Interval_nt.h:88: !(i>s)

Bruce Duncan
Hi all,

As part of my project, I've encountered a couple of troubles using CGAL.
I'd appreciate some guidance on where I'm going wrong!

For one of the assertions I'm hitting, I've created what I hope is a
small testcase. The code and the output on my machine is attached.

I think I do want to use the Exact_constructions_exact_predicates
kernel, however, I hit a different assertion with
Extended_homogeneous<Gmpz> and Homogeneous<Gmpzf> doesn't compile...
Pointers in this area would also be welcome.

Regards,
Bruce
--
CLX Compute Cluster Developer (http://clx.see.ed.ac.uk/)
AL116, Alrick Building, King's Buildings. 0131 6505637
School of Engineering, University of Edinburgh

The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Extended_homogeneous.h>
#include <CGAL/Quotient.h>
#include <CGAL/Gmpz.h>
#include <CGAL/Gmpzf.h>
#include <CGAL/Nef_polyhedron_3.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/IO/Nef_polyhedron_iostream_3.h>
#include <CGAL/IO/Polyhedron_VRML_2_ostream.h>
#include <CGAL/centroid.h>
#include <list>
#include <fstream>
#include <iostream>

typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
//typedef CGAL::Homogeneous<CGAL::Gmpzf> Kernel;
//typedef CGAL::Extended_homogeneous<CGAL::Gmpz> Kernel;
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
typedef CGAL::Nef_polyhedron_3<Kernel> Nef_polyhedron;
typedef Polyhedron::Vertex_iterator Vertex_iterator;
typedef Kernel::Vector_3 Vector;
typedef Kernel::Direction_3 Direction;
typedef Kernel::Aff_transformation_3 Aff_transformation;
typedef Kernel::Plane_3 Plane_3;
typedef Kernel::Vector_3 Vector_3;
typedef Kernel::Point_3 Point_3;

int main() {
    Point_3 p( 1.0, 0.0, 0.0);
    Point_3 q( 0.0, 1.0, 0.0);
    Point_3 r( 0.0, 0.0, 1.0);
    Point_3 s( 0.0, 0.0, 0.0);
    Polyhedron P;

    P.make_tetrahedron( p, q, r, s);
    Nef_polyhedron N(P);

    Polyhedron P1;
    N.convert_to_polyhedron(P1);
    Polyhedron::Facet_const_iterator fi = P1.facets_begin();
    std::cerr << "Facet... " << &fi << std::endl;
    std::cerr << "fi->plane(): " << fi->plane() << std::endl;
    std::cerr << "fi->plane().orthogonal_direction(): " << fi->plane().orthogonal_direction() << std::endl;
    Direction d1 = fi->plane().orthogonal_direction();
    //++fi;
    std::cout << (d1 == fi->plane().orthogonal_direction()) << std::endl;

    return 0;
}

:) bduncan@ltw2676:~/src/cutcell$ g++ -o testcase testcase.cpp -lgmp -lCGAL -I/home/bduncan/opt/include -L/home/bduncan/opt/lib -frounding-math -ffloat-store -ggdb 2>&1
:) bduncan@ltw2676:~/src/cutcell$ LD_LIBRARY_PATH=/home/bduncan/opt/lib gdb ./testcase
GNU gdb (GDB) 7.1-ubuntu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/bduncan/src/cutcell/testcase...done.
(gdb) run
Starting program: /home/bduncan/src/cutcell/testcase
[Thread debugging using libthread_db enabled]
Facet... 0xbffff214
fi->plane(): 0.5 0.5 0.5 0.5
fi->plane().orthogonal_direction(): 0.5 0.5 0.5
terminate called after throwing an instance of 'CGAL::Assertion_exception'
  what():  CGAL ERROR: assertion violation!
Expr: !(i>s)
File: /home/bduncan/opt/include/CGAL/Interval_nt.h
Line: 88
Explanation:  Variable used before being initialized (or CGAL bug)

Program received signal SIGABRT, Aborted.
0x0012d422 in __kernel_vsyscall ()
(gdb) bt
#0  0x0012d422 in __kernel_vsyscall ()
#1  0x00322651 in *__GI_raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#2  0x00325a82 in *__GI_abort () at abort.c:92
#3  0x0027c52f in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/libstdc++.so.6
#4  0x0027a465 in ?? () from /usr/lib/libstdc++.so.6
#5  0x0027a4a2 in std::terminate() () from /usr/lib/libstdc++.so.6
#6  0x0027a5e1 in __cxa_throw () from /usr/lib/libstdc++.so.6
#7  0x001a7c24 in CGAL::assertion_fail(char const*, char const*, int, char const*) () from /home/bduncan/opt/lib/libCGAL.so.5
#8  0x0804fbd9 in Interval_nt (this=0xbfffef68, i=1, s=0) at /home/bduncan/opt/include/CGAL/Interval_nt.h:87
#9  0x08098e19 in CGAL::operator*<false> (a=..., b=...) at /home/bduncan/opt/include/CGAL/Interval_nt.h:656
#10 0x08086a29 in CGAL::sign_of_determinant<CGAL::Interval_nt<false> > (a00=..., a01=..., a10=..., a11=...) at /home/bduncan/opt/include/CGAL/predicates/sign_of_determinant.h:38
#11 0x08075585 in CGAL::equal_directionC3<CGAL::Interval_nt<false> > (dx1=..., dy1=..., dz1=..., dx2=..., dy2=..., dz2=...)
    at /home/bduncan/opt/include/CGAL/predicates/kernel_ftC3.h:280
#12 0x08066b06 in CGAL::DirectionC3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >::operator== (this=0x81fb430, d=...)
    at /home/bduncan/opt/include/CGAL/Cartesian/Direction_3.h:113
#13 0x0805983b in CGAL::CommonKernelFunctors::Equal_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >::operator() (this=0xbffff0ec, v1=..., v2=...)
    at /home/bduncan/opt/include/CGAL/Kernel/function_objects.h:2159
#14 0x080543a4 in CGAL::Filtered_predicate<CGAL::CommonKernelFunctors::Equal_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::CommonKernelFunctors::Equal_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Exact_converter<CGAL::Lazy_kernel<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > > >, CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Approx_converter<CGAL::Lazy_kernel<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > > >, CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, true>::operator()<CGAL::Direction_3<CGAL::Lazy_kernel<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > > > >, CGAL::Direction_3<CGAL::Lazy_kernel<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > > > > > (this=0xbffff0eb, a1=..., a2=...)
    at /home/bduncan/opt/include/CGAL/Filtered_predicate.h:209
#15 0x0804fb4a in CGAL::operator==<CGAL::Lazy_kernel<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > > > > (p=..., q=...)
    at /home/bduncan/opt/include/CGAL/Kernel/global_functions_3.h:750
#16 0x0804ba8d in main () at testcase.cpp:46
(gdb)

signature.asc (261 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Assertion: CGAL/Interval_nt.h:88: !(i>s)

Sylvain Pion
Administrator
Le 06/08/10 14:02, Bruce Duncan a écrit :
> For one of the assertions I'm hitting, I've created what I hope is a
> small testcase. The code and the output on my machine is attached.

The assertion means that an uninitialized variable has been used.
And indeed the plane equations in the Polyhedron of CGAL needs manual
construction.  Seehttp://www.cgal.org/FAQ.html#polyhedron_normals .

--
Sylvain

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

Reply | Threaded
Open this post in threaded view
|

Re: Assertion: CGAL/Interval_nt.h:88: !(i>s)

Bruce Duncan
Hi Sylvain,

Thanks for your reply, which I guess you must make quite a lot! Sorry
for the silly question.

Sylvain Pion wrote:
> Le 06/08/10 14:02, Bruce Duncan a écrit :
>> For one of the assertions I'm hitting, I've created what I hope is a
>> small testcase. The code and the output on my machine is attached.
>
> The assertion means that an uninitialized variable has been used.
> And indeed the plane equations in the Polyhedron of CGAL needs manual
> construction.  Seehttp://www.cgal.org/FAQ.html#polyhedron_normals .

I have tried to modify my program to use the Traits class as shown in
the example program.

I am now having trouble converting this Polyhedron to a Nef_polyhedron,
which I want to use for the boolean operations. Is this possible?

I haven't attached the compiler output this time, as it's very long.
Suffice to say it starts with "Nef_3/polyhedron_3_to_nef_3.h:218: error:
'class Vector_3' has no member named 'is_degenerate'"

What am I doing wrong?

Thanks,
Bruce
--
CLX Compute Cluster Developer (http://clx.see.ed.ac.uk/)
AL116, Alrick Building, King's Buildings. 0131 6505637
School of Engineering, University of Edinburgh

The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Extended_homogeneous.h>
#include <CGAL/Quotient.h>
#include <CGAL/Gmpz.h>
#include <CGAL/Gmpzf.h>
#include <CGAL/Nef_polyhedron_3.h>
#include <CGAL/Polyhedron_traits_with_normals_3.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/IO/Nef_polyhedron_iostream_3.h>
#include <CGAL/IO/Polyhedron_VRML_2_ostream.h>
#include <CGAL/centroid.h>
#include <list>
#include <fstream>
#include <iostream>

typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
//typedef CGAL::Homogeneous<CGAL::Gmpzf> Kernel;
//typedef CGAL::Extended_homogeneous<CGAL::Gmpz> Kernel;
typedef CGAL::Polyhedron_traits_with_normals_3<Kernel> Traits;
typedef CGAL::Polyhedron_3<Traits> Polyhedron;
typedef CGAL::Nef_polyhedron_3<Kernel> Nef_polyhedron;
typedef Polyhedron::Vertex_iterator Vertex_iterator;
typedef Kernel::Vector_3 Vector;
typedef Kernel::Direction_3 Direction;
typedef Kernel::Aff_transformation_3 Aff_transformation;
typedef Kernel::Plane_3 Plane_3;
typedef Kernel::Vector_3 Vector_3;
typedef Kernel::Point_3 Point_3;

struct Normal_vector {
    template <class Facet>
    typename Facet::Plane_3 operator()( Facet& f) {
        typename Facet::Halfedge_handle h = f.halfedge();
        // Facet::Plane_3 is the normal vector type. We assume the
        // CGAL Kernel here and use its global functions.
        return CGAL::cross_product(
            h->next()->vertex()->point() - h->vertex()->point(),
            h->next()->next()->vertex()->point() - h->next()->vertex()->point());
    }
};

int main() {
    Point_3 p( 1.0, 0.0, 0.0);
    Point_3 q( 0.0, 1.0, 0.0);
    Point_3 r( 0.0, 0.0, 1.0);
    Point_3 s( 0.0, 0.0, 0.0);
    Polyhedron P;

    P.make_tetrahedron( p, q, r, s);
    Nef_polyhedron N(P);

    Polyhedron P1;
    N.convert_to_polyhedron(P1);
    std::transform(P1.facets_begin(), P1.facets_end(), P1.planes_begin(),
                   Normal_vector());
    Polyhedron::Facet_const_iterator fi = P1.facets_begin();
    std::cerr << "Facet... " << &fi << std::endl;
    std::cerr << "fi->plane(): " << fi->plane() << std::endl;
    Direction d1(fi->plane());
    //++fi;
    //std::cout << (d1 == Direction(fi->plane())) << std::endl;

    return 0;
}

signature.asc (261 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Assertion: CGAL/Interval_nt.h:88: !(i>s)

Sylvain Pion
Administrator
Le 06/08/10 17:37, Bruce Duncan a écrit :

> Sylvain Pion wrote:
>> Le 06/08/10 14:02, Bruce Duncan a écrit :
>>> For one of the assertions I'm hitting, I've created what I hope is a
>>> small testcase. The code and the output on my machine is attached.
>>
>> The assertion means that an uninitialized variable has been used.
>> And indeed the plane equations in the Polyhedron of CGAL needs manual
>> construction.  Seehttp://www.cgal.org/FAQ.html#polyhedron_normals .
>
> I have tried to modify my program to use the Traits class as shown in
> the example program.
>
> I am now having trouble converting this Polyhedron to a Nef_polyhedron,
> which I want to use for the boolean operations. Is this possible?
>
> I haven't attached the compiler output this time, as it's very long.
> Suffice to say it starts with "Nef_3/polyhedron_3_to_nef_3.h:218: error:
> 'class Vector_3' has no member named 'is_degenerate'"
>
> What am I doing wrong?

I am not well versed enough into the Nef polyhedron to answer.
I hope someone else can follow up.  In any case, I advice to send
as much of the error message as possible : I'm not sure it's
possible for anyone to see what's going wrong here.

--
Sylvain

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

Reply | Threaded
Open this post in threaded view
|

Re: Assertion: CGAL/Interval_nt.h:88: !(i>s)

Bruce Duncan
On Lunes 09 Agosto 2010 19:43:47 Sylvain Pion escribió:

> Le 06/08/10 17:37, Bruce Duncan a écrit :
> > Sylvain Pion wrote:
> >> Le 06/08/10 14:02, Bruce Duncan a écrit :
> >>> For one of the assertions I'm hitting, I've created what I hope is a
> >>> small testcase. The code and the output on my machine is attached.
> >>
> >> The assertion means that an uninitialized variable has been used.
> >> And indeed the plane equations in the Polyhedron of CGAL needs manual
> >> construction.  Seehttp://www.cgal.org/FAQ.html#polyhedron_normals .
> >
> > I have tried to modify my program to use the Traits class as shown in
> > the example program.
> >
> > I am now having trouble converting this Polyhedron to a Nef_polyhedron,
> > which I want to use for the boolean operations. Is this possible?
> >
> > I haven't attached the compiler output this time, as it's very long.
> > Suffice to say it starts with "Nef_3/polyhedron_3_to_nef_3.h:218: error:
> > 'class Vector_3' has no member named 'is_degenerate'"
> >
> > What am I doing wrong?
>
> I am not well versed enough into the Nef polyhedron to answer.
> I hope someone else can follow up.  In any case, I advice to send
> as much of the error message as possible : I'm not sure it's
> possible for anyone to see what's going wrong here.
Hi,

Sorry for the delay in replying.

I have attached my test case and the compiler output. The code compiles if
line 20 is changed from Polyhedron_traits_with_normals_3 to just
Polyhedron_traits_3.

I looked at the difference between CGAL/Polyhedron_traits_3.h and
CGAL/Polyhedron_traits_with_normals_3.h. This hunk seemed interesting (line
32):

-    typedef typename Kernel::Plane_3  Plane_3;
+    typedef typename Kernel::Vector_3 Plane_3;

I changed the code to:

    typedef typename Kernel::Plane_3 Plane_3;
    typedef typename Kernel::Vector_3 Vector_3;

and it seems to compile. Is this a bug in CGAL? Perhaps the author intended
both Plane_3 and Vector_3 to be defined?

Thanks,
Bruce

The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

testcase.cpp (2K) Download Attachment
is_degenerate.err (58K) Download Attachment
signature.asc (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Assertion: CGAL/Interval_nt.h:88: !(i>s)

Sebastien Loriot (GeometryFactory)
Bruce Duncan wrote:

> On Lunes 09 Agosto 2010 19:43:47 Sylvain Pion escribió:
>> Le 06/08/10 17:37, Bruce Duncan a écrit :
>>> Sylvain Pion wrote:
>>>> Le 06/08/10 14:02, Bruce Duncan a écrit :
>>>>> For one of the assertions I'm hitting, I've created what I hope is a
>>>>> small testcase. The code and the output on my machine is attached.
>>>> The assertion means that an uninitialized variable has been used.
>>>> And indeed the plane equations in the Polyhedron of CGAL needs manual
>>>> construction.  Seehttp://www.cgal.org/FAQ.html#polyhedron_normals .
>>> I have tried to modify my program to use the Traits class as shown in
>>> the example program.
>>>
>>> I am now having trouble converting this Polyhedron to a Nef_polyhedron,
>>> which I want to use for the boolean operations. Is this possible?
>>>
>>> I haven't attached the compiler output this time, as it's very long.
>>> Suffice to say it starts with "Nef_3/polyhedron_3_to_nef_3.h:218: error:
>>> 'class Vector_3' has no member named 'is_degenerate'"
>>>
>>> What am I doing wrong?
>> I am not well versed enough into the Nef polyhedron to answer.
>> I hope someone else can follow up.  In any case, I advice to send
>> as much of the error message as possible : I'm not sure it's
>> possible for anyone to see what's going wrong here.
>
> Hi,
>
> Sorry for the delay in replying.
>
> I have attached my test case and the compiler output. The code compiles if
> line 20 is changed from Polyhedron_traits_with_normals_3 to just
> Polyhedron_traits_3.
>
> I looked at the difference between CGAL/Polyhedron_traits_3.h and
> CGAL/Polyhedron_traits_with_normals_3.h. This hunk seemed interesting (line
> 32):
>
> -    typedef typename Kernel::Plane_3  Plane_3;
> +    typedef typename Kernel::Vector_3 Plane_3;
>
> I changed the code to:
>
>     typedef typename Kernel::Plane_3 Plane_3;
>     typedef typename Kernel::Vector_3 Vector_3;
>
> and it seems to compile. Is this a bug in CGAL? Perhaps the author intended
> both Plane_3 and Vector_3 to be defined?
>
> Thanks,
> Bruce
>
Hello Bruce,

I had a look at the code and the problem is in my opinion in
polyhedron_3_to_nef_3 which assumes that the type Plane defined by the
polyhedron traits is a of type Plane<K>. I will have a closer look at it
to find a solution.

Can you use Polyhedron_traits_3 instead?

S.

>
> ------------------------------------------------------------------------
>
> The University of Edinburgh is a charitable body, registered in
> Scotland, with registration number SC005336.


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

Reply | Threaded
Open this post in threaded view
|

Re: Assertion: CGAL/Interval_nt.h:88: !(i>s)

Bruce Duncan
On Tuesday 05 Oct 2010 14:15:11 Sebastien Loriot (GeometryFactory) wrote:

> Bruce Duncan wrote:
> > On Lunes 09 Agosto 2010 19:43:47 Sylvain Pion escribió:
> >> Le 06/08/10 17:37, Bruce Duncan a écrit :
> >>> Sylvain Pion wrote:
> >>>> Le 06/08/10 14:02, Bruce Duncan a écrit :
> >>>>> For one of the assertions I'm hitting, I've created what I hope is a
> >>>>> small testcase. The code and the output on my machine is attached.
> >>>>
> >>>> The assertion means that an uninitialized variable has been used.
> >>>> And indeed the plane equations in the Polyhedron of CGAL needs manual
> >>>> construction.  Seehttp://www.cgal.org/FAQ.html#polyhedron_normals .
> >>>
> >>> I have tried to modify my program to use the Traits class as shown in
> >>> the example program.
> >>>
> >>> I am now having trouble converting this Polyhedron to a Nef_polyhedron,
> >>> which I want to use for the boolean operations. Is this possible?
> >>>
> >>> I haven't attached the compiler output this time, as it's very long.
> >>> Suffice to say it starts with "Nef_3/polyhedron_3_to_nef_3.h:218:
> >>> error: 'class Vector_3' has no member named 'is_degenerate'"
> >>>
> >>> What am I doing wrong?
> >>
> >> I am not well versed enough into the Nef polyhedron to answer.
> >> I hope someone else can follow up.  In any case, I advice to send
> >> as much of the error message as possible : I'm not sure it's
> >> possible for anyone to see what's going wrong here.
> >
> > Hi,
> >
> > Sorry for the delay in replying.
> >
> > I have attached my test case and the compiler output. The code compiles
> > if line 20 is changed from Polyhedron_traits_with_normals_3 to just
> > Polyhedron_traits_3.
> >
> > I looked at the difference between CGAL/Polyhedron_traits_3.h and
> > CGAL/Polyhedron_traits_with_normals_3.h. This hunk seemed interesting
> > (line 32):
> >
> > -    typedef typename Kernel::Plane_3  Plane_3;
> > +    typedef typename Kernel::Vector_3 Plane_3;
> >
> > I changed the code to:
> >     typedef typename Kernel::Plane_3 Plane_3;
> >     typedef typename Kernel::Vector_3 Vector_3;
> >
> > and it seems to compile. Is this a bug in CGAL? Perhaps the author
> > intended both Plane_3 and Vector_3 to be defined?
> >
> > Thanks,
> > Bruce
>
> Hello Bruce,
>
> I had a look at the code and the problem is in my opinion in
> polyhedron_3_to_nef_3 which assumes that the type Plane defined by the
> polyhedron traits is a of type Plane<K>. I will have a closer look at it
> to find a solution.
>
> Can you use Polyhedron_traits_3 instead?
Hi Sebastien,

Thanks. I may be able to work around the use of plane normals, but it would be
messy. I will look at this again tomorrow.

My plan is to use the plane normals to sum the properties of facets which are
coplanar, so that they can be passed to another program. Perhaps there is a
better way to group coplanar facets?

Bruce

signature.asc (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Assertion: CGAL/Interval_nt.h:88: !(i>s)

Bruce Duncan
In reply to this post by Sebastien Loriot (GeometryFactory)


Sebastien Loriot (GeometryFactory) wrote:

> Bruce Duncan wrote:
>> On Lunes 09 Agosto 2010 19:43:47 Sylvain Pion escribió:
>>> Le 06/08/10 17:37, Bruce Duncan a écrit :
>>>> Sylvain Pion wrote:
>>>>> Le 06/08/10 14:02, Bruce Duncan a écrit :
>>>>>> For one of the assertions I'm hitting, I've created what I hope is a
>>>>>> small testcase. The code and the output on my machine is attached.
>>>>> The assertion means that an uninitialized variable has been used.
>>>>> And indeed the plane equations in the Polyhedron of CGAL needs manual
>>>>> construction.  Seehttp://www.cgal.org/FAQ.html#polyhedron_normals .
>>>> I have tried to modify my program to use the Traits class as shown in
>>>> the example program.
>>>>
>>>> I am now having trouble converting this Polyhedron to a Nef_polyhedron,
>>>> which I want to use for the boolean operations. Is this possible?
>>>>
>>>> I haven't attached the compiler output this time, as it's very long.
>>>> Suffice to say it starts with "Nef_3/polyhedron_3_to_nef_3.h:218:
>>>> error:
>>>> 'class Vector_3' has no member named 'is_degenerate'"
>>>>
>>>> What am I doing wrong?
>>> I am not well versed enough into the Nef polyhedron to answer.
>>> I hope someone else can follow up.  In any case, I advice to send
>>> as much of the error message as possible : I'm not sure it's
>>> possible for anyone to see what's going wrong here.
>>
>> Hi,
>>
>> Sorry for the delay in replying.
>>
>> I have attached my test case and the compiler output. The code
>> compiles if line 20 is changed from Polyhedron_traits_with_normals_3
>> to just Polyhedron_traits_3.
>>
>> I looked at the difference between CGAL/Polyhedron_traits_3.h and
>> CGAL/Polyhedron_traits_with_normals_3.h. This hunk seemed interesting
>> (line 32):
>>
>> -    typedef typename Kernel::Plane_3  Plane_3;
>> +    typedef typename Kernel::Vector_3 Plane_3;
>>
>> I changed the code to:
>>
>>     typedef typename Kernel::Plane_3 Plane_3;
>>     typedef typename Kernel::Vector_3 Vector_3;
>>
>> and it seems to compile. Is this a bug in CGAL? Perhaps the author
>> intended both Plane_3 and Vector_3 to be defined?
>>
>> Thanks,
>> Bruce
>>
> Hello Bruce,
>
> I had a look at the code and the problem is in my opinion in
> polyhedron_3_to_nef_3 which assumes that the type Plane defined by the
> polyhedron traits is a of type Plane<K>. I will have a closer look at it
> to find a solution.
>
> Can you use Polyhedron_traits_3 instead?
Hi Sebastien,

I think I really need the plane normals. I eventually hope to export
these data to a fortran code which will need them. Any hope that this
bug can be fixed? Am I allowed to call it a bug? :)

Bruce
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.


signature.asc (261 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Assertion: CGAL/Interval_nt.h:88: !(i>s)

Sebastien Loriot (GeometryFactory)
Bruce Duncan wrote:

>
> Sebastien Loriot (GeometryFactory) wrote:
>> Bruce Duncan wrote:
>>> On Lunes 09 Agosto 2010 19:43:47 Sylvain Pion escribió:
>>>> Le 06/08/10 17:37, Bruce Duncan a écrit :
>>>>> Sylvain Pion wrote:
>>>>>> Le 06/08/10 14:02, Bruce Duncan a écrit :
>>>>>>> For one of the assertions I'm hitting, I've created what I hope is a
>>>>>>> small testcase. The code and the output on my machine is attached.
>>>>>> The assertion means that an uninitialized variable has been used.
>>>>>> And indeed the plane equations in the Polyhedron of CGAL needs manual
>>>>>> construction.  Seehttp://www.cgal.org/FAQ.html#polyhedron_normals .
>>>>> I have tried to modify my program to use the Traits class as shown in
>>>>> the example program.
>>>>>
>>>>> I am now having trouble converting this Polyhedron to a Nef_polyhedron,
>>>>> which I want to use for the boolean operations. Is this possible?
>>>>>
>>>>> I haven't attached the compiler output this time, as it's very long.
>>>>> Suffice to say it starts with "Nef_3/polyhedron_3_to_nef_3.h:218:
>>>>> error:
>>>>> 'class Vector_3' has no member named 'is_degenerate'"
>>>>>
>>>>> What am I doing wrong?
>>>> I am not well versed enough into the Nef polyhedron to answer.
>>>> I hope someone else can follow up.  In any case, I advice to send
>>>> as much of the error message as possible : I'm not sure it's
>>>> possible for anyone to see what's going wrong here.
>>> Hi,
>>>
>>> Sorry for the delay in replying.
>>>
>>> I have attached my test case and the compiler output. The code
>>> compiles if line 20 is changed from Polyhedron_traits_with_normals_3
>>> to just Polyhedron_traits_3.
>>>
>>> I looked at the difference between CGAL/Polyhedron_traits_3.h and
>>> CGAL/Polyhedron_traits_with_normals_3.h. This hunk seemed interesting
>>> (line 32):
>>>
>>> -    typedef typename Kernel::Plane_3  Plane_3;
>>> +    typedef typename Kernel::Vector_3 Plane_3;
>>>
>>> I changed the code to:
>>>
>>>     typedef typename Kernel::Plane_3 Plane_3;
>>>     typedef typename Kernel::Vector_3 Vector_3;
>>>
>>> and it seems to compile. Is this a bug in CGAL? Perhaps the author
>>> intended both Plane_3 and Vector_3 to be defined?
>>>
>>> Thanks,
>>> Bruce
>>>
>> Hello Bruce,
>>
>> I had a look at the code and the problem is in my opinion in
>> polyhedron_3_to_nef_3 which assumes that the type Plane defined by the
>> polyhedron traits is a of type Plane<K>. I will have a closer look at it
>> to find a solution.
>>
>> Can you use Polyhedron_traits_3 instead?
>
> Hi Sebastien,
>
> I think I really need the plane normals. I eventually hope to export
> these data to a fortran code which will need them. Any hope that this
> bug can be fixed? Am I allowed to call it a bug? :)
>
> Bruce
Try with the attached patched file.
I am busy these days I did not have time to test it yet.
Tell me whether it works correctly or not.

S.



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


// Copyright (c) 1997-2002  Max-Planck-Institute Saarbruecken (Germany).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org); you may redistribute it under
// the terms of the Q Public License version 1.0.
// See the file LICENSE.QPL distributed with CGAL.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL: svn+ssh://[hidden email]/svn/cgal/trunk/Nef_3/include/CGAL/Nef_3/polyhedron_3_to_nef_3.h $
// $Id: polyhedron_3_to_nef_3.h 56667 2010-06-09 07:37:13Z sloriot $
//
//
// Author(s)     : Michael Seel    <[hidden email]>
//                 Miguel Granados <[hidden email]>
//                 Susan Hert      <[hidden email]>
//                 Lutz Kettner    <[hidden email]>
#ifndef CGAL_NEF_POLYHEDRON_3_TO_NEF_3_H
#define CGAL_NEF_POLYHEDRON_3_TO_NEF_3_H

#include <CGAL/Circulator_project.h>
#include <CGAL/normal_vector_newell_3.h>
#include <CGAL/Nef_S2/SM_point_locator.h>
#include <CGAL/Nef_3/SNC_indexed_items.h>

#undef CGAL_NEF_DEBUG
#define CGAL_NEF_DEBUG 29
#include <CGAL/Nef_2/debug.h>

namespace CGAL {

template < class Node, class Object>
struct Project_vertex_point {
  typedef Node                  argument_type;
  typedef Object                result_type;
  Object&       operator()( Node& x)       const { return x.vertex()->point();}
  const Object& operator()( const Node& x) const { return x.vertex()->point();}
};

namespace internal
{
  template <class T>
  struct Plane_constructor;
 
  template <class K>
  struct Plane_constructor< CGAL::Plane_3<K> >
  {
    template <class Facet>
    static const CGAL::Plane_3<K>& get_plane(Facet,const CGAL::Plane_3<K>& plane){return plane;}
    static CGAL::Plane_3<K> get_type_plane(const CGAL::Point_3<K>& p,const CGAL::Vector_3<K>& vector){return CGAL::Plane_3<K>(p,vector);}
    static CGAL::Vector_3<K> get_opposite_orthogonal_vector(const CGAL::Plane_3<K>& plane){return plane.opposite().orthogonal_vector();}
  };
 
  template <class K>
  struct Plane_constructor< CGAL::Vector_3<K> >
  {
    template <class Facet>
    static CGAL::Plane_3<K> get_plane(Facet f,const CGAL::Vector_3<K>& vector){
      return CGAL::Plane_3<K>(f->halfedge()->vertex()->point(),vector);
    }
    static const CGAL::Vector_3<K>& get_type_plane(const CGAL::Point_3<K>&,const CGAL::Vector_3<K>& vector){
      return vector;
    }
   
    static CGAL::Vector_3<K> get_opposite_orthogonal_vector(const CGAL::Vector_3<K>& vector){return -vector;}
  };
 
  template <class K,class Object,class Facet>
  CGAL::Plane_3<K> get_plane(const Facet& f,const Object& obj)
  {return Plane_constructor<Object>::get_plane(f,obj);}

  template <class K,class Object>
  CGAL::Vector_3<K> get_opposite_orthogonal_vector(const Object& obj)
  {return Plane_constructor<Object>::get_opposite_orthogonal_vector(obj);}
 
} //namespace internal

struct Facet_plane_3 {
  template < class Facet_>
  typename Facet_::Plane_3 operator()( Facet_& f) {
    typedef Facet_                              Facet;
    typedef typename Facet::Plane_3             Plane;
    typedef Kernel_traits< Plane>               KernelTraits;
    typedef typename KernelTraits::Kernel       Kernel;
    typedef typename Kernel::Vector_3           Vector;
    typedef typename Facet::Halfedge_around_facet_const_circulator
                                                Halfedge_circulator;
    typedef typename Facet::Halfedge            Halfedge;
    typedef typename Halfedge::Vertex           Vertex;
    typedef typename Vertex::Point_3            Point;
    typedef Project_vertex_point< Halfedge, const Point> Proj_vertex_point;
    typedef Circulator_project< Halfedge_circulator, Proj_vertex_point,
      const Point, const Point*> Circulator;
    /* TODO: to implement a better approach
       typedef Project_vertex< Halfedge> Project_vertex;
       typedef Project_point< Vertex> Project_point;
       typedef Compose< Project_vertex, Project_point> Projector;
       typedef Circulator_project< Halfedge_circulator, Projector> Circulator;
    */
    Circulator point_cir( f.facet_begin());
    Vector plane_orthogonal_vector;
    normal_vector_newell_3( point_cir, point_cir, plane_orthogonal_vector);
    CGAL_NEF_TRACEN( *point_cir);
    CGAL_NEF_TRACEN(internal::Plane_constructor<Plane>::get_type_plane(*point_cir, Vector( plane_orthogonal_vector)));
    if(plane_orthogonal_vector == Vector(0,0,0))
      std::cerr << "Error !!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
    return(internal::Plane_constructor<Plane>::get_type_plane( *point_cir, Vector( plane_orthogonal_vector)));
  }
};

template<typename Items, typename Polyhedron, typename SNC_structure>
class Index_adder {
  typedef typename SNC_structure::SHalfedge_handle   SHalfedge_handle;
 
  typedef typename Polyhedron::Halfedge_around_vertex_const_circulator
    Halfedge_around_vertex_const_circulator;
 public:
  Index_adder(Polyhedron& ) {}
  void set_hash(Halfedge_around_vertex_const_circulator,
                SHalfedge_handle) {}
  void resolve_indexes() {}
};

template<typename Polyhedron, typename SNC_structure>
class Index_adder<CGAL::SNC_indexed_items, Polyhedron, SNC_structure> {

  typedef typename SNC_structure::SHalfedge_handle   SHalfedge_handle;
 
  typedef typename Polyhedron::Halfedge_const_handle
    Halfedge_const_handle;
  typedef typename Polyhedron::Facet_const_iterator
    Facet_const_iterator;
  typedef typename Polyhedron::Halfedge_around_vertex_const_circulator
    Halfedge_around_vertex_const_circulator;
  typedef typename Polyhedron::Halfedge_around_facet_const_circulator
    Halfedge_around_facet_const_circulator;
  typedef typename CGAL::Unique_hash_map<Halfedge_const_handle,
                                         SHalfedge_handle> Hash;

  Polyhedron& P;
  Hash hash;

 public:
  Index_adder(Polyhedron& P_) : P(P_) {}

  void set_hash(Halfedge_around_vertex_const_circulator evc,
                SHalfedge_handle se) {
    hash[evc] = se;
  }
 
  void resolve_indexes() {
    Facet_const_iterator fi;
    for(fi = P.facets_begin(); fi != P.facets_end(); ++fi) {
      Halfedge_around_facet_const_circulator
        fc(fi->facet_begin()), end(fc);
      hash[fc]->set_index();
      hash[fc]->twin()->set_index();
      hash[fc]->twin()->source()->set_index();
      int se  = hash[fc]->get_index();
      int set = hash[fc]->twin()->get_index();
      int sv  = hash[fc]->twin()->source()->get_index();
     
      ++fc;
      CGAL_For_all(fc, end) {
        hash[fc]->set_index(se);
        hash[fc]->twin()->set_index(set);
        hash[fc]->source()->set_index(sv);
        hash[fc]->twin()->source()->set_index();
        sv = hash[fc]->twin()->source()->get_index();
      }
      hash[fc]->source()->set_index(sv);
    }
  }
};

template <class Polyhedron_, class SNC_structure>
void polyhedron_3_to_nef_3(Polyhedron_& P, SNC_structure& S)
{
  typedef Polyhedron_                                Polyhedron;
  typedef typename Polyhedron::Facet::Plane_3        Plane;
  typedef typename Polyhedron::Traits::Kernel        Kernel;
  typedef typename SNC_structure::SNC_decorator      SNC_decorator;
  typedef typename SNC_structure::SM_decorator       SM_decorator;
  typedef typename SNC_structure::Vertex_handle      Vertex_handle;
  typedef typename SNC_structure::SVertex_handle     SVertex_handle;
  typedef typename SNC_structure::SHalfedge_handle   SHalfedge_handle;
  typedef typename SNC_structure::SFace_handle       SFace_handle;
  typedef typename SNC_structure::Point_3            Point_3;
  typedef typename SNC_structure::Sphere_point       Sphere_point;
  typedef typename SNC_structure::Sphere_segment     Sphere_segment;
  typedef typename SNC_structure::Sphere_circle      Sphere_circle;

  typedef typename Polyhedron::Halfedge_around_vertex_const_circulator
                               Halfedge_around_vertex_const_circulator;

  Index_adder<typename SNC_structure::Items,
    Polyhedron, SNC_structure> index_adder(P);

  CGAL_NEF_TRACEN("  calculating facet's planes...");
  std::transform( P.facets_begin(), P.facets_end(),
                  P.planes_begin(), Facet_plane_3());

  typename Polyhedron::Vertex_iterator pvi;
  for( pvi = P.vertices_begin(); pvi != P.vertices_end(); ++pvi ) {
    typename Polyhedron::Vertex pv = *pvi;
    Vertex_handle nv = S.new_vertex();
    nv->point() = pv.point();
    nv->mark() = true;
    CGAL_NEF_TRACEN("v "<<pv.point());

    SM_decorator SM(&*nv);
    Halfedge_around_vertex_const_circulator pe = pv.vertex_begin(), pe_prev(pe);
    CGAL_assertion_code(Halfedge_around_vertex_const_circulator pe_0(pe));
    CGAL_assertion( pe != 0 );

    Point_3 pe_target_0(pe->opposite()->vertex()->point());
    Point_3 sp_point_0(CGAL::ORIGIN+(pe_target_0-pv.point()));
    Sphere_point sp_0(sp_point_0);
    SVertex_handle sv_0 = SM.new_svertex(sp_0);
    sv_0->mark() = true;
    pe++;
    CGAL_assertion(pe != pv.vertex_begin());

    SVertex_handle sv_prev = sv_0;

    bool with_border = false;
    do {
      //      CGAL_assertion(!pe->is_border());
      CGAL_assertion(pe_prev->face() == pe->opposite()->face());
      CGAL_assertion(pe_prev->vertex()->point()==pv.point());
      CGAL_assertion(pe->vertex()->point()==pv.point());

      Point_3 pe_target = pe->opposite()->vertex()->point();
      Point_3 sp_point = CGAL::ORIGIN+(pe_target-pv.point());
      Sphere_point sp(sp_point);
      SVertex_handle sv = SM.new_svertex(sp);
      sv->mark() = true;
     
      //      CGAL_NEF_TRACEN(pe_prev->facet()->plane());
      CGAL_NEF_TRACEN(pe_target);
      CGAL_NEF_TRACEN(pe_prev->opposite()->vertex()->point());

      /*
      if(pe_prev->facet()->plane().is_degenerate()) {
        typename Polyhedron::Halfedge_around_facet_const_circulator fc(pv.vertex_begin()), fcend(fc);
        std::cerr << "wrong cycle "  << std::endl;
        CGAL_For_all(fc,fcend) {
          std::cerr << "  " << fc->vertex()->point() << std::endl;
        }
      }
      */
      CGAL_assertion(pe_prev->is_border() ||
                     !internal::Plane_constructor<Plane>::get_plane(pe_prev->facet(),pe_prev->facet()->plane()).is_degenerate());
      CGAL_assertion(pe_prev->is_border() ||
                     internal::Plane_constructor<Plane>::get_plane(pe_prev->facet(),pe_prev->facet()->plane()).
                     has_on(pe_prev->opposite()->vertex()->point()));
      CGAL_assertion(pe_prev->is_border() ||
                     internal::Plane_constructor<Plane>::get_plane(pe_prev->facet(),pe_prev->facet()->plane()).has_on(pe_target));
      CGAL_assertion(pe_prev->is_border() ||
                     internal::Plane_constructor<Plane>::get_plane(pe_prev->facet(),pe_prev->facet()->plane()).has_on(pv.point()));

      if(pe_prev->is_border())
        with_border = true;
      else {
        typename Kernel::Plane_3 ss_plane
          (CGAL::ORIGIN,
           internal::Plane_constructor<Plane>::get_opposite_orthogonal_vector(pe_prev->facet()->plane()));
        Sphere_circle ss_circle(ss_plane);
       
        CGAL_assertion(ss_circle.has_on(sp));
        CGAL_assertion(ss_circle.has_on(sv_prev->point()));
       
        SHalfedge_handle e = SM.new_shalfedge_pair(sv_prev, sv);
        e->circle() = ss_circle;
        e->twin()->circle() = ss_circle.opposite();
        e->mark() = e->twin()->mark() = true;
       
        index_adder.set_hash(pe_prev, e);
      }

      sv_prev = sv;
      pe_prev = pe;
      ++pe;
    }
    while( pe != pv.vertex_begin() );

    CGAL_assertion(pe_prev->face() == pe_0->opposite()->face());
    CGAL_assertion(pe_prev->vertex()->point()==pv.point());
    CGAL_assertion(pe_0->vertex()->point()==pv.point());

    CGAL_NEF_TRACEN(internal::Plane_constructor<Plane>::get_plane(pe_prev->facet(),pe_prev->facet()->plane()));
    CGAL_NEF_TRACEN(pe_target_0);
    CGAL_NEF_TRACEN(pe_prev->opposite()->vertex()->point());
    CGAL_assertion(pe_prev->is_border() ||
                   !internal::Plane_constructor<Plane>::get_plane(pe_prev->facet(),pe_prev->facet()->plane()).is_degenerate());
    CGAL_assertion(pe_prev->is_border() ||
                   internal::Plane_constructor<Plane>::get_plane(pe_prev->facet(),pe_prev->facet()->plane()).
                   has_on(pe_prev->opposite()->vertex()->point()));
    CGAL_assertion(pe_prev->is_border() ||
                   internal::Plane_constructor<Plane>::get_plane(pe_prev->facet(),pe_prev->facet()->plane()).has_on(pe_target_0));
    CGAL_assertion(pe_prev->is_border() ||
                   internal::Plane_constructor<Plane>::get_plane(pe_prev->facet(),pe_prev->facet()->plane()).has_on(pv.point()));

    SHalfedge_handle e;
    if(pe_prev->is_border()) {
      with_border = true;
      e = sv_prev->out_sedge();
    } else {
      typename Kernel::Plane_3 ss_plane
        (CGAL::ORIGIN,
         internal::Plane_constructor<Plane>::get_opposite_orthogonal_vector(pe_prev->facet()->plane()));
      Sphere_circle ss_circle(ss_plane);
     
      CGAL_assertion(ss_plane.has_on(sv_prev->point()));
      CGAL_assertion(ss_circle.has_on(sp_0));
      CGAL_assertion(ss_circle.has_on(sv_prev->point()));
     
      e = SM.new_shalfedge_pair(sv_prev, sv_0);
      e->circle() = ss_circle;
      e->twin()->circle() = ss_circle.opposite();
      e->mark() = e->twin()->mark() = true;
     
      index_adder.set_hash(pe_prev, e);
    }

    // create faces
    SFace_handle fext = SM.new_sface();
    SM.link_as_face_cycle(e->twin(), fext);
    fext->mark() = false;

    if(!with_border) {
      SFace_handle fint = SM.new_sface();
      SM.link_as_face_cycle(e, fint);
      fint->mark() = false;
    }

    SM.check_integrity_and_topological_planarity();  
  }

  index_adder.resolve_indexes();
}



} //namespace CGAL

#endif //CGAL_NEF_POLYHEDRON_3_TO_NEF_3_H
Reply | Threaded
Open this post in threaded view
|

Re: Assertion: CGAL/Interval_nt.h:88: !(i>s)

Bruce Duncan


Sebastien Loriot (GeometryFactory) wrote:

> Bruce Duncan wrote:
>>
>> Sebastien Loriot (GeometryFactory) wrote:
>>> Bruce Duncan wrote:
>>>> On Lunes 09 Agosto 2010 19:43:47 Sylvain Pion escribió:
>>>>> Le 06/08/10 17:37, Bruce Duncan a écrit :
>>>>>> Sylvain Pion wrote:
>>>>>>> Le 06/08/10 14:02, Bruce Duncan a écrit :
>>>>>>>> For one of the assertions I'm hitting, I've created what I hope
>>>>>>>> is a
>>>>>>>> small testcase. The code and the output on my machine is attached.
>>>>>>> The assertion means that an uninitialized variable has been used.
>>>>>>> And indeed the plane equations in the Polyhedron of CGAL needs
>>>>>>> manual
>>>>>>> construction.  Seehttp://www.cgal.org/FAQ.html#polyhedron_normals .
>>>>>> I have tried to modify my program to use the Traits class as shown in
>>>>>> the example program.
>>>>>>
>>>>>> I am now having trouble converting this Polyhedron to a
>>>>>> Nef_polyhedron,
>>>>>> which I want to use for the boolean operations. Is this possible?
>>>>>>
>>>>>> I haven't attached the compiler output this time, as it's very long.
>>>>>> Suffice to say it starts with "Nef_3/polyhedron_3_to_nef_3.h:218:
>>>>>> error:
>>>>>> 'class Vector_3' has no member named 'is_degenerate'"
>>>>>>
>>>>>> What am I doing wrong?
>>>>> I am not well versed enough into the Nef polyhedron to answer.
>>>>> I hope someone else can follow up.  In any case, I advice to send
>>>>> as much of the error message as possible : I'm not sure it's
>>>>> possible for anyone to see what's going wrong here.
>>>> Hi,
>>>>
>>>> Sorry for the delay in replying.
>>>>
>>>> I have attached my test case and the compiler output. The code
>>>> compiles if line 20 is changed from Polyhedron_traits_with_normals_3
>>>> to just Polyhedron_traits_3.
>>>>
>>>> I looked at the difference between CGAL/Polyhedron_traits_3.h and
>>>> CGAL/Polyhedron_traits_with_normals_3.h. This hunk seemed interesting
>>>> (line 32):
>>>>
>>>> -    typedef typename Kernel::Plane_3  Plane_3;
>>>> +    typedef typename Kernel::Vector_3 Plane_3;
>>>>
>>>> I changed the code to:
>>>>
>>>>     typedef typename Kernel::Plane_3 Plane_3;
>>>>     typedef typename Kernel::Vector_3 Vector_3;
>>>>
>>>> and it seems to compile. Is this a bug in CGAL? Perhaps the author
>>>> intended both Plane_3 and Vector_3 to be defined?
>>>>
>>>> Thanks,
>>>> Bruce
>>>>
>>> Hello Bruce,
>>>
>>> I had a look at the code and the problem is in my opinion in
>>> polyhedron_3_to_nef_3 which assumes that the type Plane defined by the
>>> polyhedron traits is a of type Plane<K>. I will have a closer look at it
>>> to find a solution.
>>>
>>> Can you use Polyhedron_traits_3 instead?
>>
>> Hi Sebastien,
>>
>> I think I really need the plane normals. I eventually hope to export
>> these data to a fortran code which will need them. Any hope that this
>> bug can be fixed? Am I allowed to call it a bug? :)
>>
>> Bruce
>
> Try with the attached patched file.
> I am busy these days I did not have time to test it yet.
> Tell me whether it works correctly or not.
Hi Sebastien,

It works well, thank you. It also works in CGAL 3.7.

Please could it be applied to the next release?

Thanks,
Bruce
--
CLX Compute Cluster Developer (http://clx.see.ed.ac.uk/)
AL116, Alrick Building, King's Buildings. 0131 6505637
School of Engineering, University of Edinburgh

The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.


signature.asc (261 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Assertion: CGAL/Interval_nt.h:88: !(i>s)

Sebastien Loriot (GeometryFactory)
Bruce Duncan wrote:

>
> Sebastien Loriot (GeometryFactory) wrote:
>> Bruce Duncan wrote:
>>> Sebastien Loriot (GeometryFactory) wrote:
>>>> Bruce Duncan wrote:
>>>>> On Lunes 09 Agosto 2010 19:43:47 Sylvain Pion escribió:
>>>>>> Le 06/08/10 17:37, Bruce Duncan a écrit :
>>>>>>> Sylvain Pion wrote:
>>>>>>>> Le 06/08/10 14:02, Bruce Duncan a écrit :
>>>>>>>>> For one of the assertions I'm hitting, I've created what I hope
>>>>>>>>> is a
>>>>>>>>> small testcase. The code and the output on my machine is attached.
>>>>>>>> The assertion means that an uninitialized variable has been used.
>>>>>>>> And indeed the plane equations in the Polyhedron of CGAL needs
>>>>>>>> manual
>>>>>>>> construction.  Seehttp://www.cgal.org/FAQ.html#polyhedron_normals .
>>>>>>> I have tried to modify my program to use the Traits class as shown in
>>>>>>> the example program.
>>>>>>>
>>>>>>> I am now having trouble converting this Polyhedron to a
>>>>>>> Nef_polyhedron,
>>>>>>> which I want to use for the boolean operations. Is this possible?
>>>>>>>
>>>>>>> I haven't attached the compiler output this time, as it's very long.
>>>>>>> Suffice to say it starts with "Nef_3/polyhedron_3_to_nef_3.h:218:
>>>>>>> error:
>>>>>>> 'class Vector_3' has no member named 'is_degenerate'"
>>>>>>>
>>>>>>> What am I doing wrong?
>>>>>> I am not well versed enough into the Nef polyhedron to answer.
>>>>>> I hope someone else can follow up.  In any case, I advice to send
>>>>>> as much of the error message as possible : I'm not sure it's
>>>>>> possible for anyone to see what's going wrong here.
>>>>> Hi,
>>>>>
>>>>> Sorry for the delay in replying.
>>>>>
>>>>> I have attached my test case and the compiler output. The code
>>>>> compiles if line 20 is changed from Polyhedron_traits_with_normals_3
>>>>> to just Polyhedron_traits_3.
>>>>>
>>>>> I looked at the difference between CGAL/Polyhedron_traits_3.h and
>>>>> CGAL/Polyhedron_traits_with_normals_3.h. This hunk seemed interesting
>>>>> (line 32):
>>>>>
>>>>> -    typedef typename Kernel::Plane_3  Plane_3;
>>>>> +    typedef typename Kernel::Vector_3 Plane_3;
>>>>>
>>>>> I changed the code to:
>>>>>
>>>>>     typedef typename Kernel::Plane_3 Plane_3;
>>>>>     typedef typename Kernel::Vector_3 Vector_3;
>>>>>
>>>>> and it seems to compile. Is this a bug in CGAL? Perhaps the author
>>>>> intended both Plane_3 and Vector_3 to be defined?
>>>>>
>>>>> Thanks,
>>>>> Bruce
>>>>>
>>>> Hello Bruce,
>>>>
>>>> I had a look at the code and the problem is in my opinion in
>>>> polyhedron_3_to_nef_3 which assumes that the type Plane defined by the
>>>> polyhedron traits is a of type Plane<K>. I will have a closer look at it
>>>> to find a solution.
>>>>
>>>> Can you use Polyhedron_traits_3 instead?
>>> Hi Sebastien,
>>>
>>> I think I really need the plane normals. I eventually hope to export
>>> these data to a fortran code which will need them. Any hope that this
>>> bug can be fixed? Am I allowed to call it a bug? :)
>>>
>>> Bruce
>> Try with the attached patched file.
>> I am busy these days I did not have time to test it yet.
>> Tell me whether it works correctly or not.
>
> Hi Sebastien,
>
> It works well, thank you. It also works in CGAL 3.7.
>
> Please could it be applied to the next release?
>
It will be.

S.
> Thanks,
> Bruce


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