|john n on Wed, 20 Jun 2007 00:48:47 +0200|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
|to test whether line-segments cross - what am I doing wrong?|
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! If the two line-segments miss each other by less than 10^-5 units, I count them as crossing. Code attached below. Many thanks in advance for any help! Regards, John N http://www.nabble.com/file/p11204331/cross-tester.gp cross-tester.gp -- View this message in context: http://www.nabble.com/to-test-whether-line-segments-cross---what-am-I-doing-wrong--tf3949350.html#a11204331 Sent from the cr.yp.to - pari-users mailing list archive at Nabble.com.