cs405 03 Representation
cs405 03 Representation
• Vector Analysis
• Transformations
Vector Basics
a=[1 2 …. n]T=
Coordinate Systems
• Which is correct?
v
v
v2
v1
P0
v3
• Frame determined by (P0, v1, v2, v3)
• Within this frame, every vector can be written as
v=1v1+ 2v2 +….+nvn
• Every point can be written as
P = P0 + 1v1+ 2v2 +….+nvn
Confusing Points and Vectors
Consider the point and the vector
P = P0 + 1v1+ 2v2 +….+nvn
v=1v1+ 2v2 +….+nvn
They appear to have the similar representations
p=[1 2 3] v=[1 2 3] v
which confuse the point with the vector p
A vector has no position v
The affine combination 0.5 (P1 + P2) does not depend on this choice.
A point plus a vector is an affine combination of points
P = A + t (B - A)
P = t B + (1 – t) A !!!!!!!!!Why?
The Centroid of a triangle
Show that the three medians of T meet at a point that lies 2/3 of the
way along each median.
G = (E + F) / 2
The point that is two-thirds of the way from D to G is
D + (2/3)(G – D)
= (D + E + F) /3
Linear Interpolation of Two Points
tween (A,B,t) computes the point P(t) that is the fraction t of the way
Along the straight line from point A to point B.
Tweening
P = (1 – t) Ai + t Bi
This polyline begins with the shape of A and ends with the shape of B,
but in between it is a blend of the two shapes.
Keyframe Animation
Quadratic and Cubic Tweening
1 = ((1-t) + t) 2
P = (1 – t)2 A + 2t (1 – t) B + t2 C
1 = ((1-t) + t) 3
Representing Lines and Planes
Lines
Parametric Representation
• Consider all points of the form
P()=P0 + d
Set of all points that pass through P0 in the direction of
the vector d
The line passes through the points C and B. What is the point normal
form of L?
n . (R-C) = 0
For any R(x,y).
A certain dot product must turn out to be zero for
every point R on the line.
Example: L passes through C=(3,4) and B=(5,-2)
P(,)=R+u+v P(,)=R+(Q-R)+(P-Q)
The line segment that joins A and C is the set of points of the form
Such points are determined by both and , and form the plane
determined by A,B, and C.
T () =C + (1-)A] + (1-)B
T () = C + A – C) + (1-)(B-C)
T () = C + A – C) + (1-)(B-C)
Noting that A-C and B-C are arbitrary vectors, a plane can be
determined as:
T (s,t) = C + su + tv
T (s,t) = sA + tB + (1-s-t)C
n . (R – B) = 0
Example: Plane passing through A=(1,2,3) with normal vector
N=(2, -1, -2)
AB (t) = A + bt b=B-A
CD (u) = C + du d=D-C
A + bt = C + du
bt = c + du c=C-A
d┴. bt = d┴. c
The center S of the desired circle must be equidistant from all three
vertices, so it must lie on the perpendicular bisector of each side of
triangle ABC.
Intersection of lines with planes; clipping
n . (P – B) = 0
n . (A + cthit – B) = 0
n . (A – B) + (n . cthit) = 0
if n . c > 0 the ray is aimed “along with” the normal
If the skin forms a closed surface that encloses some space, the mesh
is called a polyhedron.
Polygon Intersection Problems
Which part of a given line L lies inside the object, and which part
lies outside
Convex Polygons and Polyhedra
(-1, 0) . (P – (0,0) = 0
(0, -1) . (P – (0,0) = 0
(1, 1) . (P – (1,0) = 0
Note that in each case the outward normal is used
Ray Intersections and Clipping for convex polygons
Consider each of the bounding lines of P in turn and find where the
ray A + ct intersects that line.
Assume that each bounding line of P is stored in point normal form as the
pair {B, n}
If n . c > 0 the ray is exiting from P
If n . c = 0 the ray is parallel to the line
If n . c < 0 the ray is entering P
[tin , tout ] is the candidate interval of t, the interval inside of which
the ray might lie inside the object.
• Initialize the candidate interval to [0,1]
• For each bounding line, find the hit time thit and determine whether
it is an entering or exiting hit
• If entering hit, set tin = max (tin, thit)
• If exiting hit, set tout = min (tout, thit)
Find where the ray A + ct lies inside the polygon P given the list
of vertices P0, P1, ..., PN-1
The ray can enter and exit from P multiple times and the result of
clipping a segment against P may result in a list of segments rather
than a single one.
ct = bi + eiu
Edge u t
0 0.3846 0.2308
1 -0.727 -0.2727
2 0.9048 0.7142
3 0.4 0.6
4 0.375 0.375