Previous Section  < Day Day Up >  Next Section

Chapter 2, "Geometry Snippets"

Pythagorean Theorem

In a right triangle, the square of the length c of the hypotenuse is equal to the sum of the squares of the lengths a and b of the other two sides: c2 = a2 + b2.

Distance Formula in 2D

graphics/ap01equ02.gif

where P1(x1,y1) and P2(x2,y2) are points on the line.

Distance Formula in 3D

graphics/ap01equ03.gif

where P1(x1,y1,z1) and P2(x2,y2,z2) are points on the line.

Midpoint Formula in 2D

graphics/ap01equ04.gif

is the midpoint between P1(x1,y1) and P2(x2,y2).

Midpoint Formula in 3D

graphics/ap01equ05.gif

is the midpoint between P1(x1,y1,z1) and P2(x2,y2,z2).

Parabola with a Vertical Axis

y = a(xh)2 + k, with vertex (h,k) and axis of symmetry x = h.

Parabola with a Horizontal Axis

x = a(yk)2 + h, with vertex (h,k) and axis of symmetry y = k.

Equation of a Circle

(xh)2 + (yk)2 = r2

where the center is (h,k) and the radius is r.

Equation of a Circle Centered at the Origin

x2 + y2 = r2

where the center is (0,0) and the radius is r.

Equation of a Sphere

(xh)2 + (yk)2 + (zl)2 = r2

where the center is (h,k,l) and the radius is r.

Equation of a Sphere Centered at the Origin

x2 + y2 + z2 = r2

where the center is (0,0,0) and the radius is r.

Circle-Circle Collision Detection

Given two circles graphics/ap01inl14.gif and graphics/ap01inl13.gif, if graphics/ap01inl02.gif, a collision occurs.

Optimized Circle-Circle Collision Detection

Given two circles graphics/ap01inl14.gif and graphics/ap01inl13.gif, if (h2h1)2 + (k2k1)2 (r1 + r2)2, a collision occurs.

Optimized Sphere-Sphere Collision Detection

Given two spheres graphics/ap01inl16.gif and graphics/ap01inl15.gif, if (h2h1)2 + (k2k1)2 + (l2i1)2 (r1 + r2)2, a collision occurs.

    Previous Section  < Day Day Up >  Next Section