|
|
Greg M. Johnson wrote:
> I'm trying to figure out exactly what the math is behind the control
> points.
A short introduction to the formulas behind cubic bezier curves is at
<http://moshplant.com/direct-or/bezier/math.html>. You'll probably find
the ones for cubic bezier patches somewhere too, but it'll probably help
understanding the curves first.
> I made a circle of four points in Hamapath with radius 0.5. I then
> extruded it one unit. I think I understand all of the math except the
> control points. Does anyone understand the math to get a control point
> that suggests a circle? What's the formula in terms of pi and r? I'm
> trying to figure out what the 0.273 means, also a way to generate it to
> more significant digits. I'm guessing it's like
> pi*r*some_constant_I_cannot_fathom.
That number comes out of the solution to the problem "How to approximate a
quarter-circle by a cubic bezier curve". You cannot represent a circular
arc exactly by a cubic bezier curve, but you can approximate it
very closely, sufficient for most purposes.
I solved that problem numerically one day. The exact formulation is: find
h such that the cubic bezier curve given by the points <1, 0>, <1, h>, <h,
1>, <0, 1> most closely approximates a quarter circle.
If you want to minimize the integral along the curve of the square of the
difference between the radius (distance to the origin) of the bezier curve
and the real circle radius (1), the solution is h = 0.551967589. In that
case, the radius difference is between -1.682e-4 and 2.059e-4. The curve
is inside of the circle about in the middle third and outside in the first
and last.
If you want the whole curve to lie outside of the circle, you have to take
h = 4/3*(sqrt(2) - 1) = 0.552284750. Then, the radius difference is
between 0 and 2.725e-4.
If you want the whole curve to lie inside the circle, take h = (sqrt(7) -
1)/3 = 0.548583770. In that case, the radius difference is between
-1.963e-3 and 0.
So, your 0.273 is some bad approximation of r*h for your radius r = 0.5.
If you're interested, I can give you the Matlab file I used for the
numeric optimization. I don't remember how I got the exact results
(with sqrts etc.), probably I used my TI-92 calculator there.
Hope that helps
-Christian
Post a reply to this message
|
|