drawing curved surfaces

Slides:



Advertisements
Similar presentations
1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Programming with OpenGL Part 3: Three Dimensions.
Advertisements

CS 4731: Computer Graphics Lecture 18: Hidden Surface Removal Emmanuel Agu.
3D coordinate systems X Y Z Right-Hand Coordinate System X Y Z Left-Hand Coordinate System OpenGL uses this! Direct3D uses this!
Open GL Programming Speaker: 彭任右 Date: 2005/10/3.
Homogeneous Form, Introduction to 3-D Graphics Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, October 20,
State Management and Drawing Geometry Objects
1. OpenGL/GLU/GLUT  OpenGL v4.0 (latest) is the “core” library that is platform independent  GLUT v3.7 is an auxiliary library that handles window creation,
CSE Real Time Rendering Week 2. Graphics Processing 2.
Computer Graphics Through OpenGL: From Theory to Experiments, Second Edition Chapter 2.
Modeling with OpenGL Practice with OpenGL transformations.
Computer Graphics I, Fall 2010 Programming with OpenGL Part 3: Three Dimensions.
On to OpenGL Introduction to Computer Graphics and Animation (Principle of Computer Graphics) Rattapoom Waranusast.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Programming with OpenGL Part 3: Three Dimensions Ed Angel Professor of Computer Science,
CS559: Computer Graphics Lecture 12: OpenGL - Transformation Li Zhang Spring 2008.
31/1/2006Based on: Angel (4th Edition) & Akeine-Möller & Haines (2nd Edition)1 CSC345: Advanced Graphics & Virtual Environments Lecture 2: Introduction.
CS559: Computer Graphics Lecture 12: OpenGL: ModelView Li Zhang Spring 2010.
On to 3D Introduction to Computer Graphics and Animation (Principle of Computer Graphics) Rattapoom Waranusast.
Viewing and Projection. The topics Interior parameters Projection type Field of view Clipping Frustum… Exterior parameters Camera position Camera orientation.
2002 by Jim X. Chen: Drawing Geometric Models.1. Objectives –OpenGL drawing primitives and attributes –OpenGL polygon face.
CIS 681 Review: OpenGL. CIS 681 Command Syntax OpenGL commands start with a gl. This is followed by the base command such as Color. Followed by the number.
Chapter 1 Graphics Systems and Models Models and Architectures.
1 Perception, Illusion and VR HNRS 299, Spring 2008 Lecture 17 Animations, Loops.
Section 8-5 Solving More Difficult Trigonometric Functions.
Parametric Equations Until now, we’ve been using x and y as variables. With parametric equations, they now become FUNCTIONS of a variable t.
CHAPTER 1 COMPLEX NUMBERS
Review of radian measure.
Equations of Circles.
Computer Graphics - Chapter 5 Viewing
Section 4.2 The Unit Circle.
CHAPTER 1 COMPLEX NUMBERS
Find the exact values:.
Equations of Circles.
Additional Topics in math Lessons 5-7
Graphs of Sine and Cosine Functions
Programming with OpenGL Part 3: Three Dimensions
Ferris Wheel.
Models and Architectures
Lab 3 Geometric Drawing Lab 3 Geometric Drawing.
Objectives OpenGL drawing primitives and attributes
Starting to draw dealing with Windows which libraries? clipping
Solving Trig Functions
Chapter 3 arrays of vertices vertex arrays display lists drawing text
LESSON ____ SECTION 4.2 The Unit Circle.
Graphing Trigonometric Functions
Equations of Circles.
Programming with OpenGL Part 3: Three Dimensions
5-3 Tangent of Sums & Differences
Introduction to OpenGL
Find sec 5π/4.
THE UNIT CIRCLE.
Warm Up Write answers in reduced pi form.
4.1 Equations of circles Arcs, Inscribed Angles, Central Angles
Lets start with a point. P(x,y) r
Starting to draw dealing with Windows which libraries? clipping
21. Sum and Difference Identities
Programming with OpenGL Part 3: Three Dimensions
class 5 retrieving a previous statement in Thonny or IDLE // %
3.3 – The Unit Circle and Circular Functions
15. Sum and Difference Identities
How About Some PI? Trigonometry Feb 18,2009.
13.1: Intro to Polar Equations
15. Sum and Difference Identities
Trig Functions of Any Angle
Objective: To write an equation of a circle.
Making an Ice Cream Cone
3.4 Circular Functions.
Angel: Interactive Computer Graphics5E © Addison-Wesley 2009
Programming with OpenGL Part 3: Three Dimensions
Angel: Interactive Computer Graphics5E © Addison-Wesley 2009
Aim: How do we solve trig equations using
Presentation transcript:

