10-16-2022, 01:14 PM
(10-16-2022, 12:17 AM)james2464 Wrote: This video explains the reflection of a vector, but I don't know what 'n' is. At 10:27 he says "don't forget if n is unit length you know that n.n is 1 and you can cross that out". But there are still more n's in the formula and I can't figure out what they are supposed to represent. He just said n=1 !! Or n.n = 1 anyway. I just wish there were numbers involved instead of just letters. That would be a huge help.
https://youtu.be/naaeH1qbjdQ
It can be very confusing mixing vector math and scalar math in the same equation. The former is treating each component (x & y) of the vector with scalar values. Dot product is giving a scalar value, not a vector, but you are then using that scalar to multiply the separate components of vectors. I find it helpful to define a UDT that holds the vector components and relegate dot product calculations to a function that receives both vectors:
Code: (Select All)
TYPE V2
x AS INTEGER
y AS INTEGER
END TYPE
FUNCTION R2_Dot (a AS V2, b AS V2)
R2_Dot = a.x * b.x + a.y * b.y
END FUNCTION
I believe the "n" is the vector normal of the plane. That is, vector 'n' is orthogonal (or perpendicular) to the plane. If it is a "unit" vector, as he seems to indicate, then its length is = 1. Remember that there are two orthogonals to the plane and I suspect that you would have to obtain both and then dot each with the relative position of the ball, keeping the one that is a positive result.
Now n.n I take to mean getting a dot product of a vector with itself, i.e. we are projecting a vector onto itself which necessarily results in a value of 1. Any number over a denominator of 1 is that number. Remember that the dot product of two vectors returns a scalar number, not a vector. Two vectors going in the same direction result in 1, in opposite directions results in -1 and orthogonal vectors result in 0.
v.n/n.n is simply v.n/1 or v.n. So your denominator is taken care of and you simply have to obtain the scalar value of v.n
Clear as mud, I know, and I hope this is not confusing the issue more. I spent many hours watching Professor Leonard videos to try to wrap my head around vectors, which I use in my space flight program, and I still have a lot to learn. As for matrices, I am as yet still at a loss to use them...
DO: LOOP: DO: LOOP
sha_na_na_na_na_na_na_na_na_na:
sha_na_na_na_na_na_na_na_na_na: