RE: RE: Space Wars

From: Clay Cowgill <vector_clay_at_hotmail.com>
Date: Thu Feb 03 2000 - 17:23:03 EST

>x1,y1 - segment initial position
>x2,y2 - segment new position
>x3,y3 - last point from ship used to check collision
>x4,y4 - new point from ship used to check collision
>a1=y2-y1
>b1=x1-x2
>c1=x2*y1-x1*y2
>r1=a1*x3+b1*y3+c1
>r2=a1*x4+b1*y4+c1
>if r1 & r2 !=0 & have same sign, they don't intersect
>a2=y4-y3
>b2=x3-x4
>c2=x4*y3-x3*y4
>r1=a2*x1+b2*y1+c2
>r2=a2*x2+b2*y2+c2
>if r1 & r2 have same sign, they don't intersect

For what it's worth-- Jeff and I were also just talking about putting this
whole thing in to the Scenix. ;-) That would be pretty nice to have for
making collision checks fast and easy...

-Clay
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

---------------------------------------------------------------------------
** To UNSUBSCRIBE from vectorlist, send a message with "UNSUBSCRIBE" in the
** message body to vectorlist-request@synthcom.com. Please direct other
** questions, comments, or problems to neil@synthcom.com.
Received on Thu Feb 3 17:33:16 2000

This archive was generated by hypermail 2.1.8 : Fri Aug 01 2003 - 00:30:57 EDT