CS 536 Computer Graphics Intro to Curves Week 1, Lecture 2

Similar documents
Intro to Curves Week 1, Lecture 2

Intro to Curves Week 4, Lecture 7

Bezier Curves, B-Splines, NURBS

XPM 2D Transformations Week 2, Lecture 3

XPM 2D Transformations Week 2, Lecture 3

3D Modeling Parametric Curves & Surfaces. Shandong University Spring 2013

Curves and Surfaces 1

3D Modeling Parametric Curves & Surfaces

Curves and Surfaces Computer Graphics I Lecture 9

Computer Graphics Curves and Surfaces. Matthias Teschner

3D Modeling: Surfaces

Curves and Surfaces Computer Graphics I Lecture 10

Splines. Parameterization of a Curve. Curve Representations. Roller coaster. What Do We Need From Curves in Computer Graphics? Modeling Complex Shapes

Curves. Computer Graphics CSE 167 Lecture 11

Geometric Modeling of Curves

Sung-Eui Yoon ( 윤성의 )

Intro to Modeling Modeling in 3D

Fall CSCI 420: Computer Graphics. 4.2 Splines. Hao Li.

Curve and Surface Basics

Until now we have worked with flat entities such as lines and flat polygons. Fit well with graphics hardware Mathematically simple

Design considerations

Parametric Curves. University of Texas at Austin CS384G - Computer Graphics

CS130 : Computer Graphics Curves (cont.) Tamar Shinar Computer Science & Engineering UC Riverside

OUTLINE. Quadratic Bezier Curves Cubic Bezier Curves

Computergrafik. Matthias Zwicker. Herbst 2010

Computer Graphics CS 543 Lecture 13a Curves, Tesselation/Geometry Shaders & Level of Detail

Computergrafik. Matthias Zwicker Universität Bern Herbst 2016

08 - Designing Approximating Curves

Outline. The de Casteljau Algorithm. Properties of Piecewise Linear Interpolations. Recall: Linear Interpolation

Parametric Curves. University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell

Outline. Properties of Piecewise Linear Interpolations. The de Casteljau Algorithm. Recall: Linear Interpolation

CSE 167: Introduction to Computer Graphics Lecture #13: Curves. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2017

2D Spline Curves. CS 4620 Lecture 18

B-Splines and NURBS Week 5, Lecture 9

The Free-form Surface Modelling System

Computer Graphics Splines and Curves

3D Transformations World Window to Viewport Transformation Week 2, Lecture 4

Information Coding / Computer Graphics, ISY, LiTH. Splines

CSE 167: Introduction to Computer Graphics Lecture #11: Bezier Curves. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016

Parametric curves. Brian Curless CSE 457 Spring 2016

2D Spline Curves. CS 4620 Lecture 13

Computer Graphics. Curves and Surfaces. Hermite/Bezier Curves, (B-)Splines, and NURBS. By Ulf Assarsson

CSE 167: Introduction to Computer Graphics Lecture 12: Bézier Curves. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2013

An introduction to interpolation and splines

Curves and Surface I. Angel Ch.10

Bézier Splines. B-Splines. B-Splines. CS 475 / CS 675 Computer Graphics. Lecture 14 : Modelling Curves 3 B-Splines. n i t i 1 t n i. J n,i.

Transformations Week 9, Lecture 18

Introduction to Computer Graphics

Objects 2: Curves & Splines Christian Miller CS Fall 2011

Parametric curves. Reading. Curves before computers. Mathematical curve representation. CSE 457 Winter Required:

Geometry. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science

Dgp _ lecture 2. Curves

Lecture IV Bézier Curves

Shape Representation Basic problem We make pictures of things How do we describe those things? Many of those things are shapes Other things include

Introduction p. 1 What Is Geometric Modeling? p. 1 Computer-aided geometric design Solid modeling Algebraic geometry Computational geometry

CS 475 / CS Computer Graphics. Modelling Curves 3 - B-Splines

ECE 600, Dr. Farag, Summer 09

Central issues in modelling

Representing Curves Part II. Foley & Van Dam, Chapter 11

The goal is the definition of points with numbers and primitives with equations or functions. The definition of points with numbers requires a

Curves D.A. Forsyth, with slides from John Hart

Need for Parametric Equations

CS-184: Computer Graphics. Today

(Spline, Bezier, B-Spline)

LECTURE #6. Geometric Modelling for Engineering Applications. Geometric modeling for engineering applications

