Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

Sets and Mappings

Common sets of interest include

• R—the real numbers;

• R+—the nonnegative real numbers (includes zero);

• R2—the ordered pairs in the real 2D plane;

• Rn—the points in n-dimensional Cartesian space;

• Z—the integers;

• S2—the set of 3D points (points in R3) on the unit sphere.

Logarithms

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

Trigonometry

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

Shifting identities:

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

Pythagorean identities:

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

Addition and subtraction identities:

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

Half-angle identities:

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

Product identities:

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

Arbitrary triangles with side:

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

Vectors

Identities:

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

Dot Product:

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

The dot product obeys the familiar associative and distributive properties we have in real arithmetic:

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

dot product:

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

Cross Product

Identities:

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

Assume:

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

So:

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

Property:

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

Cross product:

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

So, in coordinate form,

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

Orthonormal Bases and Coordinate Frames

Identities:

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

Global and Local Coordinate System:

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

Curves and Surfaces

2D Implicit Curves

An implicit equation in two dimensions:

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

f does have values for all (x, y). We can think of f as a terrain, with sea level at f = 0 . The shore is the implicit curve. The value of f is the altitude.

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

For example:

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

using vector:

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

The vector form of an equation often suggests more geometry and intuition than the equivalent full-blown Cartesian form with x and y.

It is usually advisable to use vector forms when possible.

The 2D Gradient

If we think of the function f(x, y) as a height field with height = f(x, y), the gradient vector points in the direction of maximum upslope, i.e., straight uphill. The gradient vector ∇f(x, y) is given by

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

Implicit 2D Lines

We can start with any (A, B) perpendicular to (x1-x0, y1-y0).

Such a vector is just (A, B) = (y0 - y1, x1 - x0) by the same reasoning.

This means that the equation of the line through (x0, y0) and (x1, y1) .

The full equation for the line:

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

Unit vector:

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

The distance from a point to the line is the length of the vector k(A, B), which is

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

For the point (x, y) + k(A, B), the value of f(x, y) = Ax + By + C is

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

We can see that the signed distance from line Ax + By + C = 0 to a point (a, b) is

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

Implicit Quadric Curves

Two-dimensional quadric curves

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

Examples of quadric curves include the circle with center (xc, yc) and radius r,

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

and axis-aligned ellipses of the form

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

where (xc, yc) is the center of the ellipse, and a and b are the minor and major semi-axes.

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

Surface Normal to an Implicit Surface

A surface normal (which is needed for lighting computations, among other things) is a vector perpendicular to the surface.

The surface normal at a point p on an implicit surface is given by the gradient of the implicit function

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

the surface -f§ = 0 is the same as surface f§ = 0 but has directionally reversed gradients, i.e.,

-∇f§ = ∇(-f§).

Implicit Planes

As an example, consider the infinite plane through point a with surface normal n. The implicit equation to describe this plane is given by

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

Sometimes we want the implicit equation for a plane through points a, b, and c.

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

This allows us to write the implicit plane equation:

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

determinant:

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

Linear Interpolation

Two points a and b are associated with a parameter t to form the line

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

The parameter t is just the fractional distance between xi and xi+1:

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

Notice that Equation has this form with

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

Triangles

2D Triangles

Triangles Area:

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

Barycentric coordinates:

As a nonorthogonal coordinate system, where the coordinate origin is a and the vectors from a to b and c are the basis vectors. any point p can be written as:

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

Note that we can reorder the terms in Equation to get

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

Often people define a new variable α to improve the symmetry of the equations:

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

which yields the equation

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

with the constraint that

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

Barycentric coordinates are defined for all points on the plane. A particularly nice feature of barycentric coordinates is that a point p is inside the triangle formed by a, b, and c if and only if

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

  • If one of the coordinates is zero and the other two are between zero and one, then you are on an edge. If two of the coordinates are zero, then the other is one, and you are at a vertex.
  • barycentric coordinates is that Equation in effect mixes the coordinates of the three vertices in a smooth way.

Given a point p, how do we compute its barycentric coordinates?

  1. Linear system

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

  1. Implicit lines

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

  1. Areas

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

3D Triangles

One wonderful thing about barycentric coordinates is that they extend almost transparently to 3D

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

The normal vector(right-hand rule)

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

The area

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

Recall that

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

get

Fundamentals of Computer Graphics Note 2 - Miscellaneous Math

相关文章: