Ellipses Using OpenGL.

Slides:



Advertisements
Similar presentations
10.4 Ellipses p An ellipse is a set of points such that the distance between that point and two fixed points called Foci remains constant d1 d2.
Advertisements

Section 11.6 – Conic Sections
ELLIPSE – a conic section formed by the intersection of a right circular cone and a plane.
Section 9.1 The Ellipse. Overview Conic sections are curves that result from the intersection of a right circular cone—think ice cream cone—and a plane—think.
OpenGL (Graphics Library) Software Interface to graphics software Allows to create interactive programs that produce color images of moving 3D objects.
CSC 461: Lecture 51 CSC461 Lecture 5: Simple OpenGL Program Objectives: Discuss a simple program Discuss a simple program Introduce the OpenGL program.
10.1 Conics and Calculus. Each conic section (or simply conic) can be described as the intersection of a plane and a double-napped cone. CircleParabolaEllipse.
Hyperbolas and Rotation of Conics
Conic Sections Digital Lesson. Copyright © by Houghton Mifflin Company, Inc. All rights reserved. 2 Conic Sections Conic sections are plane figures formed.
9.1.1 – Conic Sections; The Ellipse
10.3 Hyperbolas. Circle Ellipse Parabola Hyperbola Conic Sections See video!
CHAPTER 9 CONIC SECTIONS.
Introduction to GL Geb Thomas. Example Code int main(int argc, char **argv) { glutInit(&argc, argv); glutInitDisplayMode ( GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH);
Review Day! Hyperbolas, Parabolas, and Conics. What conic is represented by this definition: The set of all points in a plane such that the difference.
Modeling with OpenGL Practice with OpenGL transformations.
Conics A conic section is a graph that results from the intersection of a plane and a double cone.
Conics can be formed by the intersection
Section 7.3 – The Ellipse Ellipse – a set of points in a plane whose distances from two fixed points is a constant.
Chun-Yuan Lin Introduction to OpenGL 2015/12/19 1 CG.
Conic Sections Curves with second degree Equations.
Conic Sections.
Conic Sections The Parabola. Introduction Consider a ___________ being intersected with a __________.
10.3 The Ellipse.
 You probably know the ellipse by its more well-known name: the oval.  An ellipse looks like a circle that has been stretched out.
MATT KWAK 10.2 THE CIRCLE AND THE ELLIPSE. CIRCLE Set of all points in a plane that are at a fixed distance from a fixed point(center) in the plane. With.
Precalculus Unit 5 Hyperbolas. A hyperbola is a set of points in a plane the difference of whose distances from two fixed points, called foci, is a constant.
CS552: Computer Graphics Lecture 6: Viewing in 2D.
Ellipse Notes. What is an ellipse? The set of all points, P, in a plane such that the sum of the distances between P and the foci is constant.
MTH 253 Calculus (Other Topics) Chapter 10 – Conic Sections and Polar Coordinates Section 10.1 – Conic Sections and Quadratic Equations Copyright © 2009.
1 Programming with OpenGL Part 2: Complete Programs.
OpenGL API 2D Graphic Primitives Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
Warm-Up Write the standard equation of the circle with the given radius and center. 1) 9; (0,0) 2) 1; (0,5) 3) 4; (-8,-1) 4) 5; (4,2)
Conic Sections There are 4 types of Conics which we will investigate: 1.Circles 2.Parabolas 3.Ellipses 4.Hyperbolas.
Henry County High School Mrs. Pennebaker.  Review: The geometric definition relies on a cone and a plane intersecting it  Algebraic definition: a set.
Accelerated Precalculus Ellipses. One Minute Question Find the diameter of: x 2 + y 2 + 6x - 14y + 9 = 0.
Conics Memory Aid Math SN5 May 25, Circles Locus definition of a circle: The locus of points a given distance from a given point in that plane.
Distance The distance between any two points P and Q is written PQ. Find PQ if P is (9, 1) and Q is (2, -1)
Making graphs and using equations of ellipses. An ellipse is the set of all points P in a plane such that the sum of the distance from P to 2 fixed points.
Hyperbolas Objective: graph hyperbolas from standard form.
Conic Sections. Objective Given a translation, I can graph an equation for a conic section.
Computer Graphics I, Fall Programming with OpenGL Part 2: Complete Programs.
10.2 Ellipses. Ellipse – a set of points P in a plane such that the sum of the distances from P to 2 fixed points (F 1 and F 2 ) is a given constant K.
Conics A conic section is a graph that results from the intersection of a plane and a double cone.
10.1 Conics and Calculus.
Conics A conic section is a graph that results from the intersection of a plane and a double cone.
Conics Parabolas, Hyperbolas and Ellipses
6.2 Equations of Circles +9+4 Completing the square when a=1
Programming with OpenGL Part 2: Complete Programs
Section 13.2 The Ellipse.
10.2 Ellipses.
OpenGL API 2D Graphic Primitives
OpenGL (Open Graphics Library) Mr. B.A.Swamy Assistant Professor Dept of CSE.
Ellipses Date: ____________.
Graph and Write Equations of Elllipses
12.5 Ellipses and Hyperbolas.
MATH 1330 Section 8.2b.
Chapter 9 Conic Sections.
Section 10.2 – The Ellipse Ellipse – a set of points in a plane whose distances from two fixed points is a constant.
Graph and Write Equations of Ellipses
Ellipses Ellipse: set of all points in a plane such that the sum of the distances from two given points in a plane, called the foci, is constant. Sum.
Ellipses Objectives: Write the standard equation for an ellipse given sufficient information Given an equation of an ellipse, graph it and label the center,
9.4 Graph & Write Equations of Ellipses
Sullivan Algebra and Trigonometry: Section 11.3
10.4 Ellipses Elliptical Orbits Elliptical Galaxies
Programming with OpenGL Part 2: Complete Programs
Section 11.6 – Conic Sections
What are Conic Sections?
L10-4 Obj: Students will find equations for ellipses and graph ellipses. Ellipse Definition: Each fixed point F is a focus of an ellipse (plural: foci).
Chapter 10 Conic Sections.
Ellipse.
Presentation transcript:

Ellipses Using OpenGL

Ellipse An ellipse is basically an oval. The technical definition for an ellipse is a closed plane curve generated by a point moving in a way that the sums of its distances from two fixed points (called the foci) is a constant.

Ellipse Graphics -Vertexes (V1 & V2 on the diagram) of the ellipse are defined as the intersections of the ellipse and a line passing through foci (F1 & F2 on the diagram). The distance between the vertexes are called major axis or focal axis. A line passing the center and perpendicular to the major axis is the minor axis.

Standard equation of an ellipse with center at (0, 0) (x^2 / a^2) + (y^2 / b^2) = 1 Where a > b > 0 This equation is known as the Cartesian Equation. The drawing looks as follows. The ellipse is horizontal

Equation of an ellipse cont. (x^2 / b^2) + (y^2 / a^2) = 1 Where a > b > 0 The drawing looks as follows The ellipse is vertical

Equation of an ellipse with center not at the origin Ellipses don’t have to always have it’s center at the origin. The equation of an ellipse with center not at the origin is … where the center of the ellipse is at point (X0, Y0)

Equations of an ellipse cont. Now that we have considered the standard equation of an ellipse now we can look at the general equation. With this equation however, comes a few properties to consider …

Properties of the general equation A is not equal to C A is not equal to 0 C is not equal to 0 If A=C, then the graph will turn into a circle If A=0, then the graph will turn into a parabola that opens horizontally (left of right). If C=0, then the graph will turn into a parabola that opens vertically (up or down).

Area of an ellipse The area of an ellipse with major axis radius, a, and minor axis radius, b, is given by … The Area of an arbitrary ellipse given by the Quadratic Equation ( ) is

Drawing an ellipse in OpenGL To draw an ellipse in OpenGL you need to first draw a circle and then scale the circle to look like an ellipse. You need to do this because there isn’t a built in command to draw an ellipse. The procedure you need to do this is gluDisk( ).

The gluDisk function draws a circle (disk) void gluDisk( GLUquadricObj *qobj, GLdouble innerRadius, GLdouble outerRadius, GLint slices, GLint loops ); qobj – is the quadratic object innerRadius – the inner radius of the disk ( it may be 0 ) outerRadius – the outer radius of the disk slices – the number of subdivisions around the z-axis loops – the number of concentric rings about the origin into which the disk is subdivided.

gluNewQuadric Along with the gluDisk( ) function, you can’t draw an ellipse without using the function gluNewQuadric( ). There are no parameters for this function and it is used to create and return a pointer to a new quadric object.

Code Segments for an ellipse program void Display () { glClear(GL_COLOR_BUFFER_BIT); GLUquadricObj * quadricObj; //Creates a quadratic object quadricObj = gluNewQuadric(); //Sets a pointer to a new quadratic object gluQuadricDrawStyle(quadricObj, GLU_FILL); glColor3f (0.0, 1.0, 0.0); //Sets ellipse color to green glScalef(0.7, 1.5, 1.0); //Scales the ellipse //glColor3f (1.0, 0.0, 0.0); //Red ellipse //glScalef(1.4, 0.7, 1.0); //glColor3f (0.0, 0.0, 1.0); //Blue ellipse //glScalef(0.4, 1.6, 1.0); gluDisk(quadricObj, 0.0, 3.0, 100, 100); //Sets the ellipse properties glFlush(); }

Display ( ) function Inside the Display function is where the most important commands to draw the ellipse occur. The essential lines of code that you need to have are … GLUquadricObj * quadricObj; //Creates a quadratic object quadricObj = gluNewQuadric(); //Sets a pointer to a new quadratic object gluQuadricDrawStyle(quadricObj, GLU_FILL); //Sets the draw style gluDisk(quadricObj, 0.0, 3.0, 100, 100); //Sets ellipse properties

Code Segments for an ellipse program cont. void init() { glClearColor(0.0, 0.0, 0.0, 0.0); //Sets background color to black glMatrixMode( GL_PROJECTION); glLoadIdentity(); glOrtho(-8.0, 8.0, -8.0, 8.0, -8.0, 8.0); }

Code Segments for an ellipse program cont. void main( int argc, char **argv) { glutInit ( &argc, argv); glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); glutInitWindowSize( 300, 300); glutInitWindowPosition( 200, 200); glutCreateWindow("Ellipses"); init(); glutDisplayFunc( Display ); glutMainLoop(); }

Ellipses The three functions (display, init, and main) are all you need in order to draw a simple ellipse. As long as you have the essential few lines of code to implement the figure. Demonstrate the simple ellipse.