CS-184: Computer Graphics

COMPUTER AIDED ENGINEERING DESIGN (BFF2612)

3D Modeling: Solid Models

Rational Bezier Curves

3D Representation and Solid Modeling

Curves and Surfaces. Shireen Elhabian and Aly A. Farag University of Louisville

Curves and Surfaces. Computer Graphics COMP 770 (236) Spring Instructor: Brandon Lloyd

Roadmap for tonight. What are Bezier curves (mathematically)? Programming Bezier curves (very high level view).

For each question, indicate whether the statement is true or false by circling T or F, respectively.

Lecture 2.2 Cubic Splines

Spline Morphing. CG software practical course in the IWR. Carl Friedrich Bolz. Carl Friedrich Bolz

CS123 INTRODUCTION TO COMPUTER GRAPHICS. Describing Shapes. Constructing Objects in Computer Graphics 1/15

CHAPTER 1 Graphics Systems and Models 3

Splines. Connecting the Dots

GEOMETRIC TOOLS FOR COMPUTER GRAPHICS

Properties of Blending Functions

B-spline Curves. Smoother than other curve forms

Computer Graphics I Lecture 11

Motivation. Parametric Curves (later Surfaces) Outline. Tangents, Normals, Binormals. Arclength. Advanced Computer Graphics (Fall 2010)

A story about Non Uniform Rational B-Splines. E. Shcherbakov

Further Graphics. Bezier Curves and Surfaces. Alex Benton, University of Cambridge Supported in part by Google UK, Ltd

Curve Representation ME761A Instructor in Charge Prof. J. Ramkumar Department of Mechanical Engineering, IIT Kanpur

Curves & Surfaces. MIT EECS 6.837, Durand and Cutler

Vector Algebra Transformations. Lecture 4

CS452/552; EE465/505. Geometry Transformations

COMPUTER AIDED GEOMETRIC DESIGN. Thomas W. Sederberg

Review of Tuesday. ECS 175 Chapter 3: Object Representation

A Practical Review of Uniform B-Splines

Parameterization. Michael S. Floater. November 10, 2011

Remark. Jacobs University Visualization and Computer Graphics Lab : ESM4A - Numerical Methods 331

Math background. 2D Geometric Transformations. Implicit representations. Explicit representations. Read: CS 4620 Lecture 6

CS770/870 Spring 2017 Ray Tracing Implementation

C O M P U T E R G R A P H I C S. Computer Graphics. Three-Dimensional Graphics I. Guoying Zhao 1 / 52

(Refer Slide Time: 00:02:24 min)

Spline Curves. Spline Curves. Prof. Dr. Hans Hagen Algorithmic Geometry WS 2013/2014 1

Transcription:

CS 536 Computer Graphics Intro to Curves Week 1, Lecture 2 David Breen, William Regli and Maxim Peysakhov Department of Computer Science Drexel University 1

Outline Math review Introduction to 2D curves Functional representations Parametric cubic curves Introduction to Bézier curves Continuity 2

Geometric Preliminaries Affine Geometry Scalars + Points + Vectors and their ops Euclidian Geometry Affine Geometry lacks angles, distance New op: Inner/Dot product, which gives Length, distance, normalization Angle, Orthogonality, Orthogonal projection Projective Geometry 3

Affine Geometry Affine Operations: Affine Combinations: a 1 v 1 + a 2 v 2 + + a n v n where v 1,v 2,,v n are vectors and Example: 4

Mathematical Preliminaries Vector: an n-tuple of real numbers Vector Operations Vector addition: u + v = w Commutative, associative, identity element (0) Scalar multiplication: cv Note: Vectors and Points are different Can not add points Can find the vector between two points 5

Linear Combinations & Dot Products A linear combination of the vectors v 1, v 2, v n is any vector of the form a 1 v 1 + a 2 v 2 + + a n v n where a i is a real number (i.e. a scalar) Dot Product: a real value u 1 v 1 + u 2 v 2 + + u n v n written as u v 6

Fun with Dot Products Euclidian Distance from (x,y) to (0,0) 2 2 in general: 2 2 x + y x 1 + x2 +... + xn which is just: x x This is also the length of vector v: v or v Normalization of a vector: Orthogonal vectors: 2 7

Projections & Angles Angle between vectors, u v = u v cos(θ) Projection of vectors 8 Pics/Math courtesy of Dave Mount @ UMD-CP

