3D & 4D Vector Math

Started by
13 comments, last by jonbell 21 years, 4 months ago
L.Q is nearly never zero, that makes much sence.. think about it.. inprecice floatingpoint values of vectors, how big is the chance that they point into exactly the same direction? not really big..

still the chance is there. but, as i said, nearly zero

"take a look around" - limp bizkit
www.google.com
If that's not the help you're after then you're going to have to explain the problem better than what you have. - joanusdmentia

My Page davepermen.net | My Music on Bandcamp and on Soundcloud

Advertisement
quote:Well i'm trying to use a ray tracing algoritm to test if a ray intersects an arbitry plane that a triangle lies in. In my book it says that if the plane vector L dot product with the ray endpoint Q

L.Q = 0 then no intersection occurs.

The problem is that L.Q never seems to equal zero even when i ,ake sure that no intersection will take place.

Think of it this way. Let's say your ray starts out on the positive side of the plane, and that it is going to intersect the plane. As you increase your time steps and check the point, L.Q will remain positive for a while, but slowly decrease. Now, at one time step, it might be a positive number, but all of a sudden, at the next timestep, it's a negative number. This means that the ray HAD to pass through the plane between those two timesteps.

It won't ever exactly be zero, but you can use the sign of the last dot product to determine if the side changed which indicates collision. To determine the actually intersection point, you'll need to use some vector math. It involves using similar triangles

[edited by - Zipster on December 8, 2002 2:31:37 PM]
Another problem i can forsee here is that a ray is considered to be infinite and therefore when i test to see if the ray intersects any of my models triangles i only want the ray to be a small distance long (the distance the player moves in one pass) how can i alter my calculations to make my ray a set distance in length?
ray(t) = origin + t*direction

if you have an intersection, you have the t for it. check if t is in the range you want it to be..

"take a look around" - limp bizkit
www.google.com
If that's not the help you're after then you're going to have to explain the problem better than what you have. - joanusdmentia

My Page davepermen.net | My Music on Bandcamp and on Soundcloud

If i use the origin in this calculation how will i make my vector point in the right direction? i can''t just use the 2nd end point of my ''ray'' (i know its not strictly a ray in this case) as the direction anymore.

Also should my direction vector be normalised?

This topic is closed to new replies.

Advertisement