200 likes | 370 Views
This Week. Short Course in: Mathematics and Analytic Geometry. Week 9 Curves. LERP – Linear Interpolation. Given two position vectors r 1 and r 2 , a linear interpolation is a straight line joining their respective points P 1 and P 2. LERP – Linear Interpolation.
E N D
Short Course in: Mathematics and Analytic Geometry Week 9Curves
LERP – Linear Interpolation • Given two position vectors r1 and r2, a linear interpolation is a straight line joining their respective points P1 and P2.
LERP – Linear Interpolation • Oh! But, hang on a minute! LERP is just the line equation defined in the interval: 0 t 1:
SLERP – Spherical Linear Interpolation • SLERP is an extension on LERP to the case of a curve interpolation on a spheroid. • In the most simplest case, we have two orthogonal unit position vectors r0 and r1 and we interpolate between 0 and π/2 radians with a parameter in the interval 0 t 1.
SLERP – Spherical Linear Interpolation • In the general case, position vectors r0 and r1 are not orthogonal and we want to interpolate between 0 and some angle .
SLERP – Spherical Linear Interpolation • The general SLERP Formula is derived as follows:
Quaternion SLERP • Instead of vectors we can plug in unit quaternion to interpolate unit quaternion at parametric angles: • Where:
Parametric Curves • Any 2D curve can be projected in 3D space onto a parametric plane:
Parametric Curves • Similarly, in polar coordinates where f() define radius length: • Or in cylindrical space (in this case, an elliptic spiral):
Bezier Curves • However, some parametric curves can be inflexible and difficult to design. • Ideally, we would like to construct curves in a predictable way from some fixed points. • We could join points with LERPs to form a piecewise curve:
Bezier Curves • But, the curve is not smooth: • Bezier curves can be constructed as a recursive system of LERPs (De Casteljau's algorithm). For example:
Bezier Curves • The general form of Bezier curves follows a binomial expansion pattern:
Inverse Bezier • Let us assume we want a cubic Bezier curve: • That interpolates points p1 and p2 at times t1 and t2 respectively (remember, the ends are fixed): • We solve for control points r1 and r2, by finding the inverse of the matrix:
Catmull-Rom Spline Using Tangents like this, curves can be joined with C1 continuity.
Cubic B-Splines • With B-Splines, continuity is always one degree lower than the degree of each curve piece. Therefore, a cubic B-Spline has continuity C2. The following curve connects pi to pi+1, for 0t 1: • Cubic B-Splines do not interpolate their end points.
Cubic B-Splines • In general, a B-Spline can be defined as follows (the ti are called knots):
Bezier Surfaces • Bezier curves can be extended to surfaces on unit squares.