Matrices and Matrix Operators A n-dimensional vector: Matrix Operations: Addition/Subtraction Identity Multiplication Scalar Matrix Multiplication Implementation issue: Where does the index start? (0 or 1, it s up to you ) 9

Matrix Multiplication [C] = [A][B] Sum over rows & columns Recall: matrix multiplication is not commutative Identity Matrix: 1s on diagonal 0s everywhere else 10

Matrix Determinants A single real number Computed recursively Example: ' a det% & b c d $ " # = ad bc det(a) = n j=1 Uses: Find vector ortho to two other vectors Determine the plane of a polygon A i, j ( 1) i+ j M i, j 11

Cross Product Given two non-parallel vectors, A and B A x B calculates third vector C that is orthogonal to A and B A x B = (a y b z - a z b y, a z b x - a x b z, a x b y - a y b x ) A B = x y z a x a y a z b x b y b z 12

Matrix Transpose & Inverse Matrix Transpose: Swap rows and cols: Facts about the transpose: Matrix Inverse: Given A, find B such that AB = BA = I BèA -1 (only defined for square matrices) 13

Derivatives of Polynomials f (x) = αx n df (x) dx = αnx n 1 f (x) = 5x 3 df (x) dx =15x 2 14

Partial Derivatives of Polynomials f (x, y) = αx n y m f (x, y) x = αnx n 1 y m f (x, y) = 5x 3 y 4 f (x, y) x =15x 2 y 4 15

Curves 16

Example Application: Font Design and Display Curved objects are everywhere There is always need for: mathematical fidelity high precision artistic freedom and flexibility physical realism 17 Pics/Math courtesy of G. Farin @ ASU

Example Application: Graphic Design and Arts Courtesy of http://www.pilot3d.com 18

Example Application: Tool Path Generation 19 Pics/Math courtesy of G. Farin @ ASU via M. Wagner @ ASU

Example Application: Motion Planning 20

Functional Representations Explicit Functions: representing one variable with another fine if only one x value for each y value Problem: what if I have a sphere? z = ± r 2 x 2 y 2 Multiple values. (not used in graphics) 21 Pics/Math courtesy of Dave Mount @ UMD-CP

Functional Representations Implicit Functions: curves/surfaces represented as the zeros good for rep. of (n-1)d objects in nd space Sphere example: 2 2 2 2 x + y + z r = 0 What class of function? polynomial: linear combo of integer powers of x,y,z algebraic curves & surfaces: rep d by implicit polynomial functions polynomial degree: total sum of powers, 2 2 2 i.e. polynomial of degree 6: x + y + z r 2 = 0 22 Pics/Math courtesy of Dave Mount @ UMD-CP

Functional Representations Parametric Functions: 2D/3D curve: two functions of one parameter (x(u), y(u)) (x(u), y(u), z(u)) 3D surface: three functions of two parameters (x(u,v), y(u,v), z(u,v)) Example: Sphere Note: rep. not algebraic, but is parametric 23

Functional Representations Which is best?? It depends on the application Implicit is good for computing ray/surface intersection point inclusion (inside/outside test) mass & volume properties Parametric is good for subdivision, faceting for rendering Surface & area properties popular in graphics 24

Issues in Specifying/Designing Curves/Surfaces Note: the internal mathematical representation can be very complex high degree polynomials hard to see how parameters relate to shape How do we deal with this complexity? Use curve control points and either Interpolate Approximate 25

Points to Curves The Lagrangian interpolating polynomial n+1 points, the unique polynomial of degree n curve wiggles thru each control point Issue: not good if you want smooth or flat curves Approximation of control points points are weights that tug on the curve or surface 26 Pics/Math courtesy of Dave Mount @ UMD-CP

Warning, Warning, Warning: Pending Notation Abuse t and u are used interchangeably as a parameterization variable for functions Why? t historically is time, certain parametric functions can describe change over time (e.g. motion of a camera, physics models) u comes from the 3D world, i.e. where two variables describe a B-spline surface u and v are the variables for defining a surface Choice of t or u depends on the text/reference 27

Parametric Curves General rep: Properties: individual functions are singlevalued approximations are done with piecewise polynomial curves Each segment is given by three cubic polynomials (x,y,z) in parameter t Concise representation 28 1994 Foley/VanDam/Finer/Huges/Phillips ICG

