Introduction to Computer GraphicsFarhana Bandukwala, PhDLecture 8: Cubic curvesOutline• Types of curves• Subdivision curves• Drawing curves• Curves in Open GLTypes of cubics• 4 geometric constraints per curve segment • Hermite: 2 endpoint and 2 tangent vector constraints• Bezier: 2 endpoint and 2 other points controlling endpoint tangent vector• Splines: 4 control point constraintsdP(u)/du = [dpx(u)/du, dpy(u)/du] = d/du[u3u2u 1]*C = [ 3u22u 1 0 ]*C Parametric tangent vector similar structureHermite curves• Defined by endpoints (P0& P3) and tangent vectors (R0& R3)u3u2u 1m11m12m13m14m21m22m23m24m31m32m33m34m41m42m43m44P0xP3xR0xR3xpx(0)=[0 0 0 1]*M*Gxpx(1)=[1 1 1 1]*M*Gxpx’(0)=[0 0 1 0]*M*Gxpx’(1)=[3 2 1 0]*M*GxGx=0 0 0 11 1 1 10 0 1 03 2 1 0M*GxM-1= 2 -2 1 1-3 3 -2 -10 0 1 01 0 0 0P0P3R0R3Hermite curve segments2 Hermite curves share an endpoint:• Shared endpoint (P3) • tangent vector (R3) should have same direction but not necessarily same magnitudeP0P3R0R3Curve 1 Geometry vectorP3P6kR3R6Curve 2 Geometry vectorP0P3P6R0R3R6Bezier curvesConstraints: 2 endpoints and 2 other control points which determine the tangentsR0= P’(0) = 3(P1– P0) and R3= P’(1) = 3(P3– P2)P0P1P2P3Geometry vectorP0xP3xR0xR3x=P0xP1xP2xP3xSimply concatenate above matrix to the one derived for the Hermite curve• Normalized basis functions• Curve completely contained in points’ convex hull1 0 0 00 0 0 1-3 3 0 00 0 -3 3Geometric constraints• Two curves sharing an endpoint G0• 2 segments with same tangent direction (G1)• 2 segments with same tangent direction and magnitude (C1)• 2 segments with same nthderivative (Cn)Subdividing curves• Subdivide curve to gain more control over shape• For one Bezier, subdivide into left & right such that new curve are coincident on old one.P0P1P2P3L1HL2L3= R0R1R2Curve 1&2 basis matrices8 0 0 04 4 0 02 4 2 01 3 3 11/81 3 3 10 2 4 20 0 4 40 0 0 81/8Drawing curves• Iterative evaluation: – For incremental parameter value, evaluate x,y points– Draw line segments joining the evaluated points• Recursive subdivision:– Iteratively subdivide curve until control points are close to the
View Full Document