Subject: CGAL users discussion list
List archive
- From: "Thomas Zangl - Home" <>
- To: "cgal-discuss" <>
- Subject: Re:[cgal-discuss] core dump when using Segment_2<K>.has_on with point
- Date: Tue, 12 Jun 2007 12:29:02 +0200
Am Tue, 12 Jun 2007 09:28:16 +0200, schrieb "Andreas Fabri"
<>:
Hi!
>Can you send me a minimal program so that I can reproduce
>and hopefully fix it.
I was unable to reproduce it with a simple program like this:
Voronoi_Point p1(27, 37.9999);
Voronoi_Point p2(27, 37.9999);
Voronoi_Point p3(0.5, 0.5);
Voronoi_Segment s1(p1, p2);
cout << "Checking if " << p3 << " is on : " << s1;
cout << " = " << s1.has_on(p3) << endl;
The bug happens in the code I sent before. I changed the code to
something like this:
//---------------------------------------------------------------------
bool hasIntersectionSegmentWithPoints(Voronoi_Segment s, VDPointContainer&
points) {
std::cout <<"Has the Voronoi_Segment an intersection with a ball center?"
<< std::endl ;
std::cout << "Segment: " << s << endl;
/* rounding of the segment */
Voronoi_Point pSource(round(CGAL::to_double(s.source().x())),
round(CGAL::to_double(s.source().y())));
Voronoi_Point pTarget(round(CGAL::to_double(s.target().x())),
round(CGAL::to_double(s.target().y())));
Voronoi_Segment sRound(pSource, pTarget);
VDPointContainer::iterator it;
for( it = points.begin(); it != points.end(); it++ ) {
Voronoi_Point p1(CGAL::to_double(it->x()), CGAL::to_double(it->y()));
cout << "Checking if " << p1 << " is on : " << sRound;
cout << " = " << sRound.has_on(p1) << endl;
if (sRound.has_on(p1)) {
return true;
}
}
return false;
}
After converting the "it" - Iterator to a point p1 it works. Strange?
Using directly *it (as previously shown) does not.
Well, I now noticed, that points which are supposed to lie on the ray
or segment are not classified as doing so. It seems that the .has_on()
check is so strict that rounding and calculation errors are causing
this (more or less) wrong result.
So, how can I tell .has_on() to be not that strict? Can I tell it to
use some "error" of e.g. +- 0.002 ?
TIA,
--
----------------------------------------------------------------
,yours Thomas Zangl, Bakk.rer.soc.oec. -
-
- Freelancer - IT Consulting & Software Development -
- Student of Software Development-Economy (Master) -
- core dump when using Segment_2<K>.has_on with point, Thomas Zangl - Home, 06/11/2007
- Re: [cgal-discuss] core dump when using Segment_2<K>.has_on with point, Andreas Fabri, 06/12/2007
- Re:[cgal-discuss] core dump when using Segment_2<K>.has_on with point, Thomas Zangl - Home, 06/12/2007
- Message not available
- Re: [cgal-discuss] core dump when using Segment_2<K>.has_on with point, Thomas Zangl, 06/12/2007
- Message not available
- Re:[cgal-discuss] core dump when using Segment_2<K>.has_on with point, Thomas Zangl - Home, 06/12/2007
- Re: [cgal-discuss] core dump when using Segment_2<K>.has_on with point, Andreas Fabri, 06/12/2007
Archive powered by MHonArc 2.6.16.