Chapter 2,

 <  Day Day Up  >  

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: c 2 = a 2 + b 2 .

Distance Formula in 2D

graphics/ap01equ02.gif

where P 1 ( x 1 , y 1 ) and P 2 ( x 2 , y 2 ) are points on the line.

Distance Formula in 3D

graphics/ap01equ03.gif

where P 1 ( x 1 , y 1 , z 1 ) and P 2 ( x 2 , y 2 , z 2 ) are points on the line.

Midpoint Formula in 2D

graphics/ap01equ04.gif

is the midpoint between P 1 ( x 1 , y 1 ) and P 2 ( x 2 , y 2 ).

Midpoint Formula in 3D

graphics/ap01equ05.gif

is the midpoint between P 1 ( x 1 , y 1 , z 1 ) and P 2 ( x 2 , y 2 , z 2 ).

Parabola with a Vertical Axis

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

Parabola with a Horizontal Axis

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

Equation of a Circle

( x h ) 2 + ( y k ) 2 = r 2

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

Equation of a Circle Centered at the Origin

x 2 + y 2 = r 2

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

Equation of a Sphere

( x h ) 2 + ( y k ) 2 + ( z l ) 2 = r 2

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

Equation of a Sphere Centered at the Origin

x 2 + y 2 + z 2 = r 2

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 ( h 2 h 1 ) 2 + ( k 2 k 1 ) 2 ( r 1 + r 2 ) 2 , a collision occurs.

Optimized Sphere-Sphere Collision Detection

Given two spheres graphics/ap01inl16.gif and graphics/ap01inl15.gif , if ( h 2 h 1 ) 2 + ( k 2 k 1 ) 2 + ( l 2 i 1 ) 2 ( r 1 + r 2 ) 2 , a collision occurs.

 <  Day Day Up  >  


Beginning Math and Physics for Game Programmers
Beginning Math and Physics for Game Programmers
ISBN: 0735713901
EAN: 2147483647
Year: 2004
Pages: 143
Authors: Wendy Stahler

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net