Cubic Parametric Curves Balance between Complexity Control Wiggles Amount of computation Non-planar 29

Parametric Curves Cubic Polynomials that define a parametric curve segment Notice we restrict the parameter t to be are of the form 30

Parametric Curves If coefficients are represented as a matrix and then: Q(t) = [ x(t) y(t) z(t) ] T = C T 31 1994 Foley/VanDam/Finer/Huges/Phillips ICG

Parametric Curves Q(t) can be defined with four constraints Rewrite the coefficient matrix C as where M is a 4x4 basis matrix, and G is a four-element constraint matrix (geometry matrix) Expanding gives: Q(t) is a weighted sum of the columns of the geometry matrix, each of which represents a point or vector in 3-space 32 1994 Foley/VanDam/Finer/Huges/Phillips ICG

Parametric Curves Multiplying out Q(t) = G x M T gives (i.e. just weighted sums of the elements) The weights are cubic polynomials in t (called the blending functions, B=MT), Q(t) = G x B M and G matrices vary by curve Hermite, Bézier, spline, etc. 33

Some Types of Curves Hermite def d by two end points and two tangent vectors Bézier two end points plus two control points for the tangent vectors Splines Basis Splines def d w/ 4 control points Uniform, nonrational B-splines Nonuniform, nonrational B-splines Nonuniform, rational B-splines (NURBS) 34

Convex Hulls The smallest convex container of a set of points Both practically and theoretically useful in a number of applications 35 Pics/Math courtesy of G. Farin @ ASU

Bézier Curves Pierre Bézier @ Rénault ~1960 Basic idea four points Start point P 0 End point P 3 Tangent at P 0, P 0 P 1 Tangent at P 3, P 2 P 3 36 Pics/Math courtesy of G. Farin @ ASU

Bézier Curves An Example: Geometry matrix is convex hull where P i are control points for the curve Basis Matrix is 37 1994 Foley/VanDam/Finer/Huges/Phillips ICG

Bézier Curves The general representation of a Bézier curve is convex hull where G B - Bézier Geometry Matrix M B - Bézier Basis Matrix which is (multiplying out): 38 1994 Foley/VanDam/Finer/Huges/Phillips ICG

Bernstein Polynomials (1911) The general form for the i-th Bernstein polynomial for a degree k Bézier curve is Some properties of BPs Invariant under transformations Form a partition of unity, i.e. summing to 1 Low degree BPs can be written as high degree BPs BP derivatives are linear combo of BPs Form a basis for space of polynomials w/ deg k 39

Bernstein Polynomials For those that forget combinatorics b ik (u) = k! i!(k i)! (1 u)k i u i Note: k does not have to be 3. 40

Joining Bézier Segments: The Bernstein Polynomials Cubic Bernstein blending functions Observe: the coefficients are just rows in Pascal s triangle 41 Pics/Math courtesy of Dave Mount @ UMD-CP

Joining Bézier Segments: The Bernstein Polynomials Observe The Four Bernstein polynomials also defined by These represent the blending proportions among the control points 42 Pics/Math courtesy of Dave Mount @ UMD-CP

Joining Bézier Segments: The Bernstein Polynomials The four cubic Bernstein polynomials Observe: at t=0, only B B1 is >0 curve interpolates P1 at t=1, only B B4 is >0 curve interpolates P4 43 Pics/Math courtesy of Dave Mount @ UMD-CP

General Form of Bezier Curve k " k Q(u) = % P $ '(1 u) k i u i i+1 # i & i= 0 Control points: P 1, P 2,, P k+1 ; 0 u 1 Produces a point on curve Q at parameter value u 44

Properties of Bézier Curves k+1 control points defines a degree k curve Affine invariance Invariance under affine parameter transformations Convex hull property curve lies completely within original control polygon Endpoint interpolation Intuitive for design curve mimics the control polygon 45 Pics/Math courtesy of G. Farin @ ASU

Issues with Bézier Curves Creating complex curves may (with lots of wiggles) requires many control points potentially a very high-degree polynomial Bézier blending functions have global support over the whole curve move just one point, change whole curve Improved Idea: link (C 1 ) lots of low degree (cubic) Bézier curves end-to-end 46

Programming Assignment 1 Process command-line arguments Read in 3D control points Iterate through parameter space by du At each u value evaluate Bezier curve formula to produce a sequence of 3D points Output points by printing them to standard out as a polyline and control points as spheres in Open Inventor format 47