Take the 2-minute tour ×

This is over my head, can someone explain it to me better? http://mathworld.wolfram.com/Reflection.html

I'm making a 2d breakout fighting game, so I need the ball to be able to reflect when it hits a wall, paddle, or enemy (or a enemy hits it).

all their formula's are like: x_1^'-x_0=v-2(v·n^^)n^^.

And I can't fallow that. (What does ' mean or x_0? or ^^?)

share|improve this question
You have a problem with the link. –  Andrew Cooper Mar 28 '11 at 4:25
fixed. thank you ^_^ –  CyanPrime Mar 28 '11 at 4:30
this is the first of many, many problems you'll run into trying to make your own game platform if you don't have a strong mathematical grounding. I'd suggest reading a few textbooks on trigonometry and geometry as well as general math principles. –  Matthew Scharley Mar 28 '11 at 4:37
add comment

3 Answers

up vote 15 down vote accepted

The formula for reflection is easier to understand if you think to the geometric meaning of the operation of "dot product".

The dot product between two 3d vectors is mathematically defined as

<a, b> = ax*bx + ay*by + az*bz

but it has a nice geometric interpretation

The dot product between a and b is the length of the projection of a over b taken with a negative sign if the two vectors are pointing in opposite directions, multiplied by the length of b. dot product geometric interpretation

Something that is immediately obvious using this definition and that it's not evident if you only look at the formula is for example that the dot product of two vectors doesn't change if the coordinate system is rotated, that the dot product of two perpendicular vectors is 0 (the length of the projection is clearly zero in this case) or that the dot product of a vector by itself is the square of its length.

Something that is instead less obvious using the geometric interpretation is that the dot product is commutative, i.e. that <a, b> = <b, a> (fact that is clear considering the formula).

An important fact to consider is that if the length of b is 1 then the dot product <a, b> is simply the length of the projection of a over b (taken with the proper sign).

Given this interpretation the formula for computing the reflection over a plane is quite easy to understand:

vector reflection

To compute the reflected vector r, given a vector a and a plane with normal n you just need to use the formula:

r = a - 2<a, n> n

the height h in the figure is in this case just <a, n> (note that n is assumed to be of unit length) and so it should be clear that you need to move twice that height in the direction of the normal.

If you consider the proper dot product signs you should see that the very same formula applies also when the incident vector a and the plane normal n are facing in the same direction.

share|improve this answer
add comment

The prime (') indicates the second form of a number/point/structure. In this case, x₁' refers to the reflected form of x₁.

The subscript (0) shows various states of the same. In this case, x₀ is the point of reflection.

The caret notation (^) shows that something is a vector. In this case, n̂ is the normal vector.

share|improve this answer
the second form of a number/point/structure? –  CyanPrime Mar 28 '11 at 4:38
Yes, second form. Double prime ('') is the third form, triple prime (''') is the fourth, and so on. –  Ignacio Vazquez-Abrams Mar 28 '11 at 4:39
add comment

Is this just about the equation formatting? Because I see nicely formatted equations, not the LaTeX-style markup appearing in your question. So step 1: try viewing the page in a different web browser and see if it looks clearer.

More substantively, I'd recommend a different kind of resource. Fundamentally, you're looking at collisions, which are normally better treated in a physics text than a math text. Any introductory physics textbook will have a chapter on collisions, which should be directly applicable to your game.

share|improve this answer
add comment

Your Answer


