Computer Graphics
- Splines -
Computer Graphics - Splines - Philipp Slusallek Curves Curve - - PowerPoint PPT Presentation
Computer Graphics - Splines - Philipp Slusallek Curves Curve descriptions Explicit functions restricted domain (x [-1, 1]) y(x)= sqrt(r 2 - x 2 ), Implicit functions x 2 + y 2 = r 2 unknown solution set Parametric
– Explicit functions
restricted domain (x [-1, 1])
– Implicit functions
unknown solution set
– Parametric functions
– Avoids complicated functions (z.B. pow, exp, sin, sqrt) – Use simple polynomials, typically of low degree
– 3D: f(t)= (x(t), y(t), z(t))
– Simple basis: 1, t, t2, ... (t usually in [0 .. 1])
– Coefficients can be determined from a sufficient number of constraints (e.g. interpolation of given points)
𝑄(𝑢) = 𝑦(𝑢) 𝑧(𝑢) 𝑨(𝑢) =
𝑗=0 𝑜
𝑢𝑗𝐵𝑗 Monomials Degree (= Order – 1) Coefficients R3 𝑄(𝑢) = 𝑦(𝑢) 𝑧(𝑢) 𝑨(𝑢) = 𝑈(𝑢) 𝐵
– Polynomial of degree (n-1)
– C0 = G0 = same point – Parametric continuity C1
angent vectors are identical
– Geometric continuity G1
– Similar for higher order derivatives
𝑄´(𝑢) = 𝑦´(𝑢) 𝑧´(𝑢) 𝑨´(𝑢) = 𝑈´(𝑢) 𝐵
– G0: curves are joined together at that point – G1: first derivatives are proportional at joint point
– G2: first and second derivatives are proportional
– C0: curves are joined – C1: first derivative equal – C2: first and second derivatives are equal.
– Cn: all derivatives up to and including the nth are equal.
2 3 4 1 1
1 2 3 4 1 y2 y3 T(t)
– Lagrange polynomials for a set of parameter values T={t0, ..., tn}
– Good for interpolation at given parameter values
– Polynomial of degree n (n factors linear in t)
– Use Lagrange Polynomials with point coefficients
Li
n t = ෑ 𝑘=0 𝑗≠𝑘 𝑜
𝑢 − 𝑢𝑘 𝑢𝑗 − 𝑢𝑘 , with 𝑀𝑗
𝑜(𝑢𝑘) = 𝜀𝑗𝑘 = ቊ1
𝑗 = 𝑘
𝑄(𝑢) =
𝑗=0 𝑜
𝑀𝑗
𝑜(𝑢)𝑄 𝑗
– T={t0, t1}
– T={t0, t1, t2}
t0 t1 1 L01 L11 𝑀0
2(𝑢) = 𝑢 − 𝑢1
𝑢0 − 𝑢1 𝑢 − 𝑢2 𝑢0 − 𝑢2 t0 t2 1 L01 L02 t1
– Degree depends on the number of interpolation constraints – Strong overshooting for high degree (n > 7) – Problems with smooth joints – Numerically unstable – No local changes
– Standard curve and surface primitives in 3D modeling & fonts – Key frame and in-betweens in animations – Filtering and reconstruction of images
– Name for a tool in ship building
– Within computer graphics:
Segment 1 Segment 2 Segment 3 Segment 4 What Continuity ?
– Interpolation of position P and tangent P´ information for t= {0, 1} – Very easy to piece together with G1/C1 continuity – Basis functions
1 𝐼0
3
𝐼3
3
𝐼2
3
𝐼1
3
– H0 (H3) interpolates smoothly from 1 to 0 (1 to 0) – H0 and H3 have zero derivative at t= 0 and t= 1
– H1 and H2 are zero at t= 0 and t= 1
– H1 (H2) has slope 1 at t= 0 (t= 1)
– P0, P1 are positions R3 – P´0, P´1 are derivatives (tangent vectors) R3
𝑄(𝑢) = 𝑄
0𝐼0 3(𝑢) + 𝑄 0´𝐼1 3(𝑢) + 𝑄 1´𝐼2 3(𝑢) + 𝑄 1𝐼3 3(𝑢)
𝐼0
3
𝐼3
3
𝐼2
3
𝐼1
3
G1 continuity
– Two matrices must multiply to unit matrix
– Different curve representation – Start and end point – 2 point that are approximated by the curve (cubics) – P´0= 3(b1-b0) and P´1= 3(b3-b2)
– P(t)=T MH GH = T MH (MHB GB) = T (MHMHB) GB = T MB GB
𝐶0
3
𝐶
1 3
𝐶2
3
𝐶3
3
– End point interpolation – Tangents explicitly specified – Smooth joints are simple
– Geometric meaning of control points – Affine invariance
Bi(t) = 1
– Convex hull property
– Symmetry: Bi(t) = Bn-i(1-t)
– Smooth joints need to be maintained explicitly
– Simple but expensive
– Recursive definition of the basis functions – Inserting this once yields: – with the new Bézier points given by the recursion
𝐶𝑗
𝑜(𝑢) = tB𝑗−1 𝑜−1(𝑢) + (1 − 𝑢)𝐶𝑗 𝑜−1(𝑢)
𝑄(𝑢) =
𝑗=0 𝑜
𝑐𝑗
0𝐶𝑗 𝑜(𝑢) = 𝑗=0 𝑜−1
𝑐𝑗
1(𝑢)𝐶𝑗 𝑜−1(𝑢)
𝑐𝑗
𝑙(𝑢) = tb𝑗+1 𝑙−1(𝑢) + (1 − 𝑢)𝑐𝑗 𝑙−1(𝑢) and
𝑐𝑗
0(𝑢) = 𝑐𝑗
– Recursive degree reduction of the Bezier curve by using the recursion formula for the Bernstein polynomials
– t= 0.5
𝑐𝑗
𝑙(𝑢) = tb𝑗+1 𝑙−1(𝑢) + (1 − 𝑢)𝑐𝑗 𝑙−1(𝑢)
𝑄(𝑢) =
𝑗=0 𝑜
𝑐𝑗
0𝐶𝑗 𝑜(𝑢) = 𝑗=0 𝑜−1
𝑐𝑗
1(𝑢)𝐶𝑗 𝑜−1(𝑢) = ⋯ = 𝑐𝑗 𝑜(𝑢) ⋅ 1
– Take boundaries of the deCasteljau triangle as new control points for left/right portion of the curve
– Backwards subdivision
– Smooth (C1)-joints between (cubic) spline segments
– Tangents given by neighboring points Pi-1 Pi+1 – Construct (cubic) Hermite segments
– Arbitrary number of control points – Interpolation without overshooting – Local control
– Piecewise polynomial curve – Four control points per segment – For n control points we obtain (n-3) polynomial segments
– Smooth interpolation of a given sequence of points – Key frame animation, camera movement, etc. – Only G1-continuity – Control points should be equidistant in time
__
– Often only the control points are given – How to obtain a suitable parameterization ti ?
– Arbitrary up to a constant factor
– Distances are not affine invariant ! – Shape of curves changes under transformations !!
– Analog: Think P(t) as a moving object with mass that may
Uniform Chord-Length
– P: R2 → R3 – P(u,v) = (x(u,v), y(u,v), z(u,v))T R3 (also P(R4))
– Triangular Splines
coordinates with respect to a reference triangle (e.g. B-Patches)
– Tensor Product Surfaces
– Subdivision Surfaces
– Depending on local neighborhood
– Create a “curve of curves"
– Two lines in space – Connected by lines – Bézier representation (symmetric in u and v) – Control mesh Pij
𝑄(𝑣, 𝑤) = (1 − 𝑣)𝑄1(𝑤) + 𝑣𝑄2(𝑤) = (1 − 𝑣)((1 − 𝑤)𝑄
00 + 𝑤𝑄 10) + 𝑣((1 − 𝑤)𝑄 01 + 𝑤𝑄 11)
P00 P01 P10 P11 u v 𝑄1(𝑤) = (1 − 𝑤)𝑄
00 + 𝑤𝑄 10
𝑄2(𝑤) = (1 − 𝑤)𝑄
01 + 𝑤𝑄 11
– Arbitrary basis functions in u and v
ensor Product of the function space in u and v
– Commonly same basis functions and same degree in u and v
– Curve defined by curves – Symmetric in u and v
𝑄(𝑣, 𝑤) =
𝑗=0 𝑛
𝑘=0 𝑜
𝐶𝑗
𝑛(𝑣)𝐶 𝑘 𝑜(𝑤)𝑄 𝑗𝑘
𝑄(𝑣, 𝑤) =
𝑗=0 𝑛
𝐶𝑗
´(𝑣) 𝑘=0 𝑜
𝐶
𝑘(𝑤)𝑄 𝑗𝑘 𝑄𝑗
´(𝑤)
– Geometry now in a „tensor“ (m x n x 3) – Degree
m
n
m+n – Not nice → „Triangular Splines“
– Surface interpolates corner vertices of mesh – Vertices at edges of mesh define boundary curves – Convex hull property holds – Simple computation of derivatives – Direct neighbors of corners vertices define tangent plane
– http://www.holmes3d.net/graphics/teapot/
– Once for u in each column – Once for v in the resulting row – Due to symmetry also in other order
– Subdivision – Extrapolation – Display – ...
– Tessellate into many triangles (using deCasteljau or deBoor)
– Recursive subdivision
– Bézier Clipping [Sederberg et al.]
➔ Root finding ➔ Can eliminate parts of the surface where convex hull does not intersect ray
– Spline: R3 → R
– Spline: R3 → R3