Friday, July 01, 2005

Vectors

Ok, mentally nailed down how to find the intersection of a plane and a line.

I think I mostly understand dot product, but I don't understand how the one angle you get from the dot product relates to the three angles you get (one each for x, y, and z) from direction cosines. AND I still don't understand what it means for the angles of the "post bounce" vector to be reflections of the angles of the "pre bounce" vector. For example, if the angle between the incoming vector and the local z-axis is 30 degrees, then is the angle between the outgoing vector and the local z-axis 60 degrees? 330 degrees? -30 degrees? ...and then what do I do with it?

I don't understand the cross product at all (I don't know anything about matrices).

Here's some demo code for how the location will be updated based on the vector:

(define TIME-UPDATE .5 seconds)
(define TIME-REFRESH .1 seconds)

critter's vector: (vx, vy, vz)
critter's location: (x, y, z)

every TIME-REFRESH the location is updated:
(make-location
(+ x (* TIME-REFRESH (/ vx TIME-UPDATE)))
(+ y (* TIME-REFRESH (/ vy TIME-UPDATE)))
(+ z (* TIME-REFRESH (/ vz TIME-UPDATE))))

then every TIME-UPDATE the vector is recalculated as well.
If the critter bumps into the wall during a refresh, it moves only as far as the wall and immediately updates its vector, then continues moving in the new direction on the next refresh. At the next time-update the vector is re-updated normally.
Both the TIME-UPDATE and TIME-REFRESH can be set as low as the computers can handle.

The thing is, a critter's movement can only be so continuous, because no matter what equation its movement is based on, it can't move only half a pixel. Of course, if this were displayed on a huge monitor (critters that used to be a millimeter in diameter now being displayed as a centimeter in diameter for example), being able to move very small distances would matter a lot more. I guess it is more important to calculate the position accurately and then let your equipment display it however it can.

3 Comments:

At Tuesday, July 05, 2005 12:34:00 PM, Anonymous Anonymous said...

You don't understand vectors? Of course you do.... you just don't know it yet!

 
At Tuesday, July 05, 2005 12:47:00 PM, Anonymous Anonymous said...

So, we have worked through the following.
(1) How to find the equation of a line and a plane
(2) How to find the point of intersection of a line and a plane
(3) How to find the angle between two vectors
(4) How to find the projection length of one vector on another
(5) How to find a normal vector to two other vectors
(6) How to find the equation of a line parallel to the intersection of two planes
(7) How to construct a coordinate system that allows one to reflect a vector through another vector constrained to lying in a plane
(8) How to transform between the prime and the unprime coordinate systems

I think that's pretty good for someone who "Doesn't Get It!!!!"

 
At Tuesday, July 05, 2005 12:59:00 PM, Blogger Cailin said...

lol, now I may understand all that, but last week I didn't.

Understanding that is not known is not very useful until it can be accessed. I'll post again once I'm sure what I understand from today.

 

Post a Comment

<< Home