17: geometry & physics

geometry

notation

vector operations

computing scalar length  SFVec3f.length() gives the magnitude of the vector. Handy for distance comparisions, normalization.
 
normalization  SFVec3f.normalize() scales the vector to have a magnitude of 1, turning it into a directional indicator. Handy for surface normals, character headings, etc.
 
negation / inversion  SFVec3f.negate() multiplies each component of the vector by -1. Handy for reversing direction or influence.
 
addition & subtraction  SFVec3f.add(v),
 SFVec3f.subtract(v)
computes the result of multiple vector influences. Handy for adjusting positions and accumulating forces.
 
scalar multiplication & division  SFVec3f.multiply(n),
 SFVec3f.divide(n)
adjusts the magnitude of the vector. Used to increase / decrease the effect of vectors, and for normalization.
 
dot product  SFVec3f.dot(v) V1.dot(V2) results in a scalar value equal to V1.length * V2.length * cos(a), where a is the angle between V1 and V2.
  • For any two non-zero vectors V1 and V2, if V1.dot(V2) == 0, they are perpendicular.
  • If V1.dot(V2) == 1, they are colinear (parallel) in the same direction.
  • If V1.dot(V2) == -1, they are colinear in oppposite directions.
  • V1.dot(V1) == V1.length() * V1.length().
  • If V2 is a unit vector (has been normalized), V1.dot(V2) gives the contribution (magnitude) of V1 in the direction of V2. This is also called projecting V1 onto V2.
 
cross product  SFVec3f.cross(v) V1.cross(V2) results in a new vector perpendicular to V1 and V2.
  • V1.cross(V2) = V1.length * V2.length * sin(a) * N, where a is the angle between V1 and V2, and N is a unit vector perpendicular to V1 and V2.
  • For any two non-zero vectors V1 and V2, if V1.cross(V2) == 0, they are parallel.
  • Torque is the cross product of a lever vector, and a force operating at the end of the lever.

distance calculations

intersection (collision) detection

physics

terminology

rules

simulation

physical simulators perform the process outlined in steps one and two of applying newton's laws above. given a set of bodies and some external forces, a simulators takes care of updating the positions and orientation of all the bodies over time, resulting in realistic physical animation. actually, the realism is usually directly proportional to the complexity of the simulator, and the processing power of the computer running it.

particles

collision response