03 vector calculus

1,279 views

Published on

0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,279
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
72
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

03 vector calculus

  1. 1. Vector CalculusMengxia ZhuFall 2007
  2. 2. Objective Review vector arithmetic Distinguish points and vectors Relate geometric concepts to their algebraic representation Describe point, line, and planes Exploit the dot product and cross product and their applications in Graphics
  3. 3. Basic Entities Coordinate system: has an origin and some mutually perpendicular axes emanating from the origin. Q Point P: a location in space V P {2, 3, 9} V=Q-P Vector v : with length and direction, physical entities, such as force, and velocity. Vector has no fixed location, seen as points displacement y y z Right-hand system Left-hand system x x z
  4. 4. Vector-scalar multiplication Vector permits two fundamental operations: add them, multiply them with real number  Multiplication gives a vector α v  Has the same direction as that of v v 2.5v -v
  5. 5. Vector addition v1 v1-v2 Sum of two vectors Subtraction of two vectors Adding and subtraction of v2 corresponding components of two vectors gives a new vector v1+v2 v1+v2 v1 v1-v2v1 v1 v2 v2 v2
  6. 6. Linear Combination and AffineCombination A linear combination of vectors W = a1v1+a2v2 + a3v3 +…+anvn: all weights are scalars. A linear combination is affine combination of vectors if the sum of all coefficients add up to unity. A convex combination poses a further restriction on affine combination. Not only must the coefficients sum to unit, but each must also be non-negative
  7. 7. Linear Combination of Vectors The combination is Convex if the coefficients sum to 1, and are not negative. Partition of unit m v =∑ i vi a v=a1v1 + a2v2 +(1-a1-a2)v3 i=1 v3 v2 v=(1-a)v1 + av2 = V1+a(V2-V1) a(V2-V1) v2 v1 v1
  8. 8. Normalize a vector v is represented by n-tuple ( v1,v2,…vn) Magnitude (length): the distance from the tail to the head. v = v + v2 + ... + vn 1 2 2 2 Normalization: Scale a vector to have a unity length, unit vector ~ v v= v
  9. 9. Point-vector addition Subtraction of two points P and Q gives a vector v: v=P-Q Adding a vector v to point Q gives a point K: K=Q+u P v Q u K
  10. 10. Dot product Dot product between vector v and vector u gives a scalar If u and v are orthogonal, the dot product equals zero. (a1,a2) dot (b1,b2) = a1xb1 + a2xb2The most important application of the dot product is to find the angle between two vectors or between two intersecting lines. v u θv θu
  11. 11. The Angle between Two Vectors Hence, dot product varies as the cosine of the angle from u to v. u g = u v cos θ v v = vgv v ug > 0 v u v v u ug = 0 v θ u v u ug < 0 v
  12. 12. Cross Product a = (a1, a2, a3), b=(b1, b2, b3) a x b = ( a2b3 –a3b2), (a3b1-a1b3), (a1b2 – a2b1)
  13. 13. Cross Product Cross product between vector v and u gives a vector ~ v × u = n v u sin θ vxu n is a unit vector perpendicular to both u and v. u Follow the right-hand rule u and v are parallel if v v×u = 0 uxv The length of the cross product equals the area of the parallelogram determined by u and v
  14. 14. Operation Calculation
  15. 15. Operation Calculation
  16. 16. Homogeneous representation Revisit coordinate frame system Ordinary coordinate system, points and vectors are represented the same. However, they are quite different. Points have location, no direction and size. Vector has no location, but with direction and size.
  17. 17. Homogeneous representation cont Represent both points and vector using the same set of basic underlying objects,  v1   ÷ v = av1 + bv2 + cv3 = ( a, b, c, ϑ )  v2 ÷ One of the hallmarks of  v3 ÷ computer graphics, keep  ÷ straight the distinction between 0  points and vectors with a  p1  compact notation. Easy to  ÷ program… P = ap1 + bp2 + cp3 + ϑ = (a, b, c,ϑ )  p2 ÷  p3 ÷ We view point’s location as an  ÷ offset from the origin by a 1  certain amount ( a, b, c, ϑ )
  18. 18. Homogeneous representation OpenGL uses 4D homogeneous. coordinates for all its vertices. Point: (x,y,z,1) Vector: (x,y,z,0) To go from ordinary to homogenous coordinates, if the object is a point, append a 1, if the object is a vector, append a 0.
  19. 19. Line A line is defined by two points. It is infinite in length and extending forever in both directions. A line segment is defined by two endpoints. A ray is semi-infinite, specified by a starting point and a direction. B B B C C C
  20. 20. Parametric Representation Line When t varies, the point P trace out all of L(t ) = C + bt the points on the line defined by C and B. b = B −C t>1 B L t=1 C t=0 t<0
  21. 21. Parametric Plane Heavy use of polygons in 3D graphics, planes seem to appear everywhere.  Three point form  Parametric representation  Point normal form
  22. 22. Parametric form Equation P(s,t) = C + as + bt b B a = A-C, b = B-C a C A Given any values of s and t, we can identify the corresponding point on the plane.
  23. 23. Three point form of Plane Given three points A, B, and C. We rewrite the parametric form: P(s,t) = C + s (A-C) + t(B-C) Affine combination of points: P(s,t) = sA+tB+(1-s-t)C
  24. 24. Point Normal form Plane can be specified by n a single point B, that lies within it and direction n, normal to the plane. B Normal n is perpendicular to any line lying in the plane. R is any point on the ng R − B ) = 0 plane, it satisfies: (
  25. 25. Tweening for Art and Animation The affine combination of points P = A(1-t) + Bt, performs a linear interpolation between the points A and B. Interesting animation can be created that show one figure being “tweened” into another. The procedure if simplest if the two figures are polylines based on the same number of points.
  26. 26. Tweeningvoid drawTween ( Point A[], Point B[], int n, float t){ for (int i= 0; i< n; i++) { Point p; P = Tween(A[i], B[i], t); if ( i == 0 ) moveTo (Px, Py); else lineTo (Px, Py); }}

×