<<

Affine

Jehee Lee Seoul National University Geometric Programming

• A way of handling geometric entities such as vectors, points, and transforms.

• Traditionally, computer graphics packages are implemented using homogeneous coordinates.

• We will review and coordinate- geometric programming. Example of coordinate-dependence

Point p

Point q

• What is the “sum” of these two positions ? If you assume coordinates, …

p = (x1, y1)

q = (x2, y2)

• The sum is (x1+x2, y1+y2) – Is it correct ? – Is it geometrically meaningful ? If you assume coordinates, …

p = (x1, y1)

(x1+x2, y1+y2)

q = (x2, y2)

Origin

• Vector sum

– (x1, y1) and (x2, y2) are considered as vectors from the origin to p and q, respectively. If you select a different origin, …

p = (x1, y1) (x1+x2, y1+y2)

q = (x2, y2)

Origin

• If you choose a different coordinate frame, you will get a different result Vector and Affine Spaces

• Vector – Includes vectors and related operations – No points

– Superset of – Includes vectors, points, and related operations Points and Vectors

vector (p-q) Point q

Point p

• A point is a specified with coordinate values. • A vector is specified as the difference between two points. • If an origin is specified, then a point can be represented by a vector from the origin. • But, a point is still not a vector in a coordinate-free point of view. Vector spaces

• A vector space consists of – Set of vectors, together with – Two operations: addition of vectors and multiplication of vectors by scalar numbers

• A of vectors is also a vector u, v,w ÎV Þ au + b v +g w ÎV Affine Spaces

• An affine space consists of – Set of points, an associated vector space, and – Two operations: the difference between two points and the addition of a vector to a point Coordinate-Invariant Geometric Operations

• Addition • Subtraction • Scalar multiplication • Linear combination • Addition

p + w u + v v w

u p u + v is a vector p + w is a point

u, v, w : vectors p, q : points Subtraction

p p - w

u u - v p - q -w

v q p u - v is a vector p - q is a vector p - w is a point

u, v, w : vectors p, q : points Scalar Multiplication

scalar • vector = vector 1 • point = point 0 • point = vector c • point = (undefined) if (c≠0,1) Linear Combination

• A linear space is spanned by a set of bases – Any vector in the space can be represented as a linear combination of bases

N åci vi = c0 v0 + c1v1 +!+ cN v N = v i=0 Affine Combination

N åcipi = c0p0 + c1p1 +!+ cN p N i=0 N N = (åci )p0 + åci (pi -p0 ) i=0 i=1 Example

• (p + q) / 2 : midpoint of pq

• (p + q) / 3 : Can you find a geometric meaning ?

• (p + q + r) / 3 : center of gravity of ∆pqr

• (p/2 + q/2 – r) : a vector from r to the midpoint of q and p Affine Frame

• A frame is defined as a set of vectors {vi | i=1, …, N} and a point o

– Set of vectors {vi} are bases of the associate vector space – o is an origin of the frame – N is the of the affine space – Any point p can be written as

p = o + c1v1 + c2v2 +!+ cN v N

– Any vector v can be written as

v = c1v1 + c2v2 +!+ cN v N Barycentric Coordinates

• Any point p can be written as

p = o + c1v1 + c2v2 +!+ cN v N

• Letting {qi | i=0,1,…,N} be – q0 = o, and

– qi = o + vi for i=1, …, N.

p = (1- c1 -!- cN )o + c1(o + v1) +!+ cN (o + v N )

= (1- c1 -!- cN )q0 + c1q1 +!+ cN q N

= c0q0 + c1q1 +!+ cN q N Summary Representation

• Use an “extra” coordinate – In 3-dimensional spaces • Point : (x, y, z, 1) • Vector : (x, y, z, 0) • For example

(x1, y1, z1, 1) + (x2, y2, z2, 1) = (x1+x2, y1+y2, z1+z2, 2) point point undefined

(x1, y1, z1, 1) - (x2, y2, z2, 1) = (x1-x2, y1-y2, z1-z2, 0) point point vector

(x1, y1, z1, 1) + (x2, y2, z2, 0) = (x1+x2, y1+y2, z1+z2, 1) point vector point Projective Spaces

• Homogeneous coordinates – (x, y, z, w) = (x/w, y/w, z/w, 1) – Useful for handling perspective

• But, it is algebraically inconsistent !!

1 (1,0,0,1) + (1,1,0,1) = (2,1,0,2) = (1, ,0,1) 2

2 (1,0,0,1) + (2,2,0,2) = (3,2,0,3) = (1, ,0,1) 3