Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] point compare problem [update_exact()]

Subject: CGAL users discussion list

List archive

[cgal-discuss] point compare problem [update_exact()]


Chronological Thread 
  • From: Sterpa <>
  • To:
  • Subject: [cgal-discuss] point compare problem [update_exact()]
  • Date: Tue, 20 Oct 2009 07:32:40 +0200 (CEST)

I'm using CGAL 3.5 on Ubuntu 8.10. This is the code of a my data structure:

class Node {

private:

Point_2 v_ij;

Line_2 l_i;

Line_2 l_j;



void createNode(Line_2 i, Line_2 j) {

l_i = i;

l_j = j;
Point_2 tmp = Point_2(v_ij.x() - 1, v_ij.y());
if(CGAL::compare_y_at_x(tmp, l_i, l_j) == CGAL::SMALLER) {
Line_2 l_k = l_i;

l_i = l_j;

l_j = l_k;

}
}

public:

Node(Point_2 p, Line_2 i, Line_2 j) {

createNode(i,j);

v_ij = Point_2(p.x(), p.y());

}

Node(Line_2 i, Line_2 j) {

createNode(i,j);

v_ij = intersection(i, j);

}

Point_2 point() const {

return v_ij;

}

Line_2 i() const {

return l_i;

}

Line_2 j() const {

return l_j;

}

bool operator==(const Node& x) const;

};

bool Node::operator==(const Node& x) const {
bool b = (v_ij == x.point()); /* ERROR */
return (v_ij.x() == x.point().x() && v_ij.y() == x.point().y() && l_i
== x.i() && l_j == x.j());
}

I got a segmentation fault trying to compare two nodes, the line "bool b ..."
has been isolated from the return statement to find the error which seems to
be
in that operation. This is the backtrace of gdb:

#0
CGAL::Lazy_rep_1<CGAL::Object_cast<CGAL::Point_2<CGAL::Simple_cartesian<CGAL::Interval_nt<false>
> > >, CGAL::Object_cast<CGAL::Point_2<CGAL::Simple_cartesian<CGAL::Gmpq> > >,
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::Lazy<CGAL::Object, CGAL::Object, CGAL::Gmpq,
CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>,
CGAL::Simple_cartesian<CGAL::Interval_nt<false> >,
CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > > > >::update_exact
(this=0x81508a0)
at /usr/local/include/CGAL/Handle_for.h:125
#1 0x080ede78 in
CGAL::Lazy_rep_1<CGAL::CartesianKernelFunctors::Compute_y_2<CGAL::Simple_cartesian<CGAL::Interval_nt<false>
> >,
CGAL::CartesianKernelFunctors::Compute_y_2<CGAL::Simple_cartesian<CGAL::Gmpq>
>, CGAL::To_interval<CGAL::Gmpq>,
CGAL::Point_2<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> > > > >
>::update_exact
(
this=0x814e370) at /usr/local/include/CGAL/Lazy.h:236
#2 0x08103d5f in
CGAL::Lazy_rep_3<CGAL::CartesianKernelFunctors::Construct_point_2<CGAL::Simple_cartesian<CGAL::Interval_nt<false>
> >,
CGAL::CartesianKernelFunctors::Construct_point_2<CGAL::Simple_cartesian<CGAL::Gmpq>
>, 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::Return_base_tag, CGAL::Lazy_exact_nt<CGAL::Gmpq>,
CGAL::Lazy_exact_nt<CGAL::---Type <return> to continue, or q <return> to
quit---
Gmpq> >::update_exact (this=0x81505f8) at /usr/local/include/CGAL/Lazy.h:236
#3 0x08112178 in
CGAL::Filtered_predicate<CGAL::CommonKernelFunctors::Equal_2<CGAL::Simple_cartesian<CGAL::Gmpq>
>,
CGAL::CommonKernelFunctors::Equal_2<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::Point_2<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::Point_2<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=0xbfc6211c,
a1=@0x814e3e0,

a2=@0xbfc62130)
at /usr/local/include/CGAL/Lazy.h:236
#4 0x080c6c64 in Node::operator== (this=0x814e3e0,
x=@0xbfc621ac)
---Type <return> to continue, or q <return> to quit---
at /usr/local/include/CGAL/Kernel/global_functions_2.h:742
#5 0x080c756b in erase
(V=@0xbfc62528,

n=@0xbfc621ac)
at /home/marco/Desktop/cgal.project/arrangement.cpp:707
#6 0x080c762b in deleteNode
(V=@0xbfc62528,

Q=@0xbfc62484,

n=@0xbfc62240)
at /home/marco/Desktop/cgal.project/arrangement.cpp:716
#7 0x080c86ed in update_sweepline
(V=@0xbfc62528,

D=@0xbfc62540,


Q=@0xbfc62484)
at /home/marco/Desktop/cgal.project/arrangement.cpp:609
#8 0x080c9ec8 in algorithm_1
(lines=@0xbfc62878,
k=1)
at /home/marco/Desktop/cgal.project/arrangement.cpp:477
#9 0x080d0795 in main (argc=Cannot access memory at address 0x1

Thanks in advance for any answer. Best regards


  • [cgal-discuss] point compare problem [update_exact()], Sterpa, 10/20/2009

Archive powered by MHonArc 2.6.16.

Top of Page