Eric Weisstein's world of Mathematics (which used to be called Eric's Treasure Trove of Mathematics) is an extremely comprehensive collection of math facts and definitions. Eric has other encyclopedias at www.treasure-troves.com

S.O.S. Mathematics has a variety of algebra, trigonometry, calculus, and differential equations tutorial pages.

Dave Eberly has a web site called Magic Software with several pages of descriptions and code that answers questions from comp.graphics.algorithms.

Steve Hollasch at Microsoft has a very comprehensive page of graphics notes which he would like to turn into a graphics encyclopedia.

Vector math identities and algorithms from Japan.

Paul Bourke has a variety of pages with useful tidbits, many of which are linked to from Steve Hollasch's page. The site is in Australia, so the connection is sometimes quite slow from the U.S.

The graphics group at UC Davis also has notes about computer graphics.

Peter H. Dana has created, as a part of The Geographer's Craft Project, an excellent page documenting geographic coordinate systems.

Josh Levenberg has a page of links to yet more graphics algorithm resources.

- sqrt(2)
- 1.4142135623730950488016887242
- phi =
^{1}/_{2}(sqrt(5)+1) - 1.6180339887498948482045868343656
- sqrt(3)
- 1.7320508075688772935274463415
- e
- 2.71828182845904523536028747135266
- pi
- 3.14159265358979323846264338327950288
- Feigenbaum's constant
- 4.669201609102990671853

Phi is the golden
ratio for which ^{1}/_{phi} = phi - 1 and
phi^{2} = phi + 1.

Solid | Vertex coordinates |
---|---|

Tetrahedron | ( 1, 1, 1), ( 1, -1, -1), ( -1, 1, -1), ( -1, -1, 1) |

Cube | (+-1,+-1,+-1) |

Octahedron | (+-1, 0, 0), ( 0,+-1, 0), ( 0, 0,+-1) |

Cubeoctahedron | ( 0,+-1,+-1), (+-1, 0,+-1), (+-1,+-1, 0) |

Icosahedron | ( 0,+-p,+-1), (+-1, 0,+-p), (+-p,+-1, 0) |

Dodecahedron | ( 0,+-i,+-p), (+-p, 0,+-i), (+-i,+-p, 0), (+-1,+-1,+-1) |

Icosidodecahedron | (+-2, 0, 0), ( 0,+-2, 0), ( 0, 0,+-2), (+-p,+-i,+-1), (+-1,+-p,+-i), (+-i,+-1,+-p) |

with golden ratio: p = ^{1}/_{2}(sqrt(5)+1); i =
^{1}/_{2}(sqrt(5)-1) = ^{1}/_{p} =
p - 1

Another contruction for the icosahedron puts two of the vertices at
+/- 1 along one of the major axes and two rings of five vertices
with a radius of ^{2}/_{sqrt(5)} from the axis and
at heights of +/- ^{1}/_{sqrt(5)} above and below
the equator.

**Law of Cosines**- a, b, c are lengths of the sides of a triangle, angle C is opposite side c- c
^{2}= a^{2}+ b^{2}- 2 a b cos C

**Angle addition and subtraction**sin(a + b) = sin a cos b + cos a sin b sin(a - b) = sin a cos b - cos a sin b cos(a + b) = cos a cos b - sin a sin b cos(a - b) = cos a cos b + sin a sin b tan(a + b) = (tan a + tan b) / (1 - tan a tan b) tan(a - b) = (tan a - tan b) / (1 + tab a tan b)

**Half-angle relations**sin ^{2}a= ^{1}/_{2}(1 - cos 2a)cos ^{2}a= ^{1}/_{2}(1 + cos 2a)

**Trigonometric functions at select points**-
Degrees Radians Sine Cosine 0 0 0 1 15 ^{pi}/_{12}^{1}/_{2}sqrt(2 - sqrt(3))^{1}/_{2}sqrt(2 + sqrt(3))18 ^{pi}/_{10}^{1}/_{2}phi^{-1}^{1}/_{2}sqrt(phi + 2)22.5 ^{pi}/_{8}^{1}/_{2}sqrt(2 - sqrt(2))^{1}/_{2}sqrt(2 + sqrt(2))30 ^{pi}/_{6}^{1}/_{2}^{1}/_{2}sqrt(3)36 ^{pi}/_{5}^{1}/_{2}phi^{-1}sqrt(phi + 2)^{1}/_{2}phi45 ^{pi}/_{4}^{1}/_{2}sqrt(2)^{1}/_{2}sqrt(2)

