MA 323 Geometric Modelling Course Notes: Day 23 Rational Bezier Curves David L. Finn 23.1 Rational Bezier Curves and Rational Bezier Splines The perspective projection of a spatial Bezier curve yields a rational Bezier curve, ξ(t) = y(t)/x(t) and η(t) = z(t)/x(t), as a rational curve is defined to be curve where each component function is a rational function or a ratio of polynomials. or Pn βin (t) yi ξ(t) = Pi=0 n β n (t)xi Pni=0 in βi (t) zi η(t) = Pi=0 n n i=0 βi (t)xi where the control points in space are pi = (xi , yi , zi ). Using the perspective equivalence of (x, y, z) and (1, y/x, z/x), one can view the point p = (y/z, z/x) as a point in the image plane and λ = x as the weight of p. This means that a rational Bezier curve is described by Pn βin (t) λi pi c(t) = Pi=0 n n i=0 βi (t) λi This is an affine combination on the image plane control points {pi }, as it can be put in the form n X c(t) = αin (t) pi i=0 where β n (t) λi αin (t) = Pn i n . i=0 βi (t) λi The basis functions αin (t) sum to one, as a simple consequence of their definition, n X αin (t) = i=0 = n X β n (t) λ Pn i n i i=0 βi (t) λi i=0 Pn Pi=0 n i=0 =1 βin (t) λi βin (t) λi 23-2 using the common denominator of all the basis functions αin (t). The majority of properties of Bezier curves still hold for rational Bezier curves. In particular, rational Bezier curves have end-point interpolation, prescribed tangent lines at the endpoints, convex hull property (assuming the weights are positive), and variation diminishing property. The symmetry property (that the same curve is obtained by reversing the order of the sequence of control points) still holds also, but it is important to understand that the weights λi are associated to the projected points pi . Rational Bezier splines are created as spatial Bezier splines and then projected perspectively to a planar curve. It is important to note that in the perspective projection, lengths are not preserved so that the placement of the joint points on the image plane are not determined via the same method as in the planar case. The weights λi play a role in the placement of the joint points. In fact, one way to view the construction of a rational curve (without using the perspective projection) is to define the construction abstractly through the weights. Viewing the weights as strictly positive numbers, a higher weight means the curve gets closer to the point and smaller weights mean the curve gets from the control point. The exact nature of the combination can be viewed as an analogue of a physical calculation; calculating the center of mass of a discrete collection of particle with varying weights. The point c(t) on a rational curve is the center of mass of the points {pi } with weights βin (t) λi . Notice that the calculation is directly the same calculation. Therefore, the placement of the control points for the cubic rational curve associated to a spline depends highly on the weights of the points. 23.2 Rational Quadratic Bezier Curves as Conic Sections One of the reasons for considering rational Bezier curves as a solution to the model construction problem is because they allow one to construct any conic section. To understand why this is true, recall that a conic section is the intersection of a plane with a right circular cone. We can then choose the right-circular cone to be based at the origin and oriented in space so that image plane x = 1 cuts the cone in the desired conic section. Any curve on the cone then projects to a segment of the desired conic section, see figure below. Figure 1: Conic section via perspective projection To show that a rational quadratic Bezier curve with distinct noncollinear control points generates a conic section and in particular any desired conic section, we first note that 23-3 a quadratic Bezier curve with distinct noncollinear control points in space generates a parabola. This is because any quadratic Bezier curve with noncollinear control points in space is a plane curve and thus by our previous argument is a parabola. The three distinct noncollinear control points determine the plane for the parabola, the convex hull is then planar and the curve is planar. The projection of the parabola on the cone is then the desired conic section. !" # $ $ &% ' $ ( )* '+ Figure 2: Conic Section via Rational Bezier Curve This means that creating a circle or ellipse exactly can be accomplished by using rational Bezier curves and rational Bezier splines. In addition, circular curves and biarcs are typically constructed as rational Bezier splines. To construct a conic section by a rational quadratic Bezier curve, it is worth noting that the control points p0 and p2 can lie on the image plane have weights λ = 1. The point p1 has a weight λ 6= 1. The point p1 is located by first finding the intersection of the tangent lines of the conic at p0 and p2 on the image plane, and then determining the necessary weight to determine the conic. To create circle passing through the points p0 = (ξ0 , η0 ) and p2 = (ξ2 , η2 ) centered at the origin of the image plane. We first find the point p2 at the intersection of the tangent lines of the circle at p0 and p2 as p1 = (ξ0 + t η0 , η0 − t ξ0 ) = (ξ2 + τ η2 , η2 − τ ξ2 ) Solving these linear equations gives · ¸ η2 (ξ02 + η02 ) − η0 (ξ22 + η22 ) ξ0 (ξ22 + η22 ) − ξ2 (ξ02 + η02 ) p1 = [ξ1 , η1 ] = , . η2 ξ0 − η0 ξ2 η2 ξ0 − η0 ξ2 The quantities ξ02 +η02 and ξ22 +η22 both equal the radius of the circle. Determining the weight relies upon determining the multiplicative factor λ1 so that (λ1 , λ1 ξ1 , λ1 η1 ) lies on specific plane. This means solving another system of linear equations. The plane is geometrically determined as the one that yields the parabola. This plane is the described by the angle φ between the cone and the image plane and the line L through p0 and p1 , the plane through the line L needs to intersect the image plane at the angle φ; see diagram below. The angle φ has tan(φ) = 1/r where r is the radius of the desired circle. The equation of the plane is given by determining a point (x, y, 0) such that (x, y) lies a distance r from the line through (ξ0 , η0 ) and (ξ2 , η2 ) on the opposite side of the origin. Such a point is given by (x, y) = (ξ0 , η0 ) + raN 23-4 f Figure 3: Plane Describing a Parabola for a Right-Circular Cone by Cross-Section where (−(η2 − η0 ), x2 − x0 ) N=p (ξ2 − ξ0 )2 + (η2 − η0 )2 and a= ξ2 η0 − ξ0 η2 |ξ2 η0 − ξ0 η2 | is the sign of the cosine of the angle between the vectors (ξ0 , η0 ) and (−(η2 − η0 ), ξ2 − xi0 ), see figure below. The plane then passes through the points (ξ0 , η0 , 1), (ξ2 , η2 , 1) and (x, y, 0). (h0 h2x2 x0) (x0,h0) (x2,h2) (x0,h0) Figure 4: The location of the point (x, y, 0) describing the plane The weight λ is then determined by solving the system of equations λ ξ1 = x + s(ξ0 − x) + t(ξ2 − x) λ η1 = y + s(η0 − y) + t(η2 − y) λ=s+t as the intersection of the line through the origin and the point (ξ1 , η1 , 1) and the plane through the points (ξ0 , η0 , 1), (ξ2 , η2 , 1) and (x, y, 0). This system is always solvable by construction. This shows that a circular arc can be represented as a rational Bezier curve. 23-5 The exact formula for the rational Bezier curve representing a circular arc is not explicitly elegant, but only involves simple algebra. The formal study of rational Bezier curves and conic sections requires more involved projective geometry. This will show that any rational quadratic Bezier curve is a conic section. The study of projective geometry is finding new applications to computer vision and geometric modelling (through the use of NURBS) and through providing a mathematical framework for modelling different perspectives and allowing one to reconstruct a scene from multiple views. We will not go any more in depth into projective geometry than we have through the use of homogeneous coordinates and the use of perspective projections. Exercises 1. Find the rational quadratic Bezier curve that circle of radius 2 centered at √ describes √ a√ the origin passing through the points (1, 3) and (− 2, 2). 2. How can you find the rational quadratic Bezier curve that describes a circle not centered at the origin? 3. How can you determine a rational quadratic Bezier curve that describes an ellipse?