The Geometric Moving AverageThe Geometric Moving Average Control
2003CS Hons RW778 Graphics1 Chapter 4: Vector Tools 4.5 Representation of Key Geometric Objects 4.5...
-
Upload
dayna-hancock -
Category
Documents
-
view
217 -
download
0
Transcript of 2003CS Hons RW778 Graphics1 Chapter 4: Vector Tools 4.5 Representation of Key Geometric Objects 4.5...
2003 CS Hons RW778 Graphics 1
Chapter 4: Vector ToolsChapter 4: Vector Tools
4.5 Representation of Key Geometric Objects4.5 Representation of Key Geometric Objects– 4.5.1 Coordinate Systems and Coordinate Frames4.5.1 Coordinate Systems and Coordinate Frames
» Points: location, no size, no directionPoints: location, no size, no direction
» Vectors: size, direction, no locationVectors: size, direction, no location
» A coordinate system is located in a worldA coordinate system is located in a world..
» Coordinate frame: specific origin Coordinate frame: specific origin , and 3 unit vectors , and 3 unit vectors a,b,ca,b,c..
2003 CS Hons RW778 Graphics 2
Chapter 4: Vector ToolsChapter 4: Vector Tools
» v v = v = v11aa + v + v22bb + v + v33cc» PP = = + p + p11aa + p + p22bb + p + p33cc
– Homogeneous Representation of Point, VectorHomogeneous Representation of Point, Vector» v v = (= (a,b,c, a,b,c, ) )
» P = (P = (a,b,c, a,b,c, ) )
» Note: OpenGL uses 4D homogeneous coordinates by default.Note: OpenGL uses 4D homogeneous coordinates by default.
0
3
2
1
v
v
v
1
3
2
1
v
v
v
2003 CS Hons RW778 Graphics 3
Chapter 4: Vector ToolsChapter 4: Vector Tools
– Linear combination of vectors: Valid.Linear combination of vectors: Valid.– Linear combination of points: Only affine valid.Linear combination of points: Only affine valid.– 4.5.2 Affine combinations of points, examples and 4.5.2 Affine combinations of points, examples and
practice exercises: Selfstudy.practice exercises: Selfstudy.– 4.5.3 Linear Interpolation of Two Points4.5.3 Linear Interpolation of Two Points
» P = A(1-t) + BtP = A(1-t) + Bt
– 4.5.4 Tweening for art and animation4.5.4 Tweening for art and animation» PPii = A = Aii(1-t) + B(1-t) + Biitt» Extrapolation, key framesExtrapolation, key frames
– 4.5.5 Quadratic and cubic tweening, Bezier curves4.5.5 Quadratic and cubic tweening, Bezier curves» Selfstudy.Selfstudy.
2003 CS Hons RW778 Graphics 4
Chapter 4: Vector ToolsChapter 4: Vector Tools
4.5.6 Representing Lines and Planes4.5.6 Representing Lines and Planes– Line, line segment, ray Line, line segment, ray
– Parametric representation of line: L(t) = C + Parametric representation of line: L(t) = C + bbtt– Point normal form for line (implicit)Point normal form for line (implicit)
» Given line L through C and B, what is point normal form?Given line L through C and B, what is point normal form?» (B-C)(B-C) . (R-C) = 0 where R any point on line.. (R-C) = 0 where R any point on line.
– Moving from one representation to another: Selfstudy.Moving from one representation to another: Selfstudy.
2003 CS Hons RW778 Graphics 5
Chapter 4: Vector ToolsChapter 4: Vector Tools
Planes in 3D SpacePlanes in 3D Space– Parametric Representation of a PlaneParametric Representation of a Plane
» P(s,t) = C + P(s,t) = C + aas + s + bbt or t or
» P(s,t) = sA + tB + (1-s-t)CP(s,t) = sA + tB + (1-s-t)C
– Point normal form for Plane : Selfstudy up to p. Point normal form for Plane : Selfstudy up to p. 180.180.
2003 CS Hons RW778 Graphics 6
Chapter 4: Vector ToolsChapter 4: Vector Tools
Planar PatchesPlanar Patches
2003 CS Hons RW778 Graphics 7
Chapter 4: Vector ToolsChapter 4: Vector Tools
4.6 Finding the Intersection of 2 Line Segments4.6 Finding the Intersection of 2 Line Segments
– Parametric representations: A + Parametric representations: A + bbt = C + t = C + ddu, oru, orbbt = t = cc + + ddu, oru, ordd . b . bt = t = d d . c . c
2003 CS Hons RW778 Graphics 8
Chapter 4: Vector ToolsChapter 4: Vector Tools
– Case 1: Case 1: dd . b . b not zeronot zero» t = (t = (dd . c)/(d . c)/(d . b) . b)
» u = (u = (bb . c)/(d . c)/(d . b) CHECK ERRATA this . b) CHECK ERRATA this wrongwrong
» Intersection point I = A + ((Intersection point I = A + ((dd . c)/(d . c)/(d . b))b . b))b if 0 < t,u < 1 if 0 < t,u < 1
– Case 2: Case 2: dd . b . b zero : Lines are parallel zero : Lines are parallel
4.6.1 Application of Line Intersections: Circle 4.6.1 Application of Line Intersections: Circle through 3 points : Selfstudy.through 3 points : Selfstudy.
2003 CS Hons RW778 Graphics 9
Chapter 4: Vector ToolsChapter 4: Vector Tools
4.7 Intersections of Lines with Planes; Clipping4.7 Intersections of Lines with Planes; Clipping– Line parametric representation; plane point normal Line parametric representation; plane point normal
form.form.
– tthithit = ( = (n . n . (B-A))/((B-A))/(n . cn . c))
– Hit point PHit point Phit hit = A + = A + cctthithit
2003 CS Hons RW778 Graphics 10
Chapter 4: Vector ToolsChapter 4: Vector Tools
– If If n . c n . c > 0 : ray aimed along with normal > 0 : ray aimed along with normal
– If If n . c n . c < 0 : ray aimed counter to normal < 0 : ray aimed counter to normal
– If If n . c n . c = 0 : ray parallel to line = 0 : ray parallel to line
4.8 Polygon Intersection Problems4.8 Polygon Intersection Problems
2003 CS Hons RW778 Graphics 11
Chapter 4: Vector ToolsChapter 4: Vector Tools
– Is given point P inside or outside the object?Is given point P inside or outside the object?
– Where does a given ray R first intersect the object?Where does a given ray R first intersect the object?
– Which part of given line L lies inside object, and which part Which part of given line L lies inside object, and which part outside?outside?
4.8.1 Convex Polygons and Polyhedra4.8.1 Convex Polygons and Polyhedra– Convex polygon described by bounding linesConvex polygon described by bounding lines
– Convex polyhedron described by bounding planesConvex polyhedron described by bounding planes
2003 CS Hons RW778 Graphics 12
Chapter 4: Vector ToolsChapter 4: Vector Tools
– Inside halfspace contains all points of polygon; outside Inside halfspace contains all points of polygon; outside halfspace shares no points with polygon.halfspace shares no points with polygon.
4.8.2 Ray Intersection, Clipping for Convex 4.8.2 Ray Intersection, Clipping for Convex PolygonsPolygons– The Intersection problem: Use ray/line intersection The Intersection problem: Use ray/line intersection
solution, and calculatesolution, and calculate» Entering hit point A+ Entering hit point A+ ccttinin and and
» Exiting hit point A + Exiting hit point A + ccttoutout
» Ray inside polygon for [tRay inside polygon for [tinin,t,toutout]]
2003 CS Hons RW778 Graphics 13
Chapter 4: Vector ToolsChapter 4: Vector Tools
– The Clipping problem:The Clipping problem:» A’ = A + A’ = A + cc max(0,t max(0,tinin))» C’ = A + C’ = A + cc min(t min(toutout,1),1)» To find tTo find tinin, t, toutout, consider each bounding line of P and , consider each bounding line of P and
calculate intersection with A+calculate intersection with A+cct.t. Note: Bounding lines stored in point normal formNote: Bounding lines stored in point normal form Note: Note: nn is outward-pointing normal. is outward-pointing normal.
1.1. Init candidate interval to [0,1]Init candidate interval to [0,1]2.2. For each bounding line, find hit time and establish whether For each bounding line, find hit time and establish whether
entering or exiting ray using entering or exiting ray using n . cn . c..» If entering, set tIf entering, set tinin = max (t = max (tinin, t, thithit).).» If exiting, set tIf exiting, set toutout = min(t = min(toutout,t,thithit).).
3.3. Segment from A+Segment from A+ccttinin to A+ to A+ccttoutout lies inside P. lies inside P.
2003 CS Hons RW778 Graphics 14
Chapter 4: Vector ToolsChapter 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 polygons4.8.4 Clipping against arbitrary polygons
– As before, but lists of segments.As before, but lists of segments.
4.8.5 Advanced clipping4.8.5 Advanced clipping– Sutherland-HodgmanSutherland-Hodgman
» Similar to Cyrus-Beck, but clips entire polygon (not just line Similar to Cyrus-Beck, but clips entire polygon (not just line segment) against convex polygon. Output polygon.segment) against convex polygon. Output polygon.
– Weiler-AthertonWeiler-Atherton» Clips any polygon against any other polygonClips any polygon against any other polygon
2003 CS Hons RW778 Graphics 15
Chapter 4: Vector toolsChapter 4: Vector tools
Programming Task 3Programming Task 3 : Implement Case : Implement Case Study 4.1 (Animation with tweening), Study 4.1 (Animation with tweening), p. 198, in Hill.p. 198, in Hill.