Professional Documents
Culture Documents
AIM-To calculate and draw a Bezier curve passing through four control
points. AIM-To draw a B-Spline curve.
To calculate and draw a Bezier curve passing through four control points.
}
To draw a B-Spline curve.
val=((stpos-knot[i])*basis(i,k-1,knot,stpos))/(knot[i+k-1]-knot[i])+((knot[i+k]-stpos)*basis(i+1,k-
1,knot,stpos))/(knot[i+k]-knot[i+1]);
return(val);
void main()
int gm,gd=DETECT;
TO CALCULATE AND DRAW A BEZIER CURVE PASSING THROUGH FOUR CONTROL POINTS.
#include<stdio.h>
#include<dos.h>
#include<stdlib.h>
#include<graphics
. h>
#include<math.h>
doubl
e t; int
i;
getch();
closegraph
); return;
int main()
int x[4],
y[4]; int i;
int gd = DETECT,
gm=0; initgraph(&gd,
&gm, (char*)"");
line(100,100,100,400);
printf ("Enter the x- and y-coordinates of the four control points.\n");
scanf ("%d%d",
&x[i],
y); return 0;
#include<stdio.h>
#include<dos.h>
#include<stdlib.h>
#include<graphics
. h>
#include<math.h>
if(knot[i]<=stpos&&stpos<knot[i+1])
return(1);
else
return(0
val=((stpos-knot[i])*basis(i,k-1,knot,stpos))/(knot[i+k-1]-
knot[i])+((knot[i+k]-
stpos)*basis(i+1,k-1,knot,stpos))/(knot[i+k]- knot[i+1]);
return(val);
int main()
int gm,gd=DETECT;
int xc[6]={10,80,250,400,500,550};
yc[6]={180,130,10,700,50,70};
double knot[]={0,1,2,3,4,5,6,7};
(char*)"");
int k=4,i;
double bas,stpos=knot[k-1],endpos=knot[8-
ly=yc[0];
for(;stpos<endpos;stpos+=slice)
x=y=0;
for(i=1;i<=6;i
+)
{
bas=basis(i-1,k,knot,stpos); x=x+
line(lx,ly,x,y);
lx=x; //last
point ly=y;
getch();
closegraph
); return 0;
}
RESULT:-
To calculate and draw a Bezier curve passing through four control points.
NAAC
GRADE&"BY"
ACABEMICAFFAIRS
Disro•er. Lea rn. Empower.
ACCREDITED UNIVERSITY
TO DRAW A B-SPLINE CURVE:-
4. Learning outcomes (What I have learnt):
4. Learned about calculate and draw a Bezier curve and To draw a B-Spline curve.
Evaluation Grid (To be created as per the SOP and Assessment guidelines by the faculty):
Sr. No. Parameters Marks Obtained Maximum Marks
1.
2.
3.