Polylines: Piecewise linear approximation to curves Not Smooth
High degree approximation • Explicit y=f(x) • Implicit f(x,y)=0 • Parametric x=x(t), y=y(t)
Explicit Representation y = f ( x ) • • Essentially a function plot over some interval x ∈ a , b [ ] • Simple to compute and plot • Simple to check whether point lies on curve • Cannot represent closed and multi-value curves
Implicit Representation • Define curves implicitly as solution of equation system ! Straight line in 2D: ax + by + c = 0 ! Circle of radius R in 2D: x 2 + y 2 − R 2 = 0 ! Conic Section: Ax 2 + 2 Bxy + Cy 2 + 2 Dx + 2 Ey + F = 0 • Simple to check whether point lies on curve • Can represent closed and multi-value curves
Parametric Curves • Describe position on the curve by a parameter u ∈ R b ⇒ 2D Curve c ( u ) = { x ( u ), y ( u )} u e.g.,line : c ( u ) = (1 − u ) a + ub a 0 1 • Hard to check whether point lies on curve • Simple to render • Can represent closed and multi-value curves
Parametric Curves Parametric curves form a rich variety of free form smooth curves They are modeled as piecewise polynomials and have two aspects: • Interpolation • Approximation “ Splines ”
Parametric Curves Splines
Parametric Curves Cubic Splines 2 3 P ( t ) B B t B t B t t t t = + + + ≤ ≤ 1 2 3 4 1 2 4 i 1 B i t − = ∑ i 1 = 4 i 1 x ( t ) B t − = ∑ ix i 1 = 4 i 1 y ( t ) B t − = ∑ iy i 1 = 4 i 2 1 2 P ' ( t ) B ( i 1 ) t − B 2 B t 3 B t = ∑ − = + + i 2 3 4 i 1 =
Parametric Curves Cubic Splines P 2 ’ P 2 t 2 P 1 ’ Let t 1 =0 P 1 t 1 P(0)=P 1 , P(t 2 )=P 2 P'(0)=P 1 ’ , P ’ (t 2 )=P 2 ’
Parametric Curves Cubic Splines P 2 ’ P ( 0 ) B P = = 1 1 4 i 1 − P ( t ) B t = P 2 t 2 ∑ 2 i i 1 t t = = 2 1 2 3 P 1 ’ B B t B t B t P = + + + = 1 2 2 3 2 4 2 2 4 i 2 − P ' ( 0 ) B ( i 1 ) t B P ' = ∑ − = = i 2 1 i 1 = t 0 = 4 P 1 t 1 i 2 P ' ( t ) B ( i 1 ) t − = ∑ − 2 i i 1 = t t = 2 1 2 B 2 B t 3 B t P ' = + + = 2 3 2 4 2 2
Parametric Curves Cubic Splines P 2 ’ Solving for B B B and B 1 2 3 4 B P , = 1 1 P 2 t 2 ' B P , = 2 1 ' ' P 1 ’ 3(P - P ) 2P P 2 1 1 2 B - - = 3 2 t t t 2 2 2 ' ' 2(P - P ) P P 1 2 1 2 B = + + 4 3 2 2 t t t P 1 t 1 2 2 2 Here P 1 and P 2 give the position of the endpoints and P 1 ’ and P 2 ’ give the direction of the tangent vectors.
Parametric Curves Cubic Splines P 2 ’ P 2 t 2 3 ( P P ) 2 P ' P ' ⎛ ⎞ − P 1 ’ 2 2 1 1 2 P ( t ) P P ' t t ⎜ ⎟ = + + − − 1 1 ⎜ ⎟ 2 t t t ⎝ 2 2 ⎠ 2 2 ( P P ) P ' P ' ⎛ ⎞ − 3 1 2 1 2 t ⎜ ⎟ + + + P 1 t 1 ⎜ ⎟ 3 2 2 t t t ⎝ ⎠ 2 2 2 Thus, given the two end-points and the tangent vectors one can compute the cubic spline.
Parametric Curves Cubic Splines t 3 t 2 t 1 Joining of Segments 2 SEGMENTS: P 1 P 2 P 3 (Points) P 1 ’ P 2 ’ P 3 ’ (Tangents) P 2 ’ is determined through the continuity condition
Parametric Curves Cubic Splines t 3 t 2 t 1 Piecewise Spline of degree k has continuity of order (k-1) at the internal joints. Thus Cubic Splines have second order continuity i.e. P 2 ” (t) is continuous over the joint
Parametric Curves Cubic Splines t 3 4 i 3 P ' ' ( t ) ( i 1 )( i 2 ) B t − t t t = ∑ − − ≤ ≤ i 1 2 i 1 = at t t = t 2 2 First segment t 1 ' ' P 6 B t 2 B = + 4 2 3 Second segment ' ' P 2 B = 3 So , 6 B t 2 B 2 B ( ) ( ) + = 4 2 3 3 seg 1 seg 2 Substitute the expressions for B 4 and B 3
Parametric Curves Cubic Splines t 3 t 2 t 1 3 ( ) 2 2 t P ' 2 ( t t ) P ' t P ' t ( P P ) t ( P P ) + + + = − + − 3 1 3 2 2 2 3 2 3 2 3 2 1 t t 2 3 P ' ⎡ ⎤ 1 3 ( ) ⎢ ⎥ 2 2 [ t 2 ( t t ) t ] P ' t ( P P ) t ( P P ) + = − + − 3 3 2 2 2 2 3 2 3 2 1 ⎢ ⎥ t t 2 3 P ' ⎢ ⎥ ⎣ ⎦ 3
Parametric Curves Cubic Splines In general, for the k th and (k+1) th segment (1 ≤ k ≤ n-2) P ' ⎡ ⎤ k ⎢ ⎥ [ t 2 ( t t ) t ] P ' + k 2 k 1 k 2 k 1 k 1 + + + + + ⎢ ⎥ P ' ⎢ ⎥ ⎣ ⎦ k 2 + 3 ( ) 2 2 t ( P P ) t ( P P ) = − + − k 1 k 2 k 1 k 2 k 1 k + + + + + t t k 1 k 2 + + Set of n-2 equations form a linear system for the tangent vectors P k ’
Parametric Curves Cubic Splines t 2 ( t t ) t 0 … P ' + ⎡ ⎤ ⎡ ⎤ 3 2 3 2 1 ⎢ ⎥ ⎢ ⎥ 0 t 2 ( t t ) t P ' + 4 3 4 3 2 ⎢ ⎥ ⎢ ⎥ � � � � ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ … … … t 2 ( t t ) t P ' + ⎣ ⎦ ⎣ ⎦ n n n 1 n 1 n − − 3 ⎡ ⎤ ( ) 2 2 t ( P P ) t ( P P ) − + − 2 3 2 3 2 1 ⎢ ⎥ t t 2 3 ⎢ ⎥ 3 ( ) 2 2 t ( P P ) t ( P P ) ⎢ ⎥ − + − 3 4 3 4 3 2 = t t ⎢ ⎥ 3 4 � ⎢ ⎥ 3 ⎢ ⎥ ( ) ⎥ 2 2 t ( P P ) t ( P P ) − + − ⎢ n 1 n n 1 n n 1 n 2 − − − − t t ⎣ ⎦ n 1 n −
Parametric Curves Cubic Splines P ' 1 0 � � ⎡ ⎤ ⎡ ⎤ 1 ⎢ ⎥ ⎢ ⎥ t 2 ( t t ) t P ' + 3 2 3 2 2 ⎢ ⎥ ⎢ ⎥ � t 2 ( t t ) t � + ⎢ ⎥ ⎢ ⎥ 4 3 4 3 ⎢ ⎥ ⎢ ⎥ � � � � ⎢ ⎥ ⎢ ⎥ P ' t 2 ( t t ) t ⎢ + ⎥ ⎢ ⎥ n 1 n n n 1 n 1 − − − ⎢ ⎥ ⎢ ⎥ � � 0 1 P ' ⎣ ⎦ ⎣ ⎦ n P ' ⎡ ⎤ 1 3 ⎢ ⎥ ( ) 2 2 t ( P P ) t ( P P ) − + − ⎢ ⎥ 2 3 2 3 2 1 t t 2 3 ⎢ ⎥ � ⎢ ⎥ = ⎢ ⎥ ⎢ ⎥ 3 ( ) 2 2 t ( P P ) t ( P P ) ⎢ ⎥ − + − n 1 n n 1 n n 1 n 2 − − − − t t ⎢ ⎥ n 1 n − P ' ⎢ ⎥ ⎣ ⎦ n
Parametric Curves Cubic Splines Solving for B B B and B 1 2 3 4 B P , = 1k k ' B P , = 2k k ' ' 3(P - P ) 2P P k 1 k k k 1 B - - + + = 3k 2 t t t k 1 k 1 k 1 + + + ' ' 2(P - P ) P P k k 1 k k 1 B + + = + + 4k 3 2 2 t t t k 1 k 1 k 1 + + +
Parametric Curves Cubic Splines B 1 0 0 0 P ⎡ ⎤ ⎡ ⎤ ⎡ ⎤ 1 k k ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ B 0 1 0 0 P ' 2 k k ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ = 2 2 B 3 / t 2 / t 3 / t 1 / t P − − − ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ 3 k k 1 k 1 k 1 k 1 k 1 + + + + + ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ 3 2 3 2 B 2 / t 1 / t 2 / t 1 / t P ' − ⎣ ⎦ ⎣ ⎦ ⎣ ⎦ 4 k k 1 k 1 k 1 k 1 k 1 + + + + + 0 t t 4 ≤ ≤ k 1 i 1 + P ( t ) B t − = ∑ k ik 1 k n 1 ≤ ≤ − i 1 = [ ] [ T 2 3 ] 1 t t t B B B B = 1 k 2 k 3 k 4 k
Parametric Curves Cubic Splines P ( t ) k 1 0 0 0 P ⎡ ⎤ ⎡ ⎤ k ⎢ ⎥ ⎢ ⎥ 0 1 0 0 P ' [ ] k 2 3 1 t t t ⎢ ⎥ ⎢ ⎥ = 2 2 3 / t 2 / t 3 / t 1 / t P − − − ⎢ ⎥ ⎢ ⎥ k 1 k 1 k 1 k 1 k 1 + + + + + ⎢ ⎥ ⎢ ⎥ 3 2 3 2 2 / t 1 / t 2 / t 1 / t P ' − ⎣ ⎦ ⎣ ⎦ k 1 k 1 k 1 k 1 k 1 + + + + + [ 2 2 3 3 2 3 3 ( 1 3 t / t 2 t / t ) ( t 2 t / t t / t ) = − + − + k 1 k 1 k 1 k 1 + + + + ] [ T 2 2 3 3 3 3 2 ( 3 t / t 2 t / t ) ( t / t t / t ) P P ' P P ' ] − − k 1 k 1 k 1 k 1 k k k 1 k 1 + + + + + +
Parametric Curves Cubic Splines Substituting u=t/t k+1 rearranging T P ( u ) [ F ( u ) F ( u ) F ( u ) F ( u ) ] [ P P P ' P ' ] = k 1 2 3 4 k k 1 k k 1 + + 0 u 1 ≤ ≤ 1 k n 1 ≤ ≤ − 3 2 F ( u ) 2 u 3 u 1 = − + 1 3 2 F ( u ) 2 u 3 u F 1 , F 2 , F 3 , F 4 are called the = − + 2 2 Blending Functions F ( u ) u ( u 2 u 1 ) t = − + 3 k 1 + 2 F ( u ) u ( u u ) t = − 4 k 1 +
Parametric Curves Cubic Splines P k (u)=[F][G] Where F is the Blending function matrix and G Is the geometric information .
Parametric Curves Cubic Splines F 1 F 2 • F 1 (0)=1,F 2 (0)=0,F 3 (0)=0,F 4 (0)=0 1 curve passes P 1 F 3 • F 1 (1)=0,F 2 (1)=1,F 3 (1)=0,F 4 (1)=0 curve passes P 2 t=0 • F 2 =1-F 1 ,F 4 =1-F 3 t=1 F 4 • Relative magnitudes of F 1 ,F 2 > F 3 ,F 4
Parametric Curves Cubic Splines Piecewise Cubic Splines are determined by position vectors, tangent vectors and parameter value t k . The value of t k can be chosen using either Chord Length parameterization or Uniform Parameterization. If t k =1 for all k then the Spline is called Normalized Spline.
Recommend
More recommend