Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS559 – Curves Lecture These are course notes (not used as slides) Written by Mike Gleicher, Oct. 2005 Updates Oct 2006, 2007 Updates Oct 2008 © 2005 Michael.

Similar presentations


Presentation on theme: "CS559 – Curves Lecture These are course notes (not used as slides) Written by Mike Gleicher, Oct. 2005 Updates Oct 2006, 2007 Updates Oct 2008 © 2005 Michael."— Presentation transcript:

1 CS559 – Curves Lecture These are course notes (not used as slides) Written by Mike Gleicher, Oct. 2005 Updates Oct 2006, 2007 Updates Oct 2008 © 2005 Michael L. Gleicher

2 Shape Modeling Creating Mathematical Descriptions of Shape Why? –Drawing, Sample, Analyze Why is this hard –Shapes can be arbitrary and complex – hard to describe –Conflicting goals Concise Intuitive Expressive Analyzable …

3 What is a Shape Mathematical definition is elusive Set of Points –Potentially (usually) infinite “Lives” in some bigger space (e.g. 2D or 3D) Many ways to describe sets –Set inclusion test (implicit representation) –Procedural for generating elements of the set –Explicit mapping from a known set

4 Some kinds of Shapes Curves –1D Objects, like what you draw with a pen Surfaces / Areas –2D Objects – the insides of 2D things –Bounded by a Curve Solids / Volumes –3D Objects – the insides of things that take up volume –Different definition: set with the same dimension as the embedded space (an area of 2D)

5 Curves Intuitively, something you can draw with a pen –Not filled areas –Mathematical oddity: space filling curves Requires infinite lengths, … Almost every point has 2 “neighbors” Locally equivalent to a line

6 Defining Curves Two different mathematical definitions 1.The continuous image of some interval 2.A continuous map from a one-dimensional space to an n-dimensional space Both definitions imply a mapping –From a line segment (which is a curve) #1 is a set of points, #2 is the mapping

7 Describing Curves Some curves have names –Line, line segment, ellipse, parabola, circular arc Some set of parameters to specify –Radius of an arc, endpoints of a line, … Other curves do not have distinct names –Need a Free Form representation

8 Local vs. Global Properties Local – what can you tell at a point –Position, Direction (tangent) Global – need to look at the whole curve –Closed, consistent Tangent vector – direction of motion First derivative w.r.t. “time” (or parameter)

9 Curve Represenations Implicit –Function to test set membership –F(x,y) = 0 Explicit / Parametric –Y = f(x) –(x,y) = f(t) – where t is a free parameter Need to define a range for the parameter Procedural –Some other process for generating points in the set By definition, a curve has at least 1 parametric representation

10 Parameterizations For any curve (set of points) there may be many mappings from a segment of the reals Consider: line from 0,0 -> 1,1 –(x,y) = (t,t) t in [0,1] –(x,y) = (.5t,.5t) t in [0,2] –(x,y) = (t^2,t^2) t in [0,1] Many ways to represent a curve Are they the “same” (same set of points, diff parameterizations – so depends on defn of curve)

11 Free Parameters Not really a property of the curve –Many different parameterizations Think of it as time in the pen analogy –Parameterization says “where is pen at time T” –Many different ways to trace out the same curve have different timings Can “reparameterize” a curve –Same curve, different parameterization –Add a function f(t) -> f(g(t)) g 2 R->R

12 Some nice Parameterizations Unit Parameterization –Parameter goes from 0 to 1 –No need to remember what the range is! Arc-Length Parameterization –Constant magnitude of 1 st derivative –Constant rate of free parameter change = constant velocity –Arc-length parameterizations are tricky

13 How do we define functions? Simple shapes: easy Complex shapes, divide and conquer –Break into small pieces, each an easy piece –Approximate if needed Add more pieces to get better approximations –Need to make sure pieces connect Typically, pick simple, uniform pieces –Line segments, polynomials, … Order vs. degree of polynomials

14 Why not just interpolate Smooth curve through points has to overshoot Get better control by having points influence shape (not specify) Approximating curves Interpolation is useful sometimes Interpolating polynomials (n-1 degree to interpolate N points)

15 Approximating Curves Interpolation isn’t the only way to describe a curve Give points that “influence” a curve Why? –Better control of what happens in between points 2 important cases for computer graphics –Bezier –B-Spline

16 Bezier Segments Curve is made of many segments –Nomenclature issue Each segment is a polynomial –Of any degree –3 is most common in computer graphics

17 Corner Cutting Algorithm Subdivision: break piece into 2

18 De Casteljau Algorithm Evaluate curve at u –Divide line segments –U of the way Can use to subdivide curves Repeated linear interpolation for ANY degree!

19 Decastlejau to Bernstein Apply geometric construction to derive equations Different groups came at this differently Algebraic vs. Subdivision

20 Derivatives of the Bezier Curve F(u)=(1-u)^2 P1 + 2u (1-u) P2 + u^2 P3 F’(u) = (-2-2u) P1 + (2-4u) P2 + 2u P3 F’(0) = 2 (P2-P1) F’(1) = 2 (P3-P2)

