1 • How do we draw curves and surfaces? • We need smooth curves and surfaces in many applications: – model real world objects – computer-aided design (CAD) – high quality fonts – data plots – artists sketches – Draw fractal lines, curves and surfaces 2 Curve Generation I • True curve DDA • Approximated Interpolation - Circular Arc Generation using DDA Algorithm - Uses differential equation of the curve x R cos( ) x 0 y R sin( ) y 0 where ( x 0 , y 0 ) is the center of curvature , and R is the radius of arc x 2 x1 dx x1 ( y 1 y 0 ) d y 2 y 1 dy y 1 ( x 2 x 0 ) d R d Min ( 0 . 01 , 1 /( 3 . 2 ( x x 0 y y 0 ))) ( x0 , y0 ) 3 Curve Generation II - Drawbacks: 1. 2. 3. 4. Need more information than endpoints. Ability to scale a picture is limited. New clipping algo is required. Complex for airplane wings, cars and human faces. - Advantage: Very smooth 4 Interpolation - Drawing curves using approximation methods Find suitable mathematical expression for the known curve (Polynomial, trigonometric and exponential) to approximate the curve 5 Spline Representation - To produce a smooth curve through a designated set of points (control points) flexible strip is used (Spline). 6 Parametric Equation • • • A (2-D) parametric curve is expressed as: – A pair of (mathematical) functions: P(t) = ( x(t), y(t) ). • In 3-D, we add a third function for z. – And an interval of legal values for t: [a,b]. t is called the parameter. Example: x(t) = t2–2t, y(t) = t–1, t in [0,3]. y t = 3 (end) (t2–2t, t–1) x t = 0 (start) 7 Bezier Curves I • French mathematician • Used to construct curves and surfaces • Determined by defining polygon • Useful for curve and surface design • Easy to implement • Available in CAD system and various graphic packages • Cubic Bezier curve is used to avoid no. of calculations • Always passes through the first and last control points • Designed curve follows the shape of the defining polygon • Invariant under an affine transformation 8 Bezier Curves II P ( u ) (1 u ) P1 3 u (1 u ) P2 3 u (1 u ) P3 u P4 3 2 2 3 Example: construct the Bezier curve of order 3 and with 4 polygon vertices A(1,1), B(2,3), C(4,3) and D(6,4). 9 2D Bezier Curves 10 3D Bezier Curves 11 Bezier Surfaces 12 Bézier Surface Properties boundary curves lie on surface boundary curves defined by boundary polygons Bézier Surface Properties Nice, intuitive method for creating surfaces Variable display resolution Minimal storage Bézier Surface Multiple patches connected smoothly Conditions on control net similar to curves … difficult to do manually