Modelisation • Points – Defined by 2D or 3D coordinates Curves • Lines – Defined by a set of 2 points • Polygons – Defined by a set of lines – Defined by a list of ordered points Department of Computer Science Department of Computer Science November 2001 – Céline Loscos November 2001 – Céline Loscos What if you want to have curves? First Solution • Curves are often describe with an analytic • Refine the number of points equation – Can become extremely complex! • It’s different from the discreet description of – How do we interpolate? polygons • How do you deal with it in Computer Graphics? Department of Computer Science Department of Computer Science November 2001 – Céline Loscos November 2001 – Céline Loscos And for more complex curves? Interpolation • Can I approximate this with polygons? How to interpolate between points? Which one corresponds to what we want? Department of Computer Science Department of Computer Science November 2001 – Céline Loscos November 2001 – Céline Loscos 1
Math background Interpolation • Polynomials • On affine maps – Something like – For t in [t 1 ,t 2 ] a 0 + a 1 t + a 2 t 2 + a 3 t 3 + … + a n t n t 2 - t t - t 1 t = t 1 + t 2 • Affine map t 2 – t 1 t 2 – t 1 – Something like t 2 - t t - t 1 f(t) = a + bt f(t) = f(t 1 ) + f(t 2 ) t 2 – t 1 t 2 – t 1 Department of Computer Science Department of Computer Science November 2001 – Céline Loscos November 2001 – Céline Loscos Parameterised line segment Multi-Affine maps • Something like t between [0,1] f(t 1 ,t 2 ) = c 0 + c 1 t 1 +c 2 t 2 + c 3 t 1 t 2 P(t) = P 0 (1-t) + t P 1 • Properties – Affine separately on each of its arguments – Symmetry when any permutation of the arguments results in the same value P(t) f(t 1 ,t 2 ) = f(t 2 ,t 1 ) P 1 – Diagonal when all arguments have the same value P 0 f(t,t) = c 0 + A t + B t 2 Department of Computer Science Department of Computer Science November 2001 – Céline Loscos November 2001 – Céline Loscos Blossoming theorem Interpolation • There is a strong connection between multi-affine • Recall interpolation on affine maps maps and polynomials t 2 - t t - t 1 f(t) = f(t 1 ) + f(t 2 ) • Every n-argument multi-affine map has a unique t 2 – t 1 t 2 – t 1 nth degree polynomial as its diagonal • Consider t ∈ [r,s] • Every nth degree polynomial corresponds to a s - t t - r f(r,t) = f(r,r) + f(r,s) unique symmetric n-argument multi-affine map, s – r s – r that has this polynomial as its diagonal s - t t - r f(t,s) = f(r,s) + f(s,s) • The multi-affine map is called blossom (or polar s – r s – r form) s - t t - r f(t,t) = f(r,t) + f(s,t) s – r s – r Department of Computer Science Department of Computer Science November 2001 – Céline Loscos November 2001 – Céline Loscos 2
De Casteljau triangles Can be extend to degree n • Solution for f(t,t) • Solution for f(t,t,t) f(r,r,r) f(r,r,s) f(r,s,s) f(s,s,s) f(r,r) f(r,s) f(s,s) f(r,r,t) f(r,t,s) f(t,s,s) f(r,t) f(t,s) f(r,t,t) f(s,t,t) f(t,t) f(t,t,t) Department of Computer Science Department of Computer Science November 2001 – Céline Loscos November 2001 – Céline Loscos Bézier curves Three control points f(t1,t2) = (x(t1,t2), y(t1,t2)) • p 0 , p 1 , p 2 Given 3 points: f(r,s) f(s,t) p 1 p 0 = f(r,r) p 1 = f(r,s) p 2 = f(s,s) p 2 f(s,s) f(t,t) Interpolation by f(t,t) for any value of t. f(r,t) All points given by f(t,t) will lie on a curve (2 nd degree Bézier curve) f(r,r) p 0 Department of Computer Science Department of Computer Science November 2001 – Céline Loscos November 2001 – Céline Loscos With four control points Properties for f(t,t,t) • p 0 , p 1 , p 2 , p 3 • End-points p 0 = P(r) and p 3 = P(S) • Invariance of shape when change on the f(r,r,s) f(r,t,s) p 1 p 2 parametric interval (affine transformation) f(r,s,s) f(r,t,t) f(s,t,t) • Convex hull given by the control points f(t,t,t) f(t,s,s) f(r,r,t) • An affine transformation of the control points is the same as an affine transformation of any points of the curve p 0 p 3 f(s,s,s) f(r,r,r) Department of Computer Science Department of Computer Science November 2001 – Céline Loscos November 2001 – Céline Loscos 3
Properties for f(t,t,t) Other way of seeing a Bézier curve • If the control points are on a straight line, • We drive the position on a curve using a the Bezier curve is a straight line parameter u (for 2D or 3D): • The tangent vector of the curve at end Q (u) = ( x(u), y(u) ) points are (for t=0 and t=1) y – P’(r) = 3(p 1 -p 0 ) – P’(s) = 3(p 3 -p 2 ) u=1 u=0 x Department of Computer Science Department of Computer Science November 2001 – Céline Loscos November 2001 – Céline Loscos Four control points and [0,1] Bézier Basis • If we restrict t between [0,1]: • b 0 (u) = (1-u) 3 p 1 p 2 f(t,t,t) = (1-t) 3 f(0,0,0) + 3t(1-t) 2 f(0,0,1) + • b 1 (u) = 3 u (1-u) 2 • b 2 (u) = 3 u 2 (1-u) 3(1-t)t 2 f(0,1,1) + t 3 f(1,1,1) • Which can be re-written in a more general • b 3 (u) = u 3 p 0 p 3 case: Q(u) = ( x(u), y(u) ) = Σ P i B i (u) p 0 -1 3 –3 1 p 1 3 -6 3 0 Where Q (u) = U M B P = [u 3 u 2 u 1] n! n p 2 -3 3 0 0 n u i (1-u) n-i = B i (u) = p 3 i!(n-i)! 1 0 0 0 i i Department of Computer Science Department of Computer Science November 2001 – Céline Loscos November 2001 – Céline Loscos Joining Bézier curves • Better to join curves than raise the number of controls points – Avoid numerical instability – Local control of the overall shape C 1 C 0 Department of Computer Science November 2001 – Céline Loscos 4
Recommend
More recommend