The following computations will rotate a point about an axis rooted at the origin. To rotate an object about a point other than the origin, you must first translate the object to place the point at the origin and then translate it back after the rotation.

Rotate [ P.x P.y P.z ]^{T} about the x-axis by t radians:

[ P.x' ] [ 1 0 0 ] [ P.x ] [ P.y' ] = [ 0 cos(t) -sin(t) ] * [ P.y ] [ P.z' ] [ 0 sin(t) cos(t) ] [ P.z ]rotates from the y-axis towards the z-axis.

Rotate [ P.x P.y P.z ]^{T} about the y-axis by t radians:

[ P.x' ] [ cos(t) 0 sin(t) ] [ P.x ] [ P.y' ] = [ 0 1 0 ] * [ P.y ] [ P.z' ] [ -sin(t) 0 cos(t) ] [ P.z ]rotates from the z-axis towards the x-axis.

Rotate [ P.x P.y P.z ]^{T} about the z-axis by t radians:

[ P.x' ] [ cos(t) -sin(t) 0 ] [ P.x ] [ P.y' ] = [ sin(t) cos(t) 0 ] * [ P.y ] [ P.z' ] [ 0 0 1 ] [ P.z ]rotates from the x-axis towards the y-axis.

Rotate [ P.x P.y P.z ]^{T} about the unit vector [ x y z
]^{T} by t radians:

Let s = sin(t), c = cos(t), c_1 = 1 - c, and precompute xy*c_1, xz*c_1, yz*c_1, xs, ys, and zs (for the sake of efficiency.)

[ P.x' ] [ xx*c_1+c xy*c_1-zs xz*c_1+ys ] [ P.x ] [ P.y' ] = [ xy*c_1+zs yy*c_1+c yz*c_1-xs ] * [ P.y ] [ P.z' ] [ xz*c_1-ys yz*c_1+xs zz*c_1+c ] [ P.z ]

More elaborate descriptions can be found in chapters five and six of "The Book", _Computer Graphics: Principles and Practice, 2nd Ed._ by Foley, van Dam, Feiner, and Hughes.

Given two lines, one passing through the points
**P _{0}** and

and the other implicitly asP=P+_{0}t(P-_{1}P)_{0}

dot(whereN,Q-_{0}P) = 0

Substitute the explicit equation into the implicit one and solve
for *t* to get

t= dot(N,Q-_{0}P) / dot(_{0}N,P-_{1}P)_{0}

Finally, substitute *t* into the explicit equation to solve
for **P**, the point of intersection.

We want to compute the intersection between a line (defined by a
point **P _{line}** and a vector

and one of the other points it contains, such asN= normalize(cross(A-C,B-C)),

dot(If the explicit equation for pointsN,C-P) = 0.

then we can substitute this into the plane equation and solve for t to getP=P+_{line}tV,_{line}

Substituting this value oft= dot(N,C-P) / dot(_{line}N,V)._{line}

To test for intersection between a line and a triangle, first compute the point of intersection between the line and the plane containing the triangle as described above.

Next, we want to see if this point lies within the triangle.
Since this is an inherently 2-D problem, we simplify the test by
projecting the triangle and point onto one of the primary
coordinate planes. To avoid loss of precision, we want to drop
the component for which the plane normal has the largest absolute
value. We will call these new points **a**, **b**, and
**c** for the triangle and **p** for the point.

Finally, we compute the barycentric coordinates (*u*,
*v*, *w*) for the point as

denom= cross(a-c,b-c)

u= cross(p-c,b-c) /denom

v= cross(a-c,p-c) /denom

w= 1 -u-v

The point **p** is in the triangle if *u* and *v* are
between zero and one and sum to less than one. (Computing
*w* is unnecessary.)

Note that this is the 2D scalar cross product:

cross((x,_{0}y), (_{0}x,_{1}y)) =_{1}x_{0}y-_{1}x_{1}y_{0}

To determine if a *radial* ray intersects a spherical
triangle on the unit sphere, compute the intersection of the ray
with the plane passing through the triangle's vertices and test
for intersection with the planar triangle.

Alternatively, if

dot(is positive, then the radial rayP, cross(A,B))

A guide to a huge number of file formats.

Steven C. Dollins Last modified: Tue Feb 19 15:54:17 EST 2002