Presentation is loading. Please wait.

Presentation is loading. Please wait.

2003CS Hons RW778 Graphics1 Chapter 4: Vector Tools 4.5 Representation of Key Geometric Objects 4.5 Representation of Key Geometric Objects –4.5.1 Coordinate.

Similar presentations


Presentation on theme: "2003CS Hons RW778 Graphics1 Chapter 4: Vector Tools 4.5 Representation of Key Geometric Objects 4.5 Representation of Key Geometric Objects –4.5.1 Coordinate."— Presentation transcript:

1 2003CS Hons RW778 Graphics1 Chapter 4: Vector Tools 4.5 Representation of Key Geometric Objects 4.5 Representation of Key Geometric Objects –4.5.1 Coordinate Systems and Coordinate Frames »Points: location, no size, no direction »Vectors: size, direction, no location »A coordinate system is located in a world. »Coordinate frame: specific origin, and 3 unit vectors a,b,c.

2 2003CS Hons RW778 Graphics2 Chapter 4: Vector Tools »v = v 1 a + v 2 b + v 3 c »P = + p 1 a + p 2 b + p 3 c –Homogeneous Representation of Point, Vector »v = (a,b,c, ) »P = (a,b,c, ) »Note: OpenGL uses 4D homogeneous coordinates by default.

3 2003CS Hons RW778 Graphics3 Chapter 4: Vector Tools –Linear combination of vectors: Valid. –Linear combination of points: Only affine valid. –4.5.2 Affine combinations of points, examples and practice exercises: Selfstudy. –4.5.3 Linear Interpolation of Two Points »P = A(1-t) + Bt –4.5.4 Tweening for art and animation »P i = A i (1-t) + B i t »Extrapolation, key frames –4.5.5 Quadratic and cubic tweening, Bezier curves »Selfstudy.

4 2003CS Hons RW778 Graphics4 Chapter 4: Vector Tools 4.5.6 Representing Lines and Planes 4.5.6 Representing Lines and Planes –Line, line segment, ray –Parametric representation of line: L(t) = C + bt –Point normal form for line (implicit) »Given line L through C and B, what is point normal form? »(B-C) . (R-C) = 0 where R any point on line. –Moving from one representation to another: Selfstudy.

5 2003CS Hons RW778 Graphics5 Chapter 4: Vector Tools Planes in 3D Space Planes in 3D Space –Parametric Representation of a Plane »P(s,t) = C + as + bt or »P(s,t) = sA + tB + (1-s-t)C –Point normal form for Plane : Selfstudy up to p. 180.

6 2003CS Hons RW778 Graphics6 Chapter 4: Vector Tools Planar Patches Planar Patches

7 2003CS Hons RW778 Graphics7 Chapter 4: Vector Tools 4.6 Finding the Intersection of 2 Line Segments 4.6 Finding the Intersection of 2 Line Segments –Parametric representations: A + bt = C + du, or bt = c + du, or d . bt = d . c

8 2003CS Hons RW778 Graphics8 Chapter 4: Vector Tools –Case 1: d . b not zero »t = (d . c)/(d . b) »u = (b . c)/(d . b) CHECK ERRATA this wrong »Intersection point I = A + ((d . c)/(d . b))b if 0 < t,u < 1 –Case 2: d . b zero : Lines are parallel 4.6.1 Application of Line Intersections: Circle through 3 points : Selfstudy. 4.6.1 Application of Line Intersections: Circle through 3 points : Selfstudy.

9 2003CS Hons RW778 Graphics9 Chapter 4: Vector Tools 4.7 Intersections of Lines with Planes; Clipping 4.7 Intersections of Lines with Planes; Clipping –Line parametric representation; plane point normal form. –t hit = (n. (B-A))/(n. c) –Hit point P hit = A + ct hit

10 2003CS Hons RW778 Graphics10 Chapter 4: Vector Tools –If n. c > 0 : ray aimed along with normal –If n. c < 0 : ray aimed counter to normal –If n. c = 0 : ray parallel to line 4.8 Polygon Intersection Problems 4.8 Polygon Intersection Problems

11 2003CS Hons RW778 Graphics11 Chapter 4: Vector Tools –Is given point P inside or outside the object? –Where does a given ray R first intersect the object? –Which part of given line L lies inside object, and which part outside? 4.8.1 Convex Polygons and Polyhedra 4.8.1 Convex Polygons and Polyhedra –Convex polygon described by bounding lines –Convex polyhedron described by bounding planes

12 2003CS Hons RW778 Graphics12 Chapter 4: Vector Tools –Inside halfspace contains all points of polygon; outside halfspace shares no points with polygon. 4.8.2 Ray Intersection, Clipping for Convex Polygons 4.8.2 Ray Intersection, Clipping for Convex Polygons –The Intersection problem: Use ray/line intersection solution, and calculate »Entering hit point A+ ct in and »Exiting hit point A + ct out »Ray inside polygon for [t in,t out ]

13 2003CS Hons RW778 Graphics13 Chapter 4: Vector Tools –The Clipping problem: »A’ = A + c max(0,t in ) »C’ = A + c min(t out,1) »To find t in, t out, consider each bounding line of P and calculate intersection with A+ct. Note: Bounding lines stored in point normal form Note: Bounding lines stored in point normal form Note: n is outward-pointing normal. Note: n is outward-pointing normal. 1.Init candidate interval to [0,1] 2.For each bounding line, find hit time and establish whether entering or exiting ray using n. c. » If entering, set t in = max (t in, t hit ). » If exiting, set t out = min(t out,t hit ). 3.Segment from A+ct in to A+ct out lies inside P.

14 2003CS Hons RW778 Graphics14 Chapter 4: Vector Tools Example p. 192: Selfstudy. Example p. 192: Selfstudy. Cyrus-Beck clipping: Selfstudy. Cyrus-Beck clipping: Selfstudy. 4.8.4 Clipping against arbitrary polygons 4.8.4 Clipping against arbitrary polygons –As before, but lists of segments. 4.8.5 Advanced clipping 4.8.5 Advanced clipping –Sutherland-Hodgman »Similar to Cyrus-Beck, but clips entire polygon (not just line segment) against convex polygon. Output polygon. –Weiler-Atherton »Clips any polygon against any other polygon

15 2003CS Hons RW778 Graphics15 Chapter 4: Vector tools Programming Task 3 : Implement Case Study 4.1 (Animation with tweening), p. 198, in Hill. Programming Task 3 : Implement Case Study 4.1 (Animation with tweening), p. 198, in Hill.


Download ppt "2003CS Hons RW778 Graphics1 Chapter 4: Vector Tools 4.5 Representation of Key Geometric Objects 4.5 Representation of Key Geometric Objects –4.5.1 Coordinate."

Similar presentations


Ads by Google