Laxkit  0.0.7.1
Math Primer
Todo:
***todo: a page for affine/rotate/shear/3x3 persp transforms

# Rolling With Bezier Lines

Say you want a cubic curve defined by two vertex points (p0 and p3) and two control points (p1 and p2). The tangent at a vertex will be proportional to the vector from the vertex point to the control point. Define the curve so that it is a function of t going from 0 to 1. Then:

If we take g=3, then we have the most common type of this sort of cubic curve. So from the above we find:

or

Note that and that .

This curve has the convenient subdividable property that with points p0 to p3, we can subdivide this so that we have 2 new segments whose points are [p0 q1 q2 q6] and [q6 q4 q5 p3]. Note also that a bezier segment will always be contained within the bouning box of the vertex and control points. More specifically, the curve will always be contained within the convex hull of those points.

# Fun With Bezier Lines

Say you want to approximate a circular arc with a cubic bezier line. For approximation purposes, the t=.5 point of the bezier curve must pass through the middle of the arc. Then for a circle of radius r and arc angle , it follows that the length of the vector connecting a vertex point and its control point is v:

# Groking Bezier Patches

where p are either the x or y coordinates of the points, depending on whether you want the x or y coordinate of P.

Todo:
*** explain where the hell that patch equation came from)

# How To Subdivide a Cubic Bezier Patch

Have the patch be defined as a funtion of and that each run from 0 to 1. You want a section of the patch as a function of and which also run from 0 to 1.

For and , make corresponding matrices:

These will be linearly related to and like this:

So , and where:

Use those plus the above equation for a patch and get points Q:

where is the plain bezier curve matrix, is the coordinate matrix of the original patch as above, and magically contains the coordinate matrix of the new patch for u and v.

Mon Feb 17 2014 11:52:57, Laxkit