Bezier Curves and Surfaces
Bezier Curves:
Bezier curve is a spline approximation curve that can be fitted to any number of control points. The number of control points defines the degree of the Bezier Polynomial.
Suppose we have n + 1 control points ,so the degree of the Bezier Polynomial will be ‘n’.
Properties of the Bezier Curve :

It is Spline Approximation Curve. The Bezier curve id drawn near to the control points.

They are parametric Curves i.e their intermediate points can be calculated through the parametric variable.

We can get ‘n’ degree polynomial Bezier Curve with ‘n + 1’ control Points.

Bezier curves are used to draw CAD , Typeface and drawing Applications.

They are contained inside a convex hull within their defined controlled points.

A change in the one control points can alter the whole Bezier Curve.

They are easy to implement.
Derivation for the Bezier For 3 Control Points
Let parametric Curve will be
0 ≤ u ≤ 1
And Q_{0} and Q_{1} be the points Lying between
P_{0} > P_{1} and P_{1 }> P_{2} respectively.
So, the equation from both the points will be
From P_{0} > P_{1}
Q_{0} = (1u) P_{0 } + uP_{1} ……(1)
From P_{1 }> P_{2}
Q_{1} = (1u) P_{1 } + uP_{2} ……(2)
_{ }
Now , suppose C(u) is the point between Q_{0} > Q_{1}
So, the equation becomes
C(u) = (1u) Q_{0 } + uQ_{1}
Putting values of Q_{0} and Q_{1 } from equation 1 and 2 respectively ,
C(u)= (1u) [(1u)P_{0} + uP_{1} ] + u[(1u)P_{1} + uP_{2}]
=(1u)^{2}P_{0} + u(1u)P_{1} + u(1u)P_{1} + u^{2}P_{2}
=(1u)^{2}P_{0} + 2u(1u)P_{1} + u^{2}P_{2}
This is the Parametric Equation when we have 3 control points and generating a Quadratic Polynomial.
Blending Function Specification for Bezier Curve or generalized form for Bezier Curve
Suppose we have n + 1 control Points with Positions
P_{k}= (x_{k}, y_{k}, z_{k}) with k as whole number. Then the positional vector P(u) where 0 ≤ u ≤ 1 is given by
Write A Program in C++ for the Implementation Bezier Curve
//Example :P1:(0,0) // P4:(400,200) // P2:(140,100) // P3:(40,0) #include<iostream.h> #include<conio.h> #include<math.h> #include<graphics.h> struct pt { double x,y; }; void bezier(pt point[],pt control[]) { int gdriver=DETECT,gmode; initgraph(&gdriver,&gmode,"C:\\TURBOC3\\BGI"); double x,y; for(double t=0.0;t<1.0; t+=0.0005) { x=((pow((1t),3)*point[0].x)+((pow((1t),2)*control[0].x*3*t))+(3*t*t*(1t)*control[1].x)+(t*t*t*point[1].x)); y=((pow((1t),3)*point[0].y)+((pow((1t),2)*control[0].y*3*t))+(3*t*t*(1t)*control[1].y)+(t*t*t*point[1].y)); putpixel(x,y,RED); } for(int i=0;i<2;i++) { putpixel(point[i].x,point[i].y,WHITE); putpixel(control[i].x,control[i].y,WHITE); } } void main() { clrscr(); double r1,r2; pt point[2],control[2]; cout<<"Enter First End Point of Curve :"; cin>>point[0].x>>point[0].y; cout<<"Enter Second End Point of Curve :"; cin>>point[1].x>>point[1].y; cout<<"Enter First Control Point :"; cin>>control[0].x>>control[0].y; cout<<"Enter Seocnd Control Point :"; cin>>control[1].x>>control[1].y; bezier(point,control); getch(); }
Comments
No comment yet.