Curves. First of all… You may ask yourselves “What did those papers have to do with computer graphics?” –Valid question Answer: I thought they were cool,

Slides:



Advertisements
Similar presentations
Curves Jim Van Verth Essential Math for Games Animation Problem: want to replay stored set of transformations  Generated by.
Advertisements

Lecture Notes #11 Curves and Surfaces II
BEZIER CURVES Part II. Assume we are given two endpoints labelled E1 and E2 and two control points labelled C1 and C2. create a smooth curve whose endpoints.
© University of Wisconsin, CS559 Spring 2004
COMPUTER GRAPHICS CS 482 – FALL 2014 OCTOBER 8, 2014 SPLINES CUBIC CURVES HERMITE CURVES BÉZIER CURVES B-SPLINES BICUBIC SURFACES SUBDIVISION SURFACES.
Lecture 10 Curves and Surfaces I
Geometric Modeling Notes on Curve and Surface Continuity Parts of Mortenson, Farin, Angel, Hill and others.
Cubic Curves CSE167: Computer Graphics Instructor: Steve Rotenberg UCSD, Fall 2006.
ICS 415 Computer Graphics Bézier Splines (Chapter 8)
CS 445/645 Fall 2001 Hermite and Bézier Splines. Specifying Curves Control Points –A set of points that influence the curve’s shape Knots –Control points.
© University of Wisconsin, CS559 Spring 2004
B-Spline Blending Functions
CS 445 / 645 Introduction to Computer Graphics Lecture 22 Hermite Splines Lecture 22 Hermite Splines.
Chapter 18 Interpolation The Islamic University of Gaza
1 Introduction Curve Modelling Jack van Wijk TU Eindhoven.
Dr. S.M. Malaek Assistant: M. Younesi
08/30/00 Dinesh Manocha, COMP258 Hermite Curves A mathematical representation as a link between the algebraic & geometric form Defined by specifying the.
1 Curves and Surfaces. 2 Representation of Curves & Surfaces Polygon Meshes Parametric Cubic Curves Parametric Bi-Cubic Surfaces Quadric Surfaces Specialized.
Slide 127 October 1999CS Computer Graphics (Top Changwatchai) Review of Spline Concepts Sections 10-6 to in Hearn & Baker Splines can be 2D.
Curves Chiew-Lan Tai.
Curves Chiew-Lan Tai. Curves 2 Reading Required Hearn & Baker, 8-8 – 8-10, 8-12 Foley, 11.2.
Advanced Computer Graphics (Spring 2005) COMS 4162, Lecture 12: Spline Curves (review) Ravi Ramamoorthi Most material.
Curves Locus of a point moving with one degree of freedom
Curves Mortenson Chapter 2-5 and Angel Chapter 9
Drawing Parametric Curves Jean-Paul Mueller. Curves - The parametric form of a curve expresses the value of each spatial variable for points on the curve.
Modelling: Curves Week 11, Wed Mar 23
RASTER CONVERSION ALGORITHMS FOR CURVES: 2D SPLINES 2D Splines - Bézier curves - Spline curves.
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Curves Week 13, Mon 24 Nov 2003.
Curves and Surfaces CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Chapter 10: Curves and Surfaces Part 1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Mohan Sridharan Based on Slides.
Designing Parametric Cubic Curves
Curve Modeling Bézier Curves
Bresenham’s Algorithm. Line Drawing Reference: Edward Angel’s book: –6 th Ed. Sections 6.8 and 6.9 Assuming: –Clipped (to fall within the window) –2D.
11/19/02 (c) 2002, University of Wisconsin, CS 559 Last Time Many, many modeling techniques –Polygon meshes –Parametric instancing –Hierarchical modeling.
Scan Conversion. Also known as rasterization In our programs objects are represented symbolically –3D coordinates representing an object’s position –Attributes.
A D V A N C E D C O M P U T E R G R A P H I C S CMSC 635 January 15, 2013 Spline curves 1/23 Curves and Surfaces.
CS 376 Introduction to Computer Graphics 04 / 23 / 2007 Instructor: Michael Eckmann.
October 14, 2014Computer Vision Lecture 11: Image Segmentation I 1Contours How should we represent contours? A good contour representation should meet.
V. Space Curves Types of curves Explicit Implicit Parametric.
Spline Representations
Curves.
Quadratic Surfaces. SPLINE REPRESENTATIONS a spline is a flexible strip used to produce a smooth curve through a designated set of points. We.
Chapter VI Parametric Curves and Surfaces
INTERPOLATION & APPROXIMATION. Curve algorithm General curve shape may be generated using method of –Interpolation (also known as curve fitting) Curve.
Curves and Surfaces Chapter 10. CS 480/680 2Chapter 9 -- Hierarchical Models Introduction: Introduction: Until now we have worked with flat entities such.
CS 445/645 Fall 2001 Splines/Film/Animation. Final Exam Thursday, December 13 th from 7 – 10 p.m. –Room Olsson 011 You may use one sheet of notes (8.5.
CS 376 Introduction to Computer Graphics 04 / 25 / 2007 Instructor: Michael Eckmann.
Basic Theory (for curve 02). 1.3 Parametric Curves  The main aim of computer graphics is to display an arbitrary surface so that it looks real.  The.
Representation of Curves & Surfaces Prof. Lizhuang Ma Shanghai Jiao Tong University.
L5 – Curves in GIS NGEN06 & TEK230: Algorithms in Geographical Information Systems by: Sadegh Jamali (source: Lecture notes in GIS, Lars Harrie) 1 L5-
Interactive Graphics Lecture 10: Slide 1 Interactive Computer Graphics Lecture 10 Introduction to Surface Construction.
11/6/ :55 Graphics II Introduction to Parametric Curves and Surfaces Session 2.
Greg Humphreys CS445: Intro Graphics University of Virginia, Fall 2003 Parametric Curves & Surfaces Greg Humphreys University of Virginia CS 445, Spring.
CSCE 441: Keyframe Animation/Smooth Curves (Cont.) Jinxiang Chai.
CSCE 441: Keyframe Animation/Smooth Curves (Cont.) Jinxiang Chai.
(c) 2002 University of Wisconsin
Designing Parametric Cubic Curves 1. 2 Objectives Introduce types of curves ­Interpolating ­Hermite ­Bezier ­B-spline Analyze their performance.
CS 450: Computer Graphics PARAMETRIC SPLINES AND SURFACES
Rendering Bezier Curves (1) Evaluate the curve at a fixed set of parameter values and join the points with straight lines Advantage: Very simple Disadvantages:
Curves University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2013 Tamara Munzner.
Object Modeling: Curves and Surfaces CEng 477 Introduction to Computer Graphics.
Introduction to Parametric Curve and Surface Modeling.
Interpolation - Introduction
COMPUTER GRAPHICS CHAPTERS CS 482 – Fall 2017 SPLINES
Computer Graphics Lecture 37
© University of Wisconsin, CS559 Fall 2004
© University of Wisconsin, CS559 Spring 2004
CSCE 441: Keyframe Animation/Smooth Curves (Cont.)
Introduction to Parametric Curve and Surface Modeling
Type to enter a caption. Computer Graphics Week 10 Lecture 2.
Presentation transcript:

Curves

First of all… You may ask yourselves “What did those papers have to do with computer graphics?” –Valid question Answer: I thought they were cool, unique applications of computer graphics This week we’re looking at scan conversion of curves

Interpolation Bresenham’s line drawing algorithm is nothing more than a form of interpolation –Given two points, find the location of points in between them –The function (in this case it’s a line) must pass through the given points, by definition

Interpolation Usage We used Bresenham line drawing (interpolation) to scan convert a symbolic representation of a line to a rasterized line Other applications exist –Computing calendar years are leap years (believe it or not) Line Drawing, Leap Years, and Euclid, Harris and Reingold, ACM Computing Surveys, Vol. 36, No. 1, March 2004, pp –Path planning for key frame animation

Key Frame Animation Key frames are infrequent scenes that capture the essential flow of an animation –Think of them as the endpoints of a line In between frames (tweens) may be generated by interpolating between two key frames –Think of these as the points drawn by the Bresenham algorithm

Approximation Another possibility for generating tweens is to specify tie-points that guide the generation of the intermediate path points but the path does not pass through the tie-points This technique is called approximation or curve fitting

Curves We’ll look at two techniques for generating curves (to be used as either paths or drawn objects) –Interpolation –Approximation We’ll also see that interpolation is very restrictive when considering parametric curves Approximation is a much better approach

Parametric Curves Recall the parametric line equations The parameter t is used to map out a set of (x, y) pairs that represent the line

Parametric Curves In the case of a curve the parametric function is of the form –Q(u) = (x(u), y(u), z(u)) in 3 dimensions The derivative of Q(u) is of the form –Q’(u) = (x’(u), y’(u), z’(u)) Significance of the derivative? –It is the tangent vector at a given point (u) on the curve

Derivative

Parametric Curves In the case of object drawing, u is a spatial parameter (like t was for the line) In the case of key frame animation, u is a temporal parameter In both cases Q(0) is the start of the curve and Q(1) is the end, as was the case for the parametric line

Parametric Curves Curvature Curvature k = 1/ ρ The higher the curvature, the more the curve bends at the given point Osculating circle of radius ρ touches the curve at exactly 1 point ρ

Parametric Curves From calculus, a function f is continuous at a value x 0 if In layman’s terms this means that we can draw the curve without ever lifting our pen from the drawing surface f(x) is continuous over an interval (a,b) if it is continuous for every point in the interval We call this C 0 continuity

Parametric Curves a b a b Continuous over (a,b) – C 0

Parametric Curves From calculus, a function’s derivative f’ is continuous at a value x 0 if In layman’s terms this means that there are no “sharp” changes in direction f’(x) is continuous over an interval (a,b) if it is continuous for every point in the interval We call this C 1 (tangential) continuity

Parametric Curves a b a b Continuous derivative over (a,b) – C 1 Discontinuous derivative over (a,b) – not C 1

Parametric Curves When we need to join two curves at a single point we can guarantee C 1 continuity across the joint –For the case when we can’t make one continuous curve –Just make sure that the tangents of the two curves at the join are of equal length and direction If the tangents at the joint are of identical direction but differing lengths (change in curvature) then we have G 1 continuity

Lagrange Polynomials To generate a function that passes through every specified point, the type of function depends on the number of specified points –Two points → linear function –Three points → quadratic function –Four points → cubic function Generating such functions makes use of Lagrange polynomials

Lagrange Polynomials The general form is (n is the number of points) Let’s look at an example

Lagrange Polynomials For two points P 0 and P 1 : For the starting point (t 0 =0) and ending point (t 1 =1)

Lagrange Polynomials For three points P 0, P 1, and P 2 : And it only gets worse for larger numbers of points Suffice it to say, this isn’t the most optimum way to draw curves –Too many operations per point –Too complex if the artist decides to change the curve –But you could do it

A Better Way The problem with Lagrange polynomials lies in the fact that we try to make the curve pass through all of the specified points A better way is to specify points that control how the curve passes from one point to the next We do so by specifying a cubic function controlled by four points The four points are called boundary conditions

Hermite Boundary Conditions Two points Two tangent vectors –Two of the points are interpreted as vectors off of the other two points P0P0 P1P1 P’ 1 P’ 0

Cubic Functions Generalized form Derivative Our goal is to “solve” these equations in “closed form” so that we can generate a series of points on the curve This is why it’s called a “cubic” function

Cubic Functions There are four unknown values in the equation –a, b, c, and D (remember, a, b, c, and D are vectors in x, y, z so there is actually a set of 3 equations) We need to use these equations to generate values of x, y, and z along the curve We can generate a closed form solution (solve the equations for x, y, and z) since we have four known boundary conditions u = 0 → Q(0) = P 0 and Q’(0) = P’ 0 u = 1 → Q(1) = P 1 and Q’(1) = P’ 1

Solution of Equations Go to the white board…

Implementation So, all you have to do to generate a curve is to implement this vector (x, y, z) equation: by stepping 0 ≤ u ≤ 1 P 0, P 1, P 0 ’ and P 1 ’ are vectors in x, y, z so there are really 12 coefficients to be computed and you’ll be implementing 3 equations for Q(u)

Implementation Note that you’ll have to estimate the step size for u or…(any ideas?) …use your Bresenham code to draw short straight lines between the points you generate on the curve (to fill gaps) There is no trick (that I’m aware of) comparable to the Bresenham approach

Bezier Curves Similar derivation to Hermite Different boundary conditions –Bezier uses 2 endpoints and 2 control points (rather than 2 endpoints and 2 slopes)

Bezier Curves Endpoints Control points

Implementation So, all you have to do to generate a curve is to implement this vector (x, y, z) equation: by stepping 0 ≤ u ≤ 1 P 0, P 1, P 2 and P 3 are vectors in x, y, z so there are really 12 coefficients to be computed and you’ll be implementing 3 equations for Q(u)

Bezier example

Hermite vs. Bezier Hermite is easy to control continuity at the endpoints when joining multiple curves to create a path –But difficult to control the “internal” shape of the curve Bezier is easy to control the “internal” shape of the curve –But a little more (not much) difficult to control continuity at the endpoints when joining multiple curves to create a path Bottom line is, when creating a path you have to be very selective about endpoints and adjacent control points (Bezier) or tangent slopes (Hermite)

Result Go to the demo program… My code generates a Hermite curve that is of C 1 continuity –As I generate new segments along the curve I join them by keeping the adjoining tangent vectors equal

Homework Implement Bezier and Hermite curve drawing –Parameters should be control points and brush width Create a video sequence to show in class –Demonstrate Bezier and Hermite curves of various control points and brush widths –Be creative Due date – Next week – Turn in: –Video to be shown in class –All program listings Grading will be on completeness (following instructions) and timeliness (late projects will be docked 10% per week)