bob@acornrc.UUCP (Bob Weissman) (12/27/86)
Can anyone point me to an algorithm which will provide the Bezier polynomial for a given circular arc? I've been unable to find such a beast in our library of books and journals. Better yet, if you know of a more general conic section-to-Bezier algorithm... -- Bob Weissman UUCP: ...!{ ames | decwrl | oliveb }!acornrc!bob ARPA: bob%acornrc.UUCP@AMES.ARPA
thomas@utah-gr.UUCP (Spencer W. Thomas) (12/29/86)
First, you can't reproduce a conic section exactly with a normal Bezier curve. If, however, you are willing to use a rational representation, you can. The rational representation gives each control point a weight; the easiest way to do this is to use homogeneous coordinates. E.g., if your (2-D homogeneous) control points are ( x_i, y_i, h_i ), then the x coordinate of the resulting curve would be x(t) = sum_i( x_i * B_i(t) ) / sum_i( h_i * B_i(t) ) Given this representation, it is easy to construct an arbitrary conic. A common conic construction method starts with three points, A, B, and C, and a parameter l. The curve starts at A, tangent to the line AB, and ends at C, tangent to the line BC. It passes through a point on the line segment connecting B to the midpoint of AC determined by the parameter l. Mathematically, define D = (A + C) / 2 E = l * B + (1 - l) * D The curve passes through the point E. The shape of the curve is determined by the parameter l as follows: 0.5 < l < 1 hyperbola 0.5 = l parabola 0 < l < 0.5 ellipse To construct a rational Bezier curve for this conic, set the weights for A and C to 1, and for B to w = l / (1 - l). Thus, if B has the Euclidean coordinates (b_x, b_y), it will be (b_x * w, b_y * w, w) as a homogeneous point. To make a circular arc, you want |AB| = |BC| and set w to the cosine of half the angle between AB and BC. (Take the dot product of the vector AB with (AB + BC) / 2 and divide by the lengths of these two vectors.) Note that you cannot get a uniform (or arclength) parametrization of the circle, since this would amount to writing sine and cosine as rational polynomials (clearly impossible). For a 90 degree arc, this Bezier curve differs from an arclength parametrization by at most about 5%. (However, the curve as a whole does exactly reproduce the circular arc.) Here is an example. To make a 30 degree circular arc of unit radius, centered at the origin, counterclockwise from the point (1,0): A = (1,0) C = (sqrt(3)/2, 1/2) B is at the intersection of the tangents at A and C B = (1, tan(15deg)) The half angle is 15 degrees, so w = cos(15deg) Thus, we have, finally P_0 = (1, 0, 1) P_1 = (cos(15), sin(15), cos(15)) P_2 = (sqrt(3)/2, 1/2, 1) and the curve is c(t) = P_0*B_0(t) + P_1*B_1(t) + P_2 * B_2(t) -- =Spencer ({ihnp4,decvax}!utah-cs!thomas, thomas@cs.utah.edu)
webber@topaz.RUTGERS.EDU (Webber) (01/02/87)
In article <252@acornrc.UUCP>, bob@acornrc.UUCP (Bob Weissman) writes: > Can anyone point me to an algorithm which will provide the Bezier > polynomial for a given circular arc? > ... > Better yet, if you know of a more general conic section-to-Bezier > algorithm... actually, this is discussed in: Geometric Modeling by Michael E. Mortenson (John Wiley & Sons 1985). the basic technique is to generate a cubic that passes through an intermediate point C on the conic as well as the endpoints A and B. at the endpoints, the unit tangent of the conic and parametric cubic will also agree. as stated by an earlier respondant, using parametric cubics one can only approximate the conic, but the results here seem promising (although there is no prove that this is an optimal approximation). construction: let A and B be endpoints of the conic segment. let the tangent at A lie on the line AD and the tangent at B lie on the line BD. let E be the midpoint of the line segment AB. let F be the place where DE intersects the conic. the ratio of the length of EF to the length of DE is rho ("r" since my terminal knows no greek). if r < .5 then segment is an ellipse. if r = .5 then segment is a parabola. if r > .5 then segment is hyperbola. the basis for all of this lies in techniques used for constructing conics that fall out of what is now studied as projective geometry (an interesting reference here is: A History of The Conic Sections and Quadratic Surfaces, Julian Lowell Coolidge (Dover 1968 (Oxford 1945))). the upshot of all of this is that you approximate using the cubic that passes through the points A and B and at A has the tangent of 4 times r times the vector difference D - A and a B has the tangent of 4 times r times the vector difference of B - D. in the case of a circular arc, you let r = cos(t)/(1 + cos(t)) where t is my romanized theta denoting the angle spanned by the arc. it is a simple matter to convert the above spec for a cubic into a bezier cubic (based on the principle that anything that can be accomplished in a single matrix multiplication is "simple"). the Mortenson text is also a good ref for such conversions. enjoy. -------------------- BOB (webber@red.rutgers.edu ; seismo!topaz!webber)