Open GL Lab 10 1 BSCS – 514 Computer Graphics Instructor Humera Tariq.

Slides:



Advertisements
Similar presentations
Computer Graphics - Transformation -
Advertisements

Figures based on regular polygons (lab3)
1Computer Graphics Homogeneous Coordinates & Transformations Lecture 11/12 John Shearer Culture Lab – space 2
Lecture 7 2D Transformation. What is a transformation? Exactly what it says - an operation that transforms or changes a shape (line, shape, drawing etc.)
Computer Graphics 2D & 3D Transformation.
COMP 175 | COMPUTER GRAPHICS Remco Chang1/6103b – Shapes Lecture 03b: Shapes COMP 175: Computer Graphics February 3, 2015.
COMPUTER GRAPHICS 2D TRANSFORMATIONS.
Hierarchical Transformation. Summary Alternatively, OpenGL thinks: A transformation updates the coordinate system. For each change, the transformation.
3D Game Programming Geometric Transformations
Using GLU/GLUT Objects GLU/GLUT provides very simple object primitives glutWireCube glutWireCone gluCylinder glutWireTeapot.
CLASS 4 CS770/870. Translation Scale Multiplying Matrices. The R C rule What happens when we do two translates? What happens when we do two scales?
University of North Carolina at Greensboro
From Gears to The Machine in 13 Steps Carolyn Smith COSC /6/2009.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Transformations III Week.
Hwk1- A Tutorial of OPENGL ver2.0. We will introduce… Draw a window by OpenGL Draw one/many polygons by OpenGL Rotate/Translate Matrix Push/PopMatrix.
6/15/2015©Zachary Wartell 1 OpenGL Transforms with Object-Oriented Framework Revision 1.1 Copyright Zachary Wartell, University of North Carolina at Charlotte,
#4: OpenGL Implementation & Project 2 CSE167: Computer Graphics TAs: Alex Kozlowski & Cameron Chrisman UCSD, Winter 2006.
Objectives Learn to build arbitrary transformation matrices from simple transformations Learn to build arbitrary transformation matrices from simple transformations.
Hierarchical ModelingHofstra University1 Modeling Define volumetric objects in terms of surfaces patches that surround the volume Each surface patch is.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Transformations III Week.
Hierarchical ModelingHofstra University1 Hierarchical Modeling: Tree of Transformations, Display Lists and Functions, Matrix and Attribute Stacks,
2IV60 Computer Graphics 2D transformations
3D Rendering with JOGL Introduction to Java OpenGL Graphic Library By Ricardo Veguilla
3D Transformation. In 3D, we have x, y, and z. We will continue use column vectors:. Homogenous systems:. 3D Transformation glVertex3f(x, y,z);
CAP4730: Computational Structures in Computer Graphics Introduction to OpenGL.
Transformations of Objects CVG lab. Introduction  Affine transformations : Affine transformations are a fundamental cornerstone of computer graphics.
POLAR COORDINATES (Ch )
COS 397 Computer Graphics Assoc. Prof. Svetla Boytcheva AUBG 2013 COS 397 Computer Graphics Practical Session №1 Introduction to OpenGL, GLFW and CG.
Geometric Transformation. So far…. We have been discussing the basic elements of geometric programming. We have discussed points, vectors and their operations.
Graphics Graphics Korea University kucg.korea.ac.kr Transformations 고려대학교 컴퓨터 그래픽스 연구실.
2D Transformations.
Dx = 2 dy = 3 Y X D Translation A translation is applied to an object by repositioning it along a straight-line path.
Transforms Hierarchical Modeling Scene Graphs Using hierarchical modeling techniques in 3D software design Transforms Local basis Matrix math review Matrices.
Computer Graphics CS 385 January 31, Fractals Some definitions Object which is self-similar at all scales. Regardless of scale the same level of.
Introduction to OpenGL 1. 2 OpenGL A Graphics rendering API introduced in 1992 by Silicon Graphics Inc Provide the low-level functions to access graphics.
Hierarchical Modeling CS418 Computer Graphics John C. Hart.
Modeling with OpenGL Practice with OpenGL transformations.
Jul 25, 2014IAT 3551 Scene Graphs.  A data structure that stores information about a graphics scene –Each node has information that structures the interpretation.
Transformations Tutorial
3D Transformations. Translation x’ = x + tx y’ = y + ty z’ = z + tz P = P’ = T = P’ = T. P tx ty tz xyz1xyz1 x’ y’ z’ 1 x y.
1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 OpenGL Transformations.
Transformations Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
OpenGL: The Open Graphics Language Introduction By Ricardo Veguilla.
Introduction to OpenGL & HW1 Announcement 劉軒銘, 網媒所 碩二 ICG 2012 Fall.
COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS D Geometric Transformations Graphics Systems.
CS552: Computer Graphics Lecture 6: Viewing in 2D.
Learning Objectives Affine transformations Affine transformations Translation Translation Rotation Rotation Scaling Scaling Reflection Reflection Shear.
Transformation. 3D Transformation oIn the modeling lecture we saw how to define an object in terms of its vertices in object space oWe will now see how.
1 Geometric Transformations-II Modelling Transforms By Dr.Ureerat Suksawatchon.
Jinxiang Chai CSCE441: Computer Graphics 3D Transformations 0.
1 Perception, Illusion and VR HNRS 299, Spring 2008 Lecture 17 Animations, Loops.
CS380 LAB II OpenGL Donghyuk Kim Reference1. [OpenGL course slides by Rasmus Stenholt] Reference2. [
CSCE 441 Computer Graphics: 2D Transformations
Modeling Transformations Mario Costa Sousa University of Calgary CPSC 453, Fall 2001 Mario Costa Sousa University of Calgary CPSC 453, Fall 2001.
The Modelview Stack Lecture 9 Wed, Sep 12, The Modelview Stack OpenGL maintains a stack of matrices. The matrix on top of the stack is the current.
Dilations A dilation is a transformation that produces an image that is the same shape as the original, but is a different size. A dilation stretches or.
Transformations Introduction to Computer Graphics and Animation
IAT 355 Scene Graphs Feb 23, 2017 IAT 355.
Summary of Properties of 3D Affine Transformations
Reference1. [OpenGL course slides by Rasmus Stenholt]
Geometric Transformations
Unit-5 Geometric Objects and Transformations-II
Chapter 4/5 glMatrixMode Modeling Transformations glTranslate glScale
Geometric Transformations
The Modelview Matrix Lecture 8 Mon, Sep 10, 2007.
Transformations in OpenGL
Geometric Transformations
Transformations III Week 3, Mon Jan 21
Transformations IV Week 3, Wed Jan 23
Geometric Transformations
Presentation transcript:

Open GL Lab 10 1 BSCS – 514 Computer Graphics Instructor Humera Tariq

1.Modeling & Animating Gear Wheel 2.Drawing Symmetric Object 3.Making Patterns 4.Square & Hexagonal Tiling 5.Next More on Transformations 2 BSCS – 514 Computer Graphics Instructor Humera Tariq Lab Objectives /Tasks

3 void tooth0() { glBegin( GL_LINE_STRIP); glVertex2f(0.0, 0.0); glVertex2f(0.2, 0.2); glVertex2f(0.6, 0.2); glVertex2f(0.6, 0.8); glVertex2f(0.2, 0.8); glVertex2f(0.0, 1.0); glEnd(); } 1. Modeling a gearwheel  Drawing the axes, title and circle are easy  There are 30 teeth. Each is transformed from a basic tooth

4 2 r sin6 o 6o6o  To transform the basic tooth to the right tooth on the x axis  In both x and y dimensions, scale down by 2 r sin 6 o  Translate the scaled tooth by Tx = r cos 6 o,Ty = -r sin 6 o void tooth1( double r) { double rad = 6.0 * / 180.0, sin6 = r * sin( rad), cos6 = r * cos( rad); glPushMatrix(); glTranslatef( cos6, -sin6, 0.0); glScalef( 2.0*sin6, 2.0*sin6, 1.0); tooth0(); glPopMatrix(); } (r cos6 o, -r sin6 o )

5  To draw the entire set of teeth of radius r and centered at the origin void gear( double r) { glPushMatrix(); for (int i=1; i<=30; ++i) { tooth1( r); glRotatef( 12.0, 0.0, 0.0, 1.0); } glPopMatrix(); } r

6 //Standard Setup for animation float speed = ; static int oldTime = clock(), newTime; newTime = clock(); deg += (newTime - oldTime) * speed; //printf("%d\n",newTime - oldTime); oldTime = newTime; glutPostRedisplay();  Animation An object will appear moving if we keep redrawing it with minute changes. void move() { }

It is easy to produce a complex snowflake by designing one half of a spoke, and drawing it 12 times. 7 BSCS – 514 Computer Graphics Instructor Humera Tariq 2. Drawing Symmetric Object

8 BSCS – 514 Computer Graphics Instructor Humera Tariq Snowflake example continued…. (a) # include “turtle.h” (b) gluOrtho2D(-10,10,-10,10) (c) L = 1 ; Implement void flakeMotif(float L) (d) Complete one spoke(reflection w.r.t x-axis) Draw entire snowflake ??????????????????????

9 BSCS – 514 Computer Graphics Instructor Humera Tariq 3. Making Patterns from dino motif

10 BSCS – 514 Computer Graphics Instructor Humera Tariq 4. Tiling and its Applications Simple Square Tiling

11 BSCS – 514 Computer Graphics Instructor Humera Tariq a) b) W H D L Tiling example from book

12 BSCS – 514 Computer Graphics Instructor Humera Tariq Tiling Code for fig.5.46 cvs.pushCT(); // so we can return here cvs.translate2D(W, H); // position for the first motif for(row = 0; row < 3; row++){ // draw each row pushCT(); for(col = 0 ; col < 3; col++){ motif(); cvs.translate2D(L, 0);} //move to the right cvs.popCT(); // back to the start of this row cvs.translate2D(0, D); } //move up to the next row cvs.popCT(); //back to where we started

13 BSCS – 514 Computer Graphics Instructor Humera Tariq Tiling Important exercise

14 BSCS – 514 Computer Graphics Instructor Humera Tariq