CS 450: COMPUTER GRAPHICS DRAWING ELLIPSES AND OTHER CURVES SPRING 2015 DR. MICHAEL J. REALE.

Slides:



Advertisements
Similar presentations
Liceo Scientifico “G.Ferraris” Taranto Maths course
Advertisements

CS 376 Introduction to Computer Graphics 02 / 02 / 2007 Instructor: Michael Eckmann.
Conic Section By H.K.MEENA PGT (Maths) KV BEAWAR (Raj)
Section 11.6 – Conic Sections
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.
Section 1.1 The Distance and Midpoint Formulas. x axis y axis origin Rectangular or Cartesian Coordinate System.
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.
Circle Drawing algo..
Hyperbolas and Rotation of Conics
Conic Sections. (1) Circle A circle is formed when i.e. when the plane  is perpendicular to the axis of the cones.
ESSENTIAL CALCULUS CH09 Parametric equations and polar coordinates.
CGMB214: Introduction to Computer Graphics
1 CS 430/536 Computer Graphics I Circle Drawing and Clipping Week 3, Lecture 6 David Breen, William Regli and Maxim Peysakhov Geometric and Intelligent.
Conics, Parametric Equations, and Polar Coordinates
CS 450: COMPUTER GRAPHICS REVIEW: DRAWING ELLIPSES AND OTHER CURVES SPRING 2015 DR. MICHAEL J. REALE.
SECTION: 10 – 3 HYPERBOLAS WARM-UP
CHAPTER 9 CONIC SECTIONS.
Slide 5- 1 Copyright © 2006 Pearson Education, Inc. Publishing as Pearson Addison-Wesley.
9.1 Conic Sections Conic sections – curves that result from the intersection of a right circular cone and a plane. Circle Ellipse Parabola Hyperbola.
1 Circle Drawing Algorithms Pictures snagged from
What is the standard form of a parabola who has a focus of ( 1,5) and a directrix of y=11.
Graphics Output Primitives
ELLIPSE GENERATING ALGORITHMS 1. DEFINITION Ellipse is an elongated circle. Elliptical curves can be generated by modifying circle-drawing procedures.
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.
Conics A conic section is a graph that results from the intersection of a plane and a double cone.
50 Miscellaneous Parabolas Hyperbolas Ellipses Circles
MIDPOINT CIRCLE & ELLIPSE GENERARTING ALGORITHMS
Section 7.3 – The Ellipse Ellipse – a set of points in a plane whose distances from two fixed points is a constant.
Slide Copyright © 2006 Pearson Education, Inc. Publishing as Pearson Addison-Wesley.
Section 2 Chapter Copyright © 2012, 2008, 2004 Pearson Education, Inc. Objectives The Circle and the Ellipse Find an equation of a circle.
Sullivan Algebra and Trigonometry: Section 11.5 Objectives of this Section Identify a Conic Use a Rotation of Axes to Transform Equations Discuss an Equation.
CS 376 Introduction to Computer Graphics 04 / 25 / 2007 Instructor: Michael Eckmann.
Conic Sections Conic sections come from the double cones above and a plane that intersects one or both cones, the cross-section provided is then one of.
Copyright © Cengage Learning. All rights reserved. 9.3 Hyperbolas and Rotation of Conics.
CS 325 Introduction to Computer Graphics 02 / 03 / 2010 Instructor: Michael Eckmann.
SECTION: 10-2 ELLIPSES WARM-UP
Conic Sections.
CS 450: Computer Graphics PARAMETRIC SPLINES AND SURFACES
Conic Sections The Parabola. Introduction Consider a ___________ being intersected with a __________.
Slide 1- 1 Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley.
Henry County High School Mrs. Pennebaker.  Review: The geometric definition relies on a cone and a plane intersecting it  Algebraic definition: a set.
PreCalculus 9-R Unit 9 – Analytic Geometry Review Problems.
Conics, Parametric Equations, and Polar Coordinates Copyright © Cengage Learning. All rights reserved.
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)
Conics. Conic Sections - Definition A conic section is a curve formed by intersecting cone with a plane There are four types of Conic sections.
Computer Graphics CC416 Lecture 04: Bresenham Line Algorithm & Mid-point circle algorithm Dr. Manal Helal – Fall 2014.
Computer Graphics Lecture 07 Ellipse and Other Curves Taqdees A. Siddiqi
Computer Graphics Lecture 06 Circle Drawing Techniques Taqdees A. Siddiqi
Conics A conic section is a graph that results from the intersection of a plane and a double cone.
10.1 Conics and Calculus.
CONIC SECTIONS.
Chapter 10 Conic Sections
Conics A conic section is a graph that results from the intersection of a plane and a double cone.
Conics A conic section is a graph that results from the intersection of a plane and a double cone.
Analyzing Conic Sections
Lecture 05: Mid-point Ellipse algorithm Dr. Manal Helal – Fall 2014
6-3 Conic Sections: Ellipses
6.2 Equations of Circles +9+4 Completing the square when a=1
Conic Sections College Algebra
Conic Sections Anyway you slice it.
Topics in Analytic Geometry
Scan Conversion of Circles
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.
Review Circles: 1. Find the center and radius of the circle.
Chapter 3 Graphics Output Primitives
Analyzing Conic Sections
Section 11.6 – Conic Sections
What are Conic Sections?
Chapter 7 Analyzing Conic Sections
Presentation transcript:

CS 450: COMPUTER GRAPHICS DRAWING ELLIPSES AND OTHER CURVES SPRING 2015 DR. MICHAEL J. REALE

