Reflection? How do I do it?

17,240

Solution 1

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 point to consider is also 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 formula applies also when the incident vector a and the plane normal n are facing in the same direction.

Solution 2

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:
17,240
CyanPrime
Author by

CyanPrime

Updated on June 04, 2022

Comments

  • CyanPrime
    CyanPrime almost 2 years

    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 ^^?)

  • Ignacio Vazquez-Abrams
    Ignacio Vazquez-Abrams about 13 years
    Yes, second form. Double prime ('') is the third form, triple prime (''') is the fourth, and so on.