Intro to Curves Week 1, Lecture 2

Similar documents
CS 536 Computer Graphics 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 Computer Graphics I Lecture 9

Curves and Surfaces 1

3D Modeling Parametric Curves & Surfaces

Computer Graphics Curves and Surfaces. Matthias Teschner

Geometric Modeling of Curves

Curves and Surfaces Computer Graphics I Lecture 10

Sung-Eui Yoon ( 윤성의 )

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

Intro to Modeling Modeling in 3D

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

Curve and Surface Basics

Computergrafik. Matthias Zwicker. Herbst 2010

Computergrafik. Matthias Zwicker Universität Bern Herbst 2016

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

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

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

The Free-form Surface Modelling System

Computer Graphics Splines and Curves

Information Coding / Computer Graphics, ISY, LiTH. Splines

Curves and Surface I. Angel Ch.10

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

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.

Introduction to Computer Graphics

Need for Parametric Equations

3D Modeling: Surfaces

CS-184: Computer Graphics. Today

CS-184: Computer Graphics

Dgp _ lecture 2. 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

Lecture IV Bézier Curves

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

(Spline, Bezier, B-Spline)

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

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

COMPUTER AIDED ENGINEERING DESIGN (BFF2612)

Rational Bezier Curves

Splines. Connecting the Dots

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

B-Splines and NURBS Week 5, Lecture 9

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).

Objects 2: Curves & Splines Christian Miller CS Fall 2011

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

Computer Graphics I Lecture 11

CHAPTER 1 Graphics Systems and Models 3

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

GEOMETRIC TOOLS FOR COMPUTER GRAPHICS

B-spline Curves. Smoother than other curve forms

Properties of Blending Functions

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

CS770/870 Spring 2017 Ray Tracing Implementation

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

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

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

Vector Algebra Transformations. Lecture 4

Reading. Parametric surfaces. Surfaces of revolution. Mathematical surface representations. Required:

CS452/552; EE465/505. Geometry Transformations

A Practical Review of Uniform B-Splines

COMPUTER AIDED GEOMETRIC DESIGN. Thomas W. Sederberg

Parameterization. Michael S. Floater. November 10, 2011

Review of Tuesday. ECS 175 Chapter 3: Object Representation

Curves and Curved Surfaces. Adapted by FFL from CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

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

Curves & Surfaces. MIT EECS 6.837, Durand and Cutler

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

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

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

Introduction to Geometry. Computer Graphics CMU /15-662

Parameterization of triangular meshes

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 Outline Math review Introduction to 2D curves Functional representations Parametric cubic curves Introduction to Bézier curves Continuity 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 1 2 3 Affine Operations: Affine Geometry 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: 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 Linear Combinations & Dot Products A linear combinationof 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 u1v1 + u2v2 + + unvnwritten as u v 4 5 6 1

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 Projections & Angles Angle between vectors, Projection of vectors u v = u v cos(θ) Matrices and Matrix Operators A n-dimensional vector: Matrix Operations: Addition/Subtractio n Identity Multiplication Scalar Matrix Multiplication Implementation issue: Where does the index start? (0 or 1, it s up to you ) 7 8 9 Matrix Multiplication [C] = [A][B] Sum over rows & columns Recall: matrix multiplication is not commutative Identity Matrix: 1s on diagonal 0s everywhere else Matrix Determinants A single real number Computed recursively Example: ' a c$ det% = ad bc b d " & # det(a) = Uses: Find vector ortho to two other vectors Determine the plane of a polygon n j=1 A i, j ( 1) i+ j M i, j 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 ) x y z A B = a x a y a z 10 11 b x b y b z 12 2

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) = αnx n 1 dx f (x) = 5x 3 df (x) dx =15x 2 14 Partial Derivatives of Polynomials f (x, y) = αx n y m f (x, y) = αnx n 1 y m x f (x, y) = 5x 3 y 4 f (x, y) x =15x 2 y 4 15 Curves 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 Example Application: Graphic Design and Arts 16 17 Courtesy of http ://www.pilot3d.com 18 3

Example Application: Tool Path Generation Example Application: Motion Planning 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) 19 via M. Wagner @ASU 20 21 Functional Representations Functional Representations Functional Representations Implicit Functions: curves/surfaces represented as the zeros good for rep. of (n-1)d objects in nd space 2 2 2 2 Sphere example: 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 i mpli ci t polynomial functions polynomial degree: total sum of powers, 2 2 2 i.e. polynomial of degree 6: x + y + z r 2 = 0 22 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 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 4

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 curv e or surface 26 Warning, Warning, Warning: Pending Notation Abuse t and u are used interchangeably as a parameterization variable for functions Why? t historically is time, c ertai n parametric functi ons 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 Cubic Parametric Curves 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 Balance between Complexity Control Wiggles Amount of computation Non-planar 29 Cubic Polynomials that define a parametric curve segment are of the form Notice we restrict the parameter t to be 30 5

Parametric Curves Parametric Curves Parametric Curves If coefficients are represented as a matrix and then: Q(t) = [ x(t) y(t) z(t) ] T = C T 31 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 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 Splines def d by two end Basis Splines points and two def d w/ 4 control points tangent vectors Uniform, nonrational Bézier B-splines two end points plus Nonuniform, nonrational two control points for B-splines the tangent vectors Nonuniform, rational B-splines (NURBS) The smallest convex container of a set of points Both practically and theoretically useful in a number of applications Convex Hulls 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 Bézier Curves 34 35 36 6

Bézier Curves Bézier Curves Bernstein Polynomials (1911) An Example: Geometry matrix is convex hull The general representation of a Bézier curve is convex hull The general form for the i-th Bernstein polynomial for a degree k Bézier curve is where P i are control points for the curve Basis Matrix is where G B - Bézier Geometry Matrix M B - Bézier Basis Matrix which is (multiplying out): 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 37 38 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. Joining Bézier Segments: The Bernstein Polynomials Cubic Bernstein blending functions Observe: the coefficients are just rows in Pascal s triangle Joining Bézier Segments: The Bernstein Polynomials Observe The Four Bernstein polynomials also defined by These represent the blending proportions among the control points 40 41 42 7

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 General Form of Bezier Curve k " k% Q(u) = P i+1 $ '(1 u) k i u i # 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 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 8