OVERVIEW When dealing with other kinds of curves, we can draw it in one of the following ways: Use explicit form (i.e., y = f(x)) or a parametric form (i.e., y = f(s) and x = g(s))  approximate curve with line segments Parametric form better for this  easy to get evenly-spaced points along curve path Can connect points OR use best-fitting line (linear regression or least squares approach) Use implicit form (i.e., f(x,y) = 0) and derive incremental midpoint method In this slide deck, we’ll cover: Ellipses with the midpoint method Conic sections (and broadly discuss how to draw them) Polynomials and spline curves (which we’ll cover in greater detail later)

ELLIPSES

INTRODUCTION Ellipses are basically elongated circles Formal definition: given two points F 1 (x 1, y 1 ) and F 2 (x 2, y 2 ) (the foci of the ellipses), a point (x,y) is on the ellipse if the sum of the distances from F 1 and F 2 is some constant c. Conceptually, this is like having a string whose ends are connected at F 1 and F 2, while you use a pencil to trace out the ellipse. If we expand this out, we get: The general ellipse equation: llipse_via_two_tacks_a_loop_and_a_pen.jpg#mediavie wer/File:Drawing_an_ellipse_via_two_tacks_a_loop_an d_a_pen.jpg

AXIS-ALIGNED ELLIPSES Ellipses have two axes: Major axis = line passing through both foci Minor axis = line perpendicular to major axis The semimajor and semiminor axes are like radii aligned with the major and minor axes, respectively If the ellipse axes are aligned with the coordinate axes (i.e., x and y), the equation we can use is a lot simpler: …where r x = semimajor/minor axis aligned with x axis r y = semimajor/minor axis aligned with y axis

MIDPOINT ELLIPSE ALGORITHM We’re going to assume our ellipse is aligned with the x and y axes Start at (0,r y ) Increment in x and choose y UNTIL abs(slope) > 1.0 Then, decrement in y and choose x Use symmetry to copy points to other 3 quadrants

DERIVING OUR ELLIPSE FORMULA We’re going to assume our ellipses is centered at (0,0) This won’t affect which pixels we choose

OUR ELLIPSE FORMULA …which has the following properties:

GETTING THE SLOPE We’ll start by incrementing x, but we need to check the slope to make sure it isn’t <= -1.0 To get the slope, we’ll do some implicit differentiation 

TESTING THE SLOPE When the slope = -1.0 (at boundary of R1 and R2), then: When the slope < -1.0 (entering R2):

DECISION VARIABLE: REGION 1 Our decision variable for region 1 is going to be based on where (x k + 1, y k – ½) is relative to the “true” ellipse: Similar to the midpoint circle algorithm: If p1 k < 0  inside ellipse  choose y k Otherwise  outside ellipse  choose y k - 1

INCREMENTING THE DECISION VARIBLE: REGION 1 To figure out our increment, we look at the value of p1 k+1 :

INCREMENTING THE DECISION VARIBLE: REGION 1 If p1 k < 0  chose y k+1 = y k  Otherwise  chose y k+1 = y k - 1 

WHEN DO WE SWITCH TO REGION 2? We have to check when this expression becomes true: At the starting point (0,r y ), these values are: So, every iteration: Add 2r y 2 to p x If we choose (y – 1), subtract 2r x 2 from p y

INITIAL DECISION VARIABLE: REGION 1

DECISION VARIABLE: REGION 2 Decrementing in y To get next decision variable: If p2 k > 0  outside  choose x k  increment p2 k : Otherwise  inside  choose (x k + 1)  increment p2 k :

INITIAL DECISION VARIBLE: REGION 2 We’ll use the last point we had before switching to region 2: An alternative would be to start at (r x, 0) and go counterclockwise; we would then INCREMENT y and choose between x and (x – 1)

NONSTANDARD ELLIPSES We have two ways to deal with non-standard ellipses (i.e., ellipses that do not line up with the coordinate axes): 1) Adapt formulas to work over ENTIRE ellipse path 2) Get the pixels for the standard ellipse, but then transform the points (i.e., rotation matrix)

MIDPOINT ELLIPSE ALGORITHM: REGION 1 1. Input r x, r y, and ellipse center (x c, y c ); get first point for ellipse centered on origin: 2. Get initial decision variable for region 1: 3. While (2r y 2 x < 2r x 2 y) If p1 k < 0  choose (x k + 1, y k )  Otherwise  choose (x k + 1, y k – 1) 

MIDPOINT ELLIPSE ALGORITHM: REGION 2 4. Get initial value of decision variable for region 2 from last position (x 0, y 0 ) calculated in region 1: 5. While (y != 0) If p2 k > 0  choose (x k, y k – 1)  Otherwise  choose (x k + 1, y k – 1)  6. For both regions, define symmetry points: (x,y), (-x,y), (x,-y), and (-x,-y) 7. For each position (x,y), plot:

CONIC SECTIONS

A conic section (or conic) can be described with this second-degree equation: Basically, it’s any (nondegenerate) curve generated by the intersection of a plane with a top and/or bottom of a double cone “Degenerate” conics would be things like points and straight lines The values of A,B,C,D,E, and F determine what kind of curve we want If we look at (B 2 – 4AC):

DRAWING CONIC SECTIONS Figure out where the curve is symmetrical Circles  symmetrical across 8 octants Ellipses/Hyperbolas  symmetrical across 4 quadrants Parabolas  symmetrical across vertical axis Compute decision variable formulas for areas where slope is less than 1.0 and greater than 1.0 Go through midpoint algorithm, checking when to switch because of slope

POLYNOMIALS AND SPLINE CURVES

The usual way to handle these is to break them in parametric form For example, given a third-order (cubic) polynomial: The parameter u varies from 0 to 1 (start and end of the curve) If you have a continuous curve formed with polynomial pieces  spline curve (or just splines) We’ll talk about these later Usually you would draw these by approximating them with line segments (with small increments of u)