Reflection

Started by
7 comments, last by Kambiz 17 years, 12 months ago
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.
Advertisement
http://www.siggraph.org/education/materials/HyperGraph/raytrace/rtreflec.htm



The last formula does not use any trig function:

Rout = 2N(N · Rin) - Rin
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
You have to normalize the Normal vector N.
What do you mean by direction? You need the Notmal vector.
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!
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 ?

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?
That is OK.
Quote:it seems to work most of the times but not all of them...

Can you describe the problem??
http://www.jmckell.com/collisionspring.html (Needs Shockwave Player!)

This topic is closed to new replies.

Advertisement