home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
ledar34.zip
/
leda-r-3_4_tar
/
LEDA-3.4
/
src
/
plane_alg
/
_float_balaban.c
next >
Wrap
C/C++ Source or Header
|
1996-09-03
|
1KB
|
50 lines
/*******************************************************************************
+
+ LEDA 3.4
+
+ _float_balaban.c
+
+ This file is part of the LEDA research version (LEDA-R) that can be
+ used free of charge in academic research and teaching. Any commercial
+ use of this software requires a license which is distributed by the
+ LEDA Software GmbH, Postfach 151101, 66041 Saarbruecken, FRG
+ (fax +49 681 31104).
+
+ Copyright (c) 1991-1996 by Max-Planck-Institut fuer Informatik
+ Im Stadtwald, 66123 Saarbruecken, Germany
+ All rights reserved.
+
*******************************************************************************/
#define NO_RAT_ALGORITHMS
#include <LEDA/plane_alg.h>
int cmp_at_x(const segment& s1, const segment& s2, const point& x)
{ // Precondition : s1.start() <= s1.end() s2.start() <= s2.end()
if (s1.is_vertical())
if (s2.is_vertical())
return 0;
else
return orientation(s2, x) > 0 ? 1 : -1;
if(s2.is_vertical()) return orientation(s1, x) <= 0 ? 1 : -1;
double s1yd = s2.dx()*(s1.dy()*(x.xcoord() - s1.xcoord1()) +
s1.dx()*s1.ycoord1());
double s2yd = s1.dx()*(s2.dy()*(x.xcoord() - s2.xcoord1()) +
s2.dx()*s2.ycoord1());
if( s1yd < s2yd ) return -1;
if( s1yd > s2yd ) return 1;
return (orientation( s1, x ) > 0) ? cmp_slopes(s1, s2) : -cmp_slopes(s1, s2);
}
typedef point POINT;
typedef segment SEGMENT;
#define STAIRCASE float_stair_case
#include "balaban.c"