21 Higher Order Beziers Successive Linear interpolation (to find point) –Pyramid Use points to divide curve

22 General Bezier Blending Functions Blending functions = b i (u) p i Need to index on n as well (number of basis functions) Bernstein Basis Polynomials

23 Properties of Bezier Curves Simple mathematical form for basis functions Good algorithms for computation –Subdivision procedure –De Casteljau algorithm –Divide and conquer because… Convex Hull Properties Variation Diminishing Symmetric Affine invariant –NOT perspective invariant

24 Putting Pieces Together

25 Parametric Values for Compound Curves Could reparameterize however we want One parameter space for all pieces Switching at various points KNOTS are the switching points –(0,.5, 1) in the case below

26 Connecting Pieces Only concerned about the knots –Assume the pieces are smooth Connection & Smoothness –Connection is a type of smoothness Derivative continuity –0 th derivative = position –1 st derivative = direction –2 nd derivative = curvature

27 Types of Continuity C(n) continuity –Derivatives up to (and including N) match –May have less meaning since parameterizations don’t mean anything (give line segment example) G(n) continuity –C(0) –Higher derivatives may differ by a scale factor –Technically – c(n) in arc-length parameters How smooth? –C(2) = smooth in graphics –Higher continuity in design (boat hulls, …)

28 Continuity Examples f(u) = (u,u) u in [0,1] –C(inf) – not discontinuities in range f(u) = (u,0) 0<=u<.5, (.5,u).5<=u<=1 –Disconnected (not C(0)) – might not even call it a curve! f(u) = (u,0) 0<=u<.5, (.5,u-.5).5<=u<=1 –C(0), but not C(1) (or G(1)) f(u) = (u,0) 0<=u<.5, (2*u-.5,0) –C(0), G(1), but not C(1) Since parameterizations aren’t seen, G(n) is more visible, but C(n) is more

29 What kinds of pieces? Line segments Low-order polynomials –Quadrics (degree 2) –Cubics (degree 3) –Quartics, quintics, … Cubics are most popular in graphics –Best balance One polynomial per dimension –Or, coefficients are vectors (but free parameter is scalar)

30 What to control Control points –Where a curve goes (at a particular parameter value) –Derivaive (at a particular parameter value) –Interpolation vs. influence Specify values at a site Specify line segment –End points –Center and one end –Center and offset to end –Center, length, orientation (non-linear change)

31 Line segments Endpoints p 1 and p 2 – p = (1-u) p 1 + u p 2 Blending functions – p = b 1 (u) p 1 + b 2 (u) p 2 –Convenient way to describe functions (including polynomials) –Basis functions (scalar functions)

32 Blending (or Basis) Functions Multiplied by each point (special for each point) –p = b 1 (u) p 1 + b 2 (u) p 2 + … Common Case (only one for us) Linear blend of basis functions –Basis functions may be non-linear Blending functions are scalars –Points are in N-dimensions –Basically independent functions per axis Cyclic nature of blending functions –Each one is shift of the other

33 Line Segment Bases Could choose different controls for line segment –Whatever was convenient Find conversions between different representations

34 Cubics Different than book: explain cubic forms first, derive them second (or maybe not at all) Canonical form for polynomial – f(u) =  a i u i –Vector a of coefficients Polynomial coefficients not very convenient – a 3 u 3 + a 2 u 2 + a 1 u + a 0 One polynomial per dimenstion

35 Different ways to describe a cubic Positions of 4 points – u = 0, 1/3, 2/3, 1 –Easy for 1 segment, hard to make connections Position & derivative at beginning and end –Hermite form – is interpolation!

36 More ways to describe cubics Natural Cubics –“smoothest” curve –C(2) Each piece: – u=0: position, 1 st derivative, 2 nd derivative – u=1: position Piece 2 looks at values of previous piece (at end) –Propagation Non-local control (change at beginning changes everything)

37 4 Desirable Properties of Curves Interpolating C(2) Local-Control Cubic You can have any 3, but not all 4 –Not C(2) = Hermite, Catmull-Rom –Not Local Control = Natural Cubics –Not Cubic = higher degree hermite –Not Interpolating = wait until next lectures (bezier, b- splines)

38 Cardinal Cubics Catmull-Rom Splines Interpolate points Each segment interpolates p_1 and p_2 – u=0, p_1 – derivative is k (p_2 – p_0) – u=1, p_2 – derivative is k (p_3 – p_1) –K = ½ for Catmull-Rom

39 Cardinal Interpolation k = ½ (1-t) t = tension (0 for Catmull-Rom)

40 TCB curves Give control at each point over how derivatives are computed Tension (scaling of derivatives) Bias (are the sides the same) Continuity (two vectors might not be the same) Gives control to artist Generally used for animation parameters (not shape)


Download ppt "CS559 – Curves Lecture These are course notes (not used as slides) Written by Mike Gleicher, Oct. 2005 Updates Oct 2006, 2007 Updates Oct 2008 © 2005 Michael."

Similar presentations


Ads by Google