Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Tensor operator wikipedia , lookup
Homogeneous coordinates wikipedia , lookup
Matrix calculus wikipedia , lookup
Euclidean vector wikipedia , lookup
Euclidean space wikipedia , lookup
Cartesian tensor wikipedia , lookup
Vector space wikipedia , lookup
Four-vector wikipedia , lookup
Linear algebra wikipedia , lookup
Covariance and contravariance of vectors wikipedia , lookup
Laplace–Runge–Lenz vector wikipedia , lookup
Vector Geometry CS5240 Theoretical Foundations in Multimedia Leow Wee Kheng Department of Computer Science School of Computing National University of Singapore Leow Wee Kheng (NUS) Vector Geometry 1 / 41 Motivation Motivation You are an IT assistant to a surgeon operating on a patient. She wants to know the difference between the left and right side. ? Leow Wee Kheng (NUS) Vector Geometry ? 2 / 41 Motivation Need to calculate ◮ symmetric plane ◮ distance of point to plane ◮ average difference between left and right sides She also wants to know ◮ Is symmetric plane perpendicular to horizontal plane? ◮ Are certain features on a straight line? ◮ etc. Need a convenient tool: vector geometry. Leow Wee Kheng (NUS) Vector Geometry 3 / 41 Vector Geometry Vector Geometry Vector geometry studies plane geometry using vector algebra. Can be 2-D, 3-D or m-D. Basic geometrical elements ◮ 0-D: point ◮ 1-D: line ◮ 2-D: plane ◮ m-D: hyperplane A hyperplane is a m-D linear structure in (m + 1)-D vector space. ◮ In 2-D space, it is a 1-D line. ◮ In 3-D space, it is a 2-D plane. Leow Wee Kheng (NUS) Vector Geometry 4 / 41 Vector Geometry Geometry studies many interesting properties: ◮ Normal of a plane. ◮ Distance of a point to a plane. ◮ Projection of a point on a plane. ◮ Intersection of two planes. ◮ Distance of a point to a line. ◮ Projection of a point on a line. ◮ Intersection of two lines. Leow Wee Kheng (NUS) Vector Geometry 5 / 41 Vector Geometry Vector Space Vector Space A vector space is a structure in which vector addition and scalar multiplication are defined: ◮ commutative: u + v = v + u ◮ associative: (u + v) + w = u + (v + w) ◮ zero vector: v + 0 = v ◮ negatives: v + (−v) = 0 ◮ distributive: s(u + v) = su + sv ◮ associative: r(sv) = (rs)v ◮ distributive: (r + s)v = rv + sv ◮ scalar-identity: 1v = v Leow Wee Kheng (NUS) Vector Geometry 6 / 41 Vector Geometry Vector Space A Hierarchy of Spaces a set of vectors vector addition, scalar multiplication y vector space with norm y normed space with limit y Banach space with inner product y Hilbert space (Euclidean space) Leow Wee Kheng (NUS) Vector Geometry 7 / 41 Vector Geometry ◮ ◮ length or norm: kvk = m X j=1 Vector Space 1/2 vj2 1/2 m X distance: d(u, v) = ku − vk = (uj − vj )2 j=1 m X uj v j . ◮ dot product: u · v = ◮ In matrix notation, we denote a vector as a column matrix u = [u1 · · · um ]⊤ , and vector dot product becomes matrix inner product u⊤ v. ◮ j=1 v · v = kvk2 Leow Wee Kheng (NUS) Vector Geometry 8 / 41 Vector Geometry ◮ Vector Space u · v = kukkvk cos θ, where θ is the angle between u and v. u θ ◮ ◮ v If v is a unit vector, then u · v = kuk cos θ, which is the component of u along v. In 3-D vector space, cross product u×v is orthogonal to u and v. i j k u×v = u1 u2 u3 v1 v2 v3 (1) = (u2 v3 − u3 v2 )i + (u3 v1 − u1 v3 )j + (u1 v2 − u2 v1 )k. Leow Wee Kheng (NUS) Vector Geometry 9 / 41 Vector Geometry ◮ ◮ ◮ ◮ positive: v · v ≥ 0 non-degenerate: v · v = 0 iff v = 0 distributive: u · (v + w) = u · v + u · w multiplicative: su · v = s(u · v) ◮ symmetric: u · v = v · u ◮ positive: kvk ≥ 0 ◮ Vector Space non-degenerate: kvk = 0 iff v = 0 ◮ multiplicative: ksvk = |s| kvk ◮ positive: d(u, v) ≥ 0 ◮ non-degenerate: d(u, v) = 0 iff u = v ◮ symmetric: d(u, v) = d(v, u) Leow Wee Kheng (NUS) Vector Geometry 10 / 41 Plane Geometry Normal of Plane Normal of Plane A hyperplane π in m-D space is given by the linear equation a1 x1 + a2 x2 + · · · + am xm + am+1 = 0. ◮ Eq. 2 may be scaled by 1/am+1 to remove am+1 . ◮ We keep am+1 in Eq. 2 to retain the scaling factor. (2) Denote vectors a = (a1 , . . . , am ), x = (x1 , . . . , xm ). Then, equation of π can be written as a · x + am+1 = 0. ◮ a and am+1 represent the plane π. ◮ x is a point on π. Leow Wee Kheng (NUS) Vector Geometry (3) 11 / 41 Plane Geometry Normal of Plane Plane π has a unit normal vector n. n p1 p1 − p2 p2 π Let p1 and p2 be two points on π. Then, a · p1 + am+1 = 0, (4) a · p2 + am+1 = 0. (5) a · (p1 − p2 ) = 0. (6) Vector Geometry 12 / 41 Subtracting Eq. 4 and 5 yields Leow Wee Kheng (NUS) Plane Geometry Normal of Plane Since p1 − p2 is on π, a must be normal to π. Then, the unit normal n of π is n= Leow Wee Kheng (NUS) a . kak Vector Geometry (7) 13 / 41 Plane Geometry Distance to Plane Distance to Plane Now, consider a point q not on π. q n d x π O Let x denote the (perpendicular) projection of q on π along n. Then, the signed (perpendicular, shortest) distance d of q to π is Leow Wee Kheng (NUS) d = q · n − x · n. (8) Vector Geometry 14 / 41 Plane Geometry Distance to Plane d =q·n−x·n = q·a−x·a kak (9) From Eq. 3, for any point x on π, a · x = −am+1 . So, d= a · q + am+1 . kak ◮ For a point p on π, d = 0. ◮ For a point q on the +n side of π, d > 0. ◮ For a point q on the −n side of π, d < 0. Leow Wee Kheng (NUS) Vector Geometry (10) (11) 15 / 41 Plane Geometry Projection on Plane Projection on Plane q n d x π O The projection x of q on π along n is given by x = q − d n. Leow Wee Kheng (NUS) Vector Geometry (12) 16 / 41 Plane Geometry So, x=q− Projection on Plane a · q + am+1 a. kak2 (13) For q at the origin, q = 0, and its projection is x=− Leow Wee Kheng (NUS) am+1 a. kak2 Vector Geometry (14) 17 / 41 Plane Geometry Representations Representations A hyperplane can be represented in several ways. The implicit equation represents a hyperplane as a1 x1 + a2 x2 + · · · + am xm + am+1 = 0, (15) where aj are the plane’s coefficients and x is a point on the plane. In contrast, an explicit equation has the form xj = · · · . The point-normal form represents a hyperplane by a known point p and unit normal n on the plane, with n · (x − p) = 0, (16) where x is a point on the plane. Leow Wee Kheng (NUS) Vector Geometry 18 / 41 Plane Geometry Representations A line in 2-D can be represented in the previous forms. A line in m-D, m ≥ 3, can only be represented as a parametric equation x = p + su, ◮ x is a point on the line. ◮ p is a known point on the line. ◮ u is the unit vector along the line. ◮ s is a scalar parameter. Leow Wee Kheng (NUS) Vector Geometry (17) 19 / 41 Plane Geometry Representations Consider a point p = (x1 , . . . , xm ) in m-D vector space. b2 p x2 b1 O x1 Let bj denote m mutually non-parallel unit vectors in the same space. Then, p can be represented as a linear combination of bj : p = c 1 b1 + · · · + c m bm . (18) The vectors bj form a basis. Leow Wee Kheng (NUS) Vector Geometry 20 / 41 Plane Geometry Representations In particular, if bj are orthogonal to each other, they form an orthonormal basis. b2 p x2 b1 O x1 In this case, p = p · b1 b1 + · · · + p · bm bm . (19) The coordinates of p in this basis is (p · b1 , . . . , p · bm ). Leow Wee Kheng (NUS) Vector Geometry 21 / 41 Plane Geometry Conversion of Representations Conversion of Representations Consider a plane π represented by a1 x1 + · · · + am xm + am+1 = 0. (20) As shown previously, π can be represented in point-normal form by a ◮ its unit normal n = , kak am+1 ◮ the projected point p of the origin on π, where p = − a. kak2 Leow Wee Kheng (NUS) Vector Geometry 22 / 41 Plane Geometry Conversion of Representations Now, consider a plane π represented by a point p and unit normal n. From Eq. 6, n · (x − p) = 0. (21) So, we obtain the implicit equation n1 x1 + · · · + nm xm − n · p = 0. Leow Wee Kheng (NUS) Vector Geometry (22) 23 / 41 Plane Geometry Conversion of Representations Example Consider a 1-D hyperplane, i.e., a line, in a 2-D space represented by x + y − 1 = 0. (23) y 1 n p x O 1 In this case, a1 = 1, a2 = 1, a3 = −1. Leow Wee Kheng (NUS) Vector Geometry 24 / 41 Plane Geometry Conversion of Representations Line normal n is (1, 1) (a1 , a2 ) = √ = n= k(a1 , a2 )k 2 1 1 √ ,√ 2 2 (24) The projected point p of the origin on the line is 1 a3 (a1 , a2 ) = (1, 1) = p=− 2 k(a1 , a2 )k 2 1 1 , 2 2 . (25) The signed distance d of the origin to the line is d= a · 0 + a3 1 = −√ . k(a1 , a2 )k 2 (26) That is, the origin is on the negative side of the line. Leow Wee Kheng (NUS) Vector Geometry 25 / 41 Plane Geometry Plane Intersection Plane Intersection Consider two non-parallel (infinite) hyperplanes πa and πb π1 : a · x + am+1 = 0, π2 : b · x + bm+1 = 0. (27) The intersection of π1 and π2 is a hyperplane of one fewer dimension. Any point x on the intersection satisfies both plane equations. Caution! Do not subtract the two equations to get (a − b) · x + am+1 − bm+1 = 0. (28) Why? Leow Wee Kheng (NUS) Vector Geometry 26 / 41 Plane Geometry Plane Intersection Now, let us consider 2-D planes in 3-D space. n1 n2 n1 x n2 π2 π1 Denote the planes’ point-normal forms as π1 : n1 · x − n1 · p1 = 0, π2 : n2 · x − n2 · p2 = 0. (29) In 3-D space, n1 ×n2 is well-defined. n1 , n2 , and n1 ×n2 form a basis. Leow Wee Kheng (NUS) Vector Geometry 27 / 41 Plane Geometry Plane Intersection So, any point p can be represented as p = c1 n1 + c2 n2 + c3 n1 ×n2 (30) for some appropriate c1 , c2 , c3 . In 3-D space, intersection of 2 planes is a line. n1 ×n2 is parallel to the line of intersection. So, the line can be represented by the parametric equation x = c1 n1 + c2 n2 + sn1 ×n2 (31) where s is a scalar parameter. Leow Wee Kheng (NUS) Vector Geometry 28 / 41 Plane Geometry Plane Intersection Let’s denote h1 = n1 · p1 and h2 = n2 · p2 . Substituting Eq. 31 into Eq. 29 gives c1 + c2 n1 · n2 = h1 , c1 n1 · n2 + c2 = h2 . Solving Eq. 32 yields (Homework) c1 = h1 − h2 n1 · n2 , 1 − (n1 · n2 )2 h2 − h1 n1 · n2 . c2 = 1 − (n1 · n2 )2 Leow Wee Kheng (NUS) (32) Vector Geometry (33) 29 / 41 Plane Geometry Plane Intersection Example Consider these two 2-D planes 3-D space: π1 : x + y − 1 = 0, z π2 : x − y = 0. π1 π2 n1 Want to find the intersection of the planes. y n2 1 O 1 x Leow Wee Kheng (NUS) Vector Geometry 30 / 41 Plane Geometry Plane Intersection Convert to point-normal form with the projected point of the origin. 1 1 1 1 p1 = plane π1 : n1 = √ , √ , 0 , , ,0 , 2 2 2 2 (34) 1 1 plane π2 : n2 = √ , − √ , 0 , p2 = (0, 0, 0). 2 2 So, 1 h1 = n1 · p1 = √ , 2 h2 = n2 · p2 = 0. (35) Note: n1 · n2 = 0, n1 ×n2 = (0, 0, −1). (Homework) Then, the intersection line is given by x = c1 · n1 + c2 · n2 + sn1 ×n2 = Leow Wee Kheng (NUS) 1 1 , , 0 + s(0, 0, −1). 2 2 Vector Geometry (36) 31 / 41 Line Geometry Projection on Line Projection on Line A line l in m-D space with m ≥ 3 is given by the parametric equation x = p + su. (37) q p x u l O Consider a point q not on l that projects to x on l. The distance between p and x is So, Leow Wee Kheng (NUS) q · u − p · u = (q − p) · u. (38) x = p + (q − p) · u u. (39) Vector Geometry 32 / 41 Line Geometry Distance to Line Distance to Line q p x u l O The (perpendicular) distance d from q to its projection x on line l is d = kq − xk = k(q − p) − (q − p) · u uk. Leow Wee Kheng (NUS) Vector Geometry (40) 33 / 41 Line Geometry Line Intersection Line Intersection In general, two non-parallel lines l1 and l2 in m-D space with m ≥ 3 do not intersect. They can intersect only if they are coplanar, i.e., lie on a 2-D plane. In this case, suppose they are given by the implicit equations a1 x + a2 y + a3 = 0, b1 x + b2 y + b3 Then, their intersection is (41) (Homework) x = y = Leow Wee Kheng (NUS) = 0. a 2 b3 − a 3 b2 , a 1 b2 − a 2 b1 a 3 b1 − a 1 b3 . a 1 b2 − a 2 b1 Vector Geometry (42) 34 / 41 Line Geometry Line Intersection Example y l1 l2 1 x x O 1 The line equations are: l1 : x + y − 1 = 0 l2 : x − y − 0 = 0 So, x= Leow Wee Kheng (NUS) 0−1 1 = , −1 − 1 2 y= Vector Geometry (43) −1 − 0 1 = . −1 − 1 2 35 / 41 Line Geometry Line Intersection In general, can only solve for a point that is closest to the lines. l1 d1 q l2 d2 Point q projects perpendicularly to x1 on line l1 and x2 on line l2 . Point q is mid-way between x1 and x2 . Point q minimizes its distance to l1 and l2 . Leow Wee Kheng (NUS) Vector Geometry 36 / 41 Line Geometry Line Intersection Given n lines of the form x = pi + sui , the closest point q to the lines minimizes the sum squared distance D D= n X i=1 k(q − pi ) − (q − pi ) · ui ui k2 . (44) There is no closed-form solution for this problem. In practice, have to apply optimization algorithm instead. Leow Wee Kheng (NUS) Vector Geometry 37 / 41 Summary Summary ◮ Vector geometry studies plane geometry using vector algebra. ◮ Studies geometrical properties such as normal, distance, projection, intersection. ◮ Two representations for planes: implicit equation vs. point-normal form. ◮ Lines in m-D space with m ≥ 3 are represented by point-direction form. Leow Wee Kheng (NUS) Vector Geometry 38 / 41 Probing Questions Probing Questions ◮ A point is on a plane when its distance to the plane is 0. In programming, we may not get exactly 0 due to floating-point rounding error. How to handle this problem? ◮ The distance between a point to a plane has a sign. Does the distance between a point to a line has a sign? ◮ What is the intersection of 3 planes? How to get the intersection of 3 planes? Leow Wee Kheng (NUS) Vector Geometry 39 / 41 Homework Homework 1. What are the key concepts that you have learned? 2. Consider a plane π represented by a known point p and a unit normal n on π. Let q denote a point whose projected point on π is not p. Show that the perpendicular distance d of q to π is given by d = (q − p) · n. 3. Solve Eq. 32 to obtain Eq. 33 for the intersecting line of two planes. 4. Show that for the n1 and n2 in Eq. 34, n1 · n2 = 0, and n1 ×n2 = (0, 0, −1). 5. Solve Eq. 41 to obtain Eq. 42 for the intersection point of two coplanar lines. Leow Wee Kheng (NUS) Vector Geometry 40 / 41 References References 1. J. E. Marsden and M. J. Hoffman, Elementary Classical Analysis, 2nd ed., W. H. Freeman, 1993. 2. B. Noble and J. W. Daniel, Applied Linear Algebra, 3rd ed., Prentice-Hall, 1988. Leow Wee Kheng (NUS) Vector Geometry 41 / 41