1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | #include<iostream.h> #include<graphics.h> #include<conio.h> #include<stdio.h> struct point { int x,y; }; void hermite(point p1,point p4,double r1,double r4) { float x,y,t; for(t=0.0;t<=1.0;t+=.001) { x=(2*t*t*t-3*t*t+1)*p1.x+(-2*t*t*t+3*t*t)*p4.x+(t*t*t-2*t*t+t)*r1+(t*t*t-t*t)*r4; y=(2*t*t*t-3*t*t+1)*p1.y+(-2*t*t*t+3*t*t)*p4.y+(t*t*t-2*t*t+1)*r1+(t*t*t-t*t)*r4; putpixel(x,y,YELLOW); } } int main() { int gd=DETECT,gm; double r1,r4; initgraph(&gd,&gm,"..//BGI"); point p1,p2; printf("Enter 2 hermite points:\n"); scanf("%d%d%d%d",&p1.x,&p1.y,&p2.x,&p2.y); printf("Enter the tangents at p1,p4"); scanf("%d%d",&r1,&r4); cleardevice(); hermite(p1,p2,r1,r4); putpixel(x1,y1,WHITE); putpixel(x2,y2,WHITE); getch(); closegraph(); return 0; } |
Description :
This is the one stop educational site for all Electronic and Computer students. If you want to learn something new then we are here to help. We work on Microcontroller projects, Basic Electronics, Digital electronics, Computer projects and also in basic c/c++ programs.
#Home #Sitemap #Submit #Terms of Use
Copyright©2011 electrofriends.com All Rights Reserved
Contact:info@electrofriends.com | Powered by Dhyeya