Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] "unite" operation in MinKowski_2

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] "unite" operation in MinKowski_2


Chronological Thread 
  • From: "Sebastien Loriot (GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] "unite" operation in MinKowski_2
  • Date: Mon, 16 May 2011 15:16:57 +0200

Bernd Gaertner wrote:
My guess is that since the decimal value 0.1 is not representable as a double value under the binary IEEE standard, Lazy_exact_NT gives you a surrounding interval that is more than just one point. If so, this particular problem should go away if you use Point p(1,2).

The problem you have comes from the fact that x() and y() don't return
references. Due to the type_equality_wrapper (the mechanism making Kernel::Point_2 and Point_2<kernel> being compatible), a reference to
a temporary is returned at some point.

You should write:
const MP_FT& x() const {return *pos;}
const MP_FT& y() const {return *(pos+1);}


S.


Best,
Bernd.

Yue Biek wrote:
I first write a simple demo to test the validity of C_Point2.
int main()
{
Point p(0.1, 0.2);
MP_FT x = p.x();
std::cout << p.x() << std::endl;
}

However, the problem issued when p.x() executes. I found the error is caused by a test down in to_double() method:
// Interval_nt.h
bool is_point() const
{
return sup() == inf();
}

It seems that it complains the cartesion component of C_Point has different supremum and infimum. If my guess is right, how could this happen?
Really need some pointers here.





Archive powered by MHonArc 2.6.16.

Top of Page