Download presentation
Presentation is loading. Please wait.
Published byKristin Poole Modified over 9 years ago
1
Chi-Cheng Lin, Winona State University CS430 Computer Graphics Vectors Part III Intersections
2
2 Topics l Intersection of Two Line Segments l Application – Excircle l Intersection of Line and Plane
3
3 Intersection of Two Line Segments l Problem: Given two line segments AB and CD, determine whether they intersect, and if they do, find the intersection point l Cases A B C D A B C D A B C D A B C D A B D C A B D C
4
4 Parametric Line l AB(t) = A + bt, where b = B -A z - < t < : parent line of AB z 0.0 t 1.0: line segment AB z 0.0 t < : ray A B t >1 t =1 t =0 t <0
5
5 Intersection of Two Line Segments l AB(t) = A + bt, where b = B -A CD(u) = C + du, where d = D -C l Parent lines of AB and CD intersect if A + bt = C + du Let c = C - A bt = c + du d bt = d c + d du d bt = d c
6
6 Intersection of Two Line Segments Case I: d b 0 AB and CD are not parallel (why?) t = (d c)/(d b) Similarly, (how?) u = (b c)/(d b) l Q: When do two AB and CD intersect? l A: When 0.0 t 1.0 and 0.0 u 1.0
7
7 Intersection of Two Line Segments Case II: d b = 0 AB and CD are parallel z If (b c) = 0, the line segments are co- linear (why?) have to test for overlap z If (b c) 0, the line segments are not co- linear they do not intersect l Examples
8
8 Application – Circle through 3 Points l Given 3 non-collinear points A, B, and C, find the circle passing through the 3 points excircle of triangle defined by the points l The center S is the intersection of the perpendicular bisectors of AB, BC, and CA A B C A B C ? S
9
9 Circle through 3 Points l Let a = B - A, b = C - B, c = A – C l Midpoint of A = A + a/2 (why?) Direction perpendicular to AB = a Parametric form of perpendicular bisector of AB = A + a/2 + a t (why?) l Parametric form of perpendicular bisector of CA = C + c/2 + c u
10
10 Circle through 3 Points l The intersection of AB and CA is S A + a/2 + a t = C + c/2 + c u As a + b + c = 0 (why?) a t = b/2 + c u (how?) t = 0.5(b c)/(a c) (how?) center radius = |S - A| =
11
11 Intersection of Line and Plane l Line in parametric form z R(t) = A + ct where A is a known point on the line c is the direction vector of the line R is a point on the line zIf t is allowed to vary from 0 to infinity, R(t) is a ray
12
12 Intersection of Line and Plane l Plane in point normal form z n (P -B) = 0 where n is a normal vector to the plane B is a known point on the plane P is any other point on the plane zIf P is not on the plane, n (P -B) 0
13
13 Intersection of Line and Plane l If a ray R(t) intersect the plane, then n (R(t) -B) = 0 (we want to find t) n (A + ct -B) = 0 n (A -B) + n ct = 0 t (n c) = n (B -A) P P
14
14 Intersection of Line and Plane Case I: n c 0 t = n (B -A)/(n c) “Hit point” P = A + ct Case II: n c = 0 ray and plane are parallel z If n (B -A) = 0, the ray lies on the plane zOtherwise, there is no intersection
15
15 Direction Ray Hits the Plane If n c > 0 < 90 o z Ray is aimed along with the normal If n c = 0 = 90 o z Ray is parallel to the normal If n c 90 o z Ray is aimed counter to the normal n c A n c A along withcounter to
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.