Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫  π  -¹ ² ³ °

You are not logged in.

## #1 2005-10-28 14:11:25

mikau
Member
Registered: 2005-08-22
Posts: 1,504

### Angle of reflection

I tend to enjoy reinventing the wheel, coming up with formulas for things that I know, have already been figured out. Its more fun when you don't know the formula for something (ie. a 3d engine) but try to figure it out yourself rather then looking it up and being told. (thats no fun)

I thought I'd figure one out for reflection. I came across a need for this in one of my programs. It is said angle of incidents equals angle of reflection. Well thats nice but that only deals with the angles in relation to eachother, how about in relation to the world? It would be nice to have a simple formula to calculate the angle of reflection in relation to angle zero. And not have to worry about the angles in relation to eachother, and which side of the object you are on.

My drawing shows a formula I came up with. Where angle A is the angle of a flat surface in relation to zero and B is the angle at which the object is moving, in relation to zero. Read the diagram.

First we subtract A from B, and A from A to rotate the whole picture so that Angle A is zero. When an object impacts a flat surface who's angle is zero, it returns at the negative of angle at which it was moving, whether it hits it from above or below. Now that we have the correct reflection, we must add the original value of A again to rotate it back to where it was. This gives us the correct angle of reflection.

Now lets take a look at what we did:

We took the original angle B and subtracted angle A:

(B - A)

We reversed the sign of the this differance

-(B - A)

Then added angle A to find the angle of reflection

-(B-A) + A

Simplified:

Angle of reflection = 2A  B where A is the angle of a flat surface, and B is the angle at which the incoming object is moving. Hardly complicated, but fun to figure out all the same. :-)

Last edited by mikau (2005-10-28 14:19:10)

A logarithm is just a misspelled algorithm.

Offline

## #2 2005-10-28 14:22:45

mikau
Member
Registered: 2005-08-22
Posts: 1,504

### Re: Angle of reflection

Try it for differant angles. It always works. Sometimes it will give an answer greater then 360 but its still the right direction. Whats cool is it doesn't have to know what side its on.

A logarithm is just a misspelled algorithm.

Offline

## #3 2005-10-30 12:58:05

mikau
Member
Registered: 2005-08-22
Posts: 1,504

### Re: Angle of reflection

I'll probably be using this in my 3d engine as it progresses, for reflections of light and shading.

A logarithm is just a misspelled algorithm.

Offline