Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Bug in min_strip_2 function

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Bug in min_strip_2 function


Chronological Thread 
  • From: Michael Hoffmann <>
  • To: <>
  • Subject: Re: [cgal-discuss] Bug in min_strip_2 function
  • Date: Thu, 7 Oct 2010 10:01:03 +0200

Hi Benoit,

>>> After some tests, I think there is a bug in the min_strip_2 function (cf.
>>> "minStrip.cpp" to reproduce the bug).
>>> I compute the min strip of the quadrilateral shown in figure
>>> "minStrip.png" and I get the following results:
>>> -0.5818 -0.0609 0.547501
>>> -0.5818 -0.0609 0.257432
>>> One of these lines is printed in red.
>>> In my point of view this result is not correct, the min strip of this set
>>> of points should be the green line and the line parallel to the green
>>> line passing through the point (0.8726,0.6539).
>>> Thank your in advance for your help,

thanks for your report. I think the patch below fixes the problem.

Best regards,
Michael


===================================================================
--- Min_quadrilateral_traits_2.h (revision 59078)
+++ Min_quadrilateral_traits_2.h (working copy)
@@ -215,9 +215,9 @@
RT
width_numerator(const Strip_2& r, Cartesian_tag) const
{
- return
+ return CGAL_NTS square(
r.second.dx() * (r.third.y() - r.first.y()) +
- r.second.dy() * (r.first.x() - r.third.x());
+ r.second.dy() * (r.first.x() - r.third.x()));
}

RT
@@ -227,16 +227,16 @@
RT
width_numerator(const Strip_2& r, Homogeneous_tag) const
{
- return
+ return CGAL_NTS square(
r.second.dx() *
(r.third.hy() * r.first.hw() - r.first.hy() * r.third.hw()) +
r.second.dy() *
- (r.first.hx() * r.third.hw() - r.third.hx() * r.first.hw());
+ (r.first.hx() * r.third.hw() - r.third.hx() * r.first.hw()));
}

RT
width_denominator(const Strip_2& r, Homogeneous_tag) const {
- return r.first.hw() * r.third.hw() *
+ return CGAL_NTS square(r.first.hw()) * CGAL_NTS square(r.third.hw()) *
(CGAL_NTS square(r.second.dx()) + CGAL_NTS square(r.second.dy()));
}




Archive powered by MHonArc 2.6.16.

Top of Page