Representing Transformations, The TRANSF Package Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Wednesday,

Slides:



Advertisements
Similar presentations
Today Composing transformations 3D Transformations
Advertisements

John C. Hart CS 318 Interactive Computer Graphics
3D Graphics Rendering and Terrain Modeling
CS B659: Principles of Intelligent Robot Motion Rigid Transformations.
CAP4730: Computational Structures in Computer Graphics Visible Surface Determination.
Computer Graphics Visible Surface Determination. Goal of Visible Surface Determination To draw only the surfaces (triangles) that are visible, given a.
Kinematics Pose (position and orientation) of a Rigid Body
Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova.
3D Kinematics Eric Whitman 1/24/2010. Rigid Body State: 2D p.
The Concepts of Orientation/Rotation ‘Transformations’ ME Lecture Series 2 Fall 2011, Dr. R. Lindeke 1.
1 Geometrical Transformation 2 Outline General Transform 3D Objects Quaternion & 3D Track Ball.
Computer Graphics Recitation 2. 2 The plan today Learn about rotations in 2D and 3D. Representing rotations by quaternions.
Ch. 2: Rigid Body Motions and Homogeneous Transforms
Advanced Computer Graphics (Fall 2010) CS 283, Lecture 20: Inverse Kinematics Ravi Ramamoorthi Most slides courtesy.
MSU CSE 803 Fall 2008 Stockman1 CV: 3D sensing and calibration Coordinate system changes; perspective transformation; Stereo and structured light.
Orientations Goal: –Convenient representation of orientation of objects & characters in a scene Applications to: – inverse kinematics –rigid body simulation.
CAP4730: Computational Structures in Computer Graphics
Computer Animation Rick Parent Computer Animation Algorithms and Techniques Technical Background.
Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)
CS I400/B659: Intelligent Robotics Rigid Transformations.
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology Beyond Meshes Spring 2012.
10/5/04© University of Wisconsin, CS559 Fall 2004 Last Time Compositing Painterly Rendering Intro to 3D Graphics Homework 3 due Oct 12 in class.
CS 450: COMPUTER GRAPHICS 3D TRANSFORMATIONS SPRING 2015 DR. MICHAEL J. REALE.
1 Kinematics ( 運動學 ) Primer Jyun-Ming Chen Fall 2009.
Course Overview, Introduction to CG Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, September 5, 2003.
Rotations and Translations
Transformations Aaron Bloomfield CS 445: Introduction to Graphics
3D Kinematics Consists of two parts 3D rotation 3D translation  The same as 2D 3D rotation is more complicated than 2D rotation (restricted to z- axis)
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
CS 480/680 Computer Graphics Transformations Dr. Frederick C Harris, Jr.
Computer Graphics Bing-Yu Chen National Taiwan University.
Computer Graphics World, View and Projection Matrices CO2409 Computer Graphics Week 8.
Rotations and Translations
Week 5 - Wednesday.  What did we talk about last time?  Project 2  Normal transforms  Euler angles  Quaternions.
CSC 461: Lecture 3 1 CSC461 Lecture 3: Models and Architectures  Objectives –Learn the basic design of a graphics system –Introduce pipeline architecture.
1 CS 430/536 Computer Graphics I 3D Transformations World Window to Viewport Transformation Week 2, Lecture 4 David Breen, William Regli and Maxim Peysakhov.
Homogeneous Form, Introduction to 3-D Graphics Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, October 20,
Shadows via Projection Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Wednesday, November 5, 2003.
1Computer Graphics Lecture 4 - Models and Architectures John Shearer Culture Lab – space 2
10/3/02 (c) 2002 University of Wisconsin, CS 559 Last Time 2D Coordinate systems and transformations.
EEE. Dept of HONG KONG University of Science and Technology Introduction to Robotics Page 1 Lecture 2. Rigid Body Motion Main Concepts: Configuration Space.
Animating Rotations and Using Quaternions. What We’ll Talk About Animating Translation Animating 2D Rotation Euler Angle representation 3D Angle problems.
3/23/04© University of Wisconsin, CS559 Spring 2004 Last Time Antialiasing –Area-weighted sampling Visibility –Painters algorithm –Depth buffer (Z-buffer)
CS 551/645 Fall 2000 Parameterized Rotations, Curves, and Surfaces.
More TRANSF, VR Programming Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Monday, February 16, 2004.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Chapter 2: Description of position and orientation Faculty of Engineering - Mechanical Engineering Department ROBOTICS Outline: Introduction. Descriptions:
2/19/04© University of Wisconsin, CS559 Spring 2004 Last Time Painterly rendering 2D Transformations –Transformations as coordinate system changes –Transformations.
Comparing Two Motions Jehee Lee Seoul National University.
1 Perception and VR MONT 104S, Fall 2008 Lecture 20 Computer Graphics and VR.
Computer Graphics Matrices
This Week WeekTopic Week 1 Coordinate Systems, Basic Functions Week 2 Trigonometry and Vectors (Part 1) Week 3 Vectors (Part 2) Week 4 Vectors (Part 3:
CS 445 / 645: Introductory Computer Graphics Review.
Euler Angles This means, that we can represent an orientation with 3 numbers Assuming we limit ourselves to 3 rotations without successive rotations about.
Computer Graphics I, Fall 2010 Transformations.
Week 5 - Monday.  What did we talk about last time?  Lines and planes  Trigonometry  Transforms  Affine transforms  Rotation  Scaling  Shearing.
Chapter 1 Graphics Systems and Models Models and Architectures.
End effector End effector - the last coordinate system of figure Located in joint N. But usually, we want to specify it in base coordinates. 1.
REFERENCE: QUATERNIONS/ Ogre Transformations.
Introduction to 3-D Viewing Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, October 27, 2003.
Computer Animation Algorithms and Techniques
CPSC 641: Computer Graphics Rotation Representation and Interpolation
Stenciling Effects Glenn G. Chappell
CS 445 / 645 Introduction to Computer Graphics
COMPUTER GRAPHICS CHAPTERS CS 482 – Fall 2017 TRANSFORMATIONS
3D Graphics Rendering PPT By Ricardo Veguilla.
3D Rendering Pipeline Hidden Surface Removal 3D Primitives
Projection in 3-D Glenn G. Chappell
VIRTUAL ENVIRONMENT.
UNIVERSITY OF ILLINOIS AT URBANA-CHAMPAIGN
Presentation transcript:

Representing Transformations, The TRANSF Package Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Wednesday, February 11, 2004

11 Feb 2004CS 481/6812 Review: Stenciling Effects Stenciling means restricting drawing to a region related to some previous drawing. It is much more versatile than it sounds. In OpenGL, we implement stenciling-based effects using the stencil buffer and the stencil test. Last time, we discussed how to use stenciling to do: “Ordinary” Stenciling Restrict drawing to a specified area of the screen. E.g., a window (in any sense of the word). Or restrict a (projection-based) shadow to the object it falls on. The Reverse Painter’s Algorithm Draw front-to-back (somehow … use a BSP tree?). Restrict drawing to pixels whose colors have not been set yet. Capping Hide interiors of closed surfaces that are cut by a clipping plane. Draw a large rectangle in the “capping color”, restricting drawing to pixels whose colors have been set an odd number of times.

11 Feb 2004CS 481/6813 Review: Shadow Volumes A final (and much more complex) stenciling-based technique is shadowing via “shadow volumes”. The shadow volume of a polygon is the 3-D region that it hides from the light. For this technique, we assume that the shadow volumes of our polygons do not overlap (although they may touch). Consider the boundaries of shadow volumes. A point is in shadow precisely when we look through an odd number of these boundaries to see it. Assuming the viewer is not in shadow. If the viewer is in shadow, change “odd” to “even”. Zero is even (and not odd)! See shadowvol.cpp for sample code.

11 Feb 2004CS 481/6814 Representing Transformations: Rotations: Pro’s & Con’s 44 Matrices Very general. Good for a pipeline! Too general? Tough to retrieve info about “the rotation” when you cannot even be sure it is a rotation. 16 numbers. Angle-Axis Nice way to specify rotations. A bit nasty for computation involving rotations (composition, etc.) Euler Angles (roll, pitch, yaw) Ick! Ick, ick, ick, ick! One & only exception: billboarding (maybe). Quaternions (coming up) Great for computation. Compact. Easy to convert to other forms. Best (IMHO) all-around representation, if you only need to represent rotations.

11 Feb 2004CS 481/6815 Representing Transformations: Quaternions [1/2] The quaternions are a generalization of complex numbers. Three square roots of –1: i, j, k. Quaternions are of the form a + bi + cj + dk, for a, b, c, d real numbers. Addition, subtraction are as usual (component-wise). For multiplication: i 2 = j 2 = k 2 = –1. ij = k; jk = i; ki = j. ji = –k; kj = –i; ik = –j. Multiplication is not commutative! But it is associative: (xy)z = x(yz). Use the distributive rule plus the above facts to do multiplication.

11 Feb 2004CS 481/6816 Representing Transformations: Quaternions [2/2] We can think of the i, j, k part of a quaternion as a 3-D vector. So a quaternion is a real number plus a vector: a + u. a is the real part. u is the vector part or pure part. Addition: (a + u) + (b + v) = (a + b) + (u + v). Subtraction: (a + u) – (b + v) = (a – b) + (u – v). Multiplication: (a + u)(b + v) = (ab – u·v) + (av + bu + uv).

11 Feb 2004CS 481/6817 Representing Transformations: Rotations As Quaternions [1/2] We represent a rotation of an angle α about an axis u (unit vector) as a quaternion as follows:

11 Feb 2004CS 481/6818 Representing Transformations: Rotations As Quaternions [2/2] With this representation, composition of rotations is just multiplication. q 1 q 2 is the quaternion representing the rotation of q 2 followed by the rotation of q 1. The conjugate of a quaternion a + u is the quaternion a – u. We denote the conjugate by placing a bar over a letter: To apply the rotation represented by q to the point p (thought of as a vector), we compute the vector part of:

11 Feb 2004CS 481/6819 Representing Transformations: General Rigid Transformations A transformation of a rigid 3-D body can be modeled as: A rotation about a line through the origin … Followed by a translation. We can represent the rotation as we have discussed. The translation can be represented as a 3-D vector. The coordinates are those of the point that the transformation takes the origin to. Putting these together, we can represent anything a rigid body can do: Any translation. Any rotation. Corkscrew motions as well. This also gives us a way to represent a “frame of reference” in 3-D space.

11 Feb 2004CS 481/68110 The TRANSF Package: Introduction Dr. Hartman and I are writing a C++ transformations package including: Vector algebra. Interpolation. Translations, rotations, and general rigid transformations. The package will be made available to the class and may be used in assignments. We call it “TRANSF” for now. Think of a better name?

11 Feb 2004CS 481/68111 The TRANSF Package: Overview [1/2] TRANSF defines 6 classes: vec : 3-D vector Or translation, if you like pos : Position in 3-D space rot : 3-D rotation orient : Orientation in 3-D space transf : 3-D rigid transformation Rotation + translation frameref : A frame of reference in 3-D space Also a low-feature quaternion class called tfquat.

11 Feb 2004CS 481/68112 The TRANSF Package: Overview [2/2] The 6 classes can be classified as follows: TRANSF has two source files: vecpos.h Defines and implements classes vec & pos. transf.h Defines and implements classes rot, orient, transf, frameref. Also #include ’s vecpos.h. All classes and global functions are placed in namespace tf. There is also a file tfogl.h. This is an experimental OpenGL interface. So you can do things like glVertex(p); where p is of type tf::pos. This file should be #include ’d after glut.h. RelativeAbsolute vecpos rotorient transfframeref

11 Feb 2004CS 481/68113 The TRANSF Package: Sample Code [1/2] #include using namespace tf; vec v1; v1[0] = 1.; v1[1] = 2.; v1[2] = 3.; vec v2(2.,0.,-5.); vec v3 = 3.*v1-2.*v2; vec v4 = cross(v1, v2); double d1 = dot(v1, v2); double d2 = v1.length();

11 Feb 2004CS 481/68114 The TRANSF Package: Sample Code [2/2] #include using namespace tf; pos p1; rot r1; rot r2(30., vec(1., 2., 3.)); // Angle-axis. Angle is in degrees. rot r3 = r1.inverse().compose(r2); pos p2 = r3.applyto(p1); rot r4 = rotfromto(p1, p2);