Karim Belabas on Wed, 20 Jun 2007 01:07:27 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: to test whether line-segments cross - what am I doing wrong? |
* john n [2007-06-20 00:48]: > > Newbie question... I'm trying to write a routine to test for whether two > unit-length line-segments cross. > > I'm OK with the maths, but am having problems implementing it! > All I need to do is store either 0 or 1 in the variable 'cross', according > to whether the line-segments cross or do not cross. > > But I keep getting "%1 = cross-1", and then when I run it again with the > same input, I get "%2 = 31". > There's surely a simple reason for this, obvious to any non-newbie, but I > haven't worked out what it is! Just rename cross-test ---> cross_test [ - is the 'minus' operator ] Cheers, K.B. -- Karim Belabas Tel: (+33) (0)5 40 00 26 17 Universite Bordeaux 1 Fax: (+33) (0)5 40 00 69 50 351, cours de la Liberation http://www.math.u-bordeaux.fr/~belabas/ F-33405 Talence (France) http://pari.math.u-bordeaux.fr/ [PARI/GP] `