200 likes | 324 Views
CSL 859: Advanced Computer Graphics. Dept of Computer Sc. & Engg. IIT Delhi. User Interfaces. Keyboard Mouse Widgets or Menus? Gesture based Optical/Magnetic tracking Visual language?. Virtual Trackball. Map mouse motion to rotation of a volume Imagine mouse dragged on ground plane
E N D
CSL 859: Advanced Computer Graphics Dept of Computer Sc. & Engg. IIT Delhi
User Interfaces • Keyboard • Mouse • Widgets or Menus? • Gesture based • Optical/Magnetic tracking • Visual language?
Virtual Trackball • Map mouse motion to rotation of a volume • Imagine mouse dragged on ground plane • from (x1, z1) to (x2, z2) • Imagine the points raised onto unit hemisphere • from (x1, y1, z1) to (x2, y2, z2)
Trackball • p1: x12+y12+z12 = 1 • p2: x22+y22+z22 = 1 • Ball rotates about the axis formed by p1 and p2 • p1 X p2 • Rotation angle proportional to the distance p1p2 • Or simply ||p1 X p2|| • What happens if the object is not at the origin?
Graphics Pipeline • Transform vertices • Light vertices • Clip to Window extremes • Setup edges • Rasterize • Fill and interpolate colors, depth • Test against Z-buffer • One entry per pixel: closest so far • Update Color and Z buffers
Why Transformation? • Modeling? • Projection? • Viewport?
Transform Vertices? T(p) = aT(p1) + bT(p2) + cT(p3)) p0 p = a p0 + b p1 + cp2 p1 p2
Matrix Transformations • Composition • (A (B (C x))) = (A B C) x • Fixed frame of reference • Rotation • Scaling • Translation • Shear • Projection
Composition: Fixed frame • T(1,0) • R(90) • R T p
Composition: Local frame • T(1,0) • R(90) • R T p
cos θ -sin θ sin θ cos θ Rotation r r θ r cos β r cos α
1 0 0 tx 0 1 0 ty 0 0 1 tz 0 0 0 1 x y z w Translation
1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0 x y z 1 Perspective Transformation x,y,z,w x,y,z,z 1
Transform = Change Basis • New Axis: x’, y’, z’ • New Origin: o • +Scale xT 0 yT 0 zT 0 13T 0 T-o
Linear and Affine transform • Linear: x’ = Ax • Scale, Rotation • T(ax + by) = aT(x) + bT(y) • Affine: Translate • x’ = Ax + b • Transforms a line to a line • Respects parallelism • Does not respect angles and lengths
Projective Transformation • n-dimensional projective space is an n+1-dimensional vector space • 0,0,0,… is not a part of this space • x = kx • xn+1 == 0 => Point at infinity {= Direction} • Actually any coordinate may be chosen • Affine space is a projection of Projective space • Typically on the plane xn+1 = 1 • Projective transformation • xj = ∑aixi • Ax, A is a 4x4 matrix (15 DOF!)
Normal Transformation n.p = 0 nTp = 0 => n’T Mp must be 0 => (M’n)T Mp = 0 => nTM’T Mp = 0 => M’T M = kI => M’T = M-1 (k = 1) => M’ = k(M-1)T