vector math questions

BlitzMax Forums/BlitzMax Programming/vector math questions

Hi all,
I'm making a 2d, top down game that works kind of like laser chess, that has laser rebounding off of mirrors.

The game requires a ricochet effect when the laser hits the mirrors. I have an incomming laser vector hitting a mirror vector. how do I figure out the outgoing recochet vector? I only need 2d vectors not 3d, but I assume the math really isn't all that different for both.

Hope this made sense, anyone done this?

this any use?

I posted this in the code archives maybe it can help you:
http://www.blitzmax.com/codearcs/codearcs.php?code=2183

Thanks for the links...I'm still having trouble though. I looked at this code from the other post

Method Mirror(normal:vector2d)
Local dotprod#=-x*normal.x-y*normal.y
x=x+2*normal.x*dotprod
y=y+2*normal.y*dotprod
End Method

I'm not sure whict vector represents the wall, that my laser will bounce off of and which one is the beam, the incomming vector. Can anyone clear this up for me?

(x,y) is the vector of the incoming beam.
(normal.x,normal.y) is a vector which is perpendicular (at right angles) to your wall.