# Reflection

This topic is 4417 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, I need to have the returning vector (or its incline) from a reflection when the entering vector E (dx, dy) and the incline of the platform P are given. My major problem is that I cannot use any Trigo. I heard that this can be done without it so... If anyone knows how to, I'll be more than just glad to hear it. :) ThanX, ThisPlay.

##### Share on other sites
Do I need to normalize the vectors?
Does it matter if they're normalized?

And last... the normal vector... suppose I have the direction only, does it matter if it creates a triangle or that its values doesn't cross at all?

ThanX,
ThisPlay

##### Share on other sites
You have to normalize the Normal vector N.
What do you mean by direction? You need the Notmal vector.

##### Share on other sites
Hi,

Ummm... it seems to work most of the times but not all of them...
Do you know why and how it can be fixed?

Just in case I did something wrong:

The RIn (I) vector points to the collision point.
The Normal (N) vector points to the collision point.

And...

T=Nx*Ix+Ny*Iy
Ox=2*Nx*T-Ix
Oy=2*Ny*T-Iy

Right?

ThanX (again... ;))
ThisPlay!

##### Share on other sites
Quote:
 The RIn (I) vector points to the collision point.

The I vector should not point to the collision point... see the image. It should point away from the collision point.
try :
Ix = -1*Ix;
Iy = -1*Iy;

Quote:
 The Normal (N) vector points to the collision point.

(just like I??)
How do you calculate N ?

##### Share on other sites
Ummm... well...

The collision occurs with a ball and a player (both are circles).
So... I took the ball location where collided and the center of the player, which... makes the radius to the tangent and thus, the N.

It goes like this:
Nx=Px-Bx;
Ny=Py-By;

After that, I normalized N like this:
Nn=sqrt(Nx*Nx+Ny*Ny);
Nx/=Nn;
Ny/=Nn;

Is that right?

##### Share on other sites
That is OK.
Quote:
 it seems to work most of the times but not all of them...

Can you describe the problem??

• 10
• 17
• 9
• 14
• 41