drawing curved surfaces Class 3:Chaps 2 cont. trig review drawing curves depth buffer perspective drawing curved surfaces

Trig Review: Definition of sine and cosine (Unit circle, radius=1) (cos sin ) (cos sin )  From Wikipedia, modified

cos(0) = sin(0) = 1.0 0.0 (cos(0), sin(0))

cos(PI/2) = sin(PI/2) = 0.0 1.0 (cos(PI/2), sin(PI/2))

cos(PI) = sin(PI) = -1.0 0.0 (cos(PI), sin(PI))

Change the radius from 1 to R (Rcos(), Rsin()) R 

Move the center from (0,0) to (X,Y) (X+Rcos(), Y+Rsin()) R  (X,Y) Y X (0,0)

Curved Objects Run the program circle.cpp. Observe instructions in comment and console screen global variables new version of color: glColor3ub use of rand() glutPostRedisplay in keyInput

parametric equation of circle

The book also has parabola.cpp, another example of a curve described parametrically. Run it on your own.

3-D Depth Buffer Perspective

circularAnnuluses.cpp (modified)

Overwritten void drawDisc(float R, float X, float Y, float Z); glColor3f(0.0, 0.0, 1.0); drawDisc(20.0, 25.0, 75.0, 0.0); glColor3f(1.0, 1.0, 1.0); drawDisc(10.0, 25.0, 75.0, 0.0);

The real deal if (isWire) glPolygonMode(GL_FRONT, GL_LINE); else glPolygonMode(GL_FRONT, GL_FILL); glColor3f(1.0, 0.0, 0.0); glBegin(GL_TRIANGLE_STRIP); for(i = 0; i <= N; ++i) { angle = 2 * PI * i / N; glVertex3f(50 + cos(angle) * 10.0, 30 + sin(angle) * 10.0, 0.0); glVertex3f(50 + cos(angle) * 20.0, 30 + sin(angle) * 20.0, 0.0); } glEnd();

Floating glEnable(GL_DEPTH_TEST); // Enable depth testing. glColor3f(0.0, 1.0, 0.0); drawDisc(20.0, 75.0, 75.0, 0.0); glColor3f(1.0, 1.0, 1.0); drawDisc(10.0, 75.0, 75.0, 0.5); // Compare this z-value with that of the green disc. glDisable(GL_DEPTH_TEST); // Disable depth testing.

To use the depth buffer, you must initialize it in main. glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); And clear it glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

Hidden surface removal. glOrtho(0.0, 100.0, 0.0, 100.0, -1.0, 1.0);

What is it? x = Rcos(t) -10*PI <= t <= 10*PI y = Rsin(t) z = t - 60.0 -10*PI <= t <= 10*PI

Helix.cpp x = Rcos(t) -10*PI <= t <= 10*PI y = Rsin(t) z = t - 60.0 -10*PI <= t <= 10*PI -31.4 31.4 -60 -60 _____ _____ z: -91.4 -28.6

Helixmod.cpp cont after a modification of view

How do we indicate depth in pictures?

glFrustum(left, right, bottom, top, near, far)

glFrustum(-5.0,5.0,-5.0,5.0,4.0,100.0);