VECTORLIST - The Mailing List For The Technical Discussion of Vector-Based Arcade Games

February_2000
RE: VECTOR: RE: Space Wars


From: Clay Cowgill ( )
Date: Thu Feb 03 2000 - 16:23:03 CST


>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 . Please direct other
** questions, comments, or problems to neil .


HOME