🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c++.leda
Article #30

LEDA-R-3.2.1 bug?

#30
From: Paddy Healy
Date: Tue, 08 Aug 1995 13:05
54 lines
1956 bytes

Machine:	Gateway 2000
OS:		Linux (kernel 1.2.8)
Compiler:	g++ 2.6.3
LEDA:		3.2.1

The following looks like a bug to me in rat_segment::intersection().  The
program should report no intersection for the first two intervals (y=1575)
sg1=[0, 675] and sg2=[1800, 2250].  It should then report an intersection of
the two segments that cross at the origin.

The output is the following:
(foscadh)pH#258 isect_bug
Hey, they intersect!!!
(foscadh)pH#259

This suggests two failures: a false positive with the first pair and a false
negative with the second pair.

isect_bug.cc:
----------------------------------- Cut Here -----------------------------------
#include <LEDA/basic.h>
#include <LEDA/list.h>
#include <LEDA/rat_point.h>
#include <LEDA/rat_segment.h>

main(int argc, char **argv)
{
   rat_point ppt;
   rat_segment sg1(0, 1575, 675, 1575), sg2(1800, 1575, 2250, 1575);

   if (intersection(sg1, sg2))
      cout<< "Hey, they intersect!!!"<< endl;

   if (sg1.intersection(sg2, ppt))
      cout<< "Hey, they intersect at"<< ppt<< endl;

   rat_point ipt;
//   rat_segment s1(675, 0, 675, 2025), s2(2025, 1575, 0, 1575);
   rat_segment s1(-1, 0, 1, 0), s2(0, -1, 0, 1);
   if (s1.intersection(s2, ppt))
      cout<< "Hey, they intersect at"<< ipt<< endl;

}
----------------------------------- Cut Here -----------------------------------

--

Patrick Healy, Dept. of Computer Science and Information Systems
University of Limerick, Limerick, Ireland.

E-mail: healyp@ul.ie	Phone: +353-61-202727	(W)
Fax:	+353-61-330876	       +353-61-325697	(H)
Technical Details
Message-ID: <HEALYP.95Aug8140517@deontas.cs.ul.ie>
Path: arc1-ca.pugleaf.net!news.ul.ie!healyp

Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.c++.leda
Path: arc1-ca.pugleaf.net!news.ul.ie!healyp
From: healyp@ul.ie ( Paddy Healy )
Subject: LEDA-R-3.2.1 bug?
Message-ID: <HEALYP.95Aug8140517@deontas.cs.ul.ie>
Followup-To: comp.lang.c++.leda
Sender: usenet@ul.ie
Nntp-Posting-Host: 136.201.8.73
Organization: CS Dept., Univ. of Limerick, Ireland
Date: Tue, 8 Aug 1995 13:05:17 GMT