声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 2151|回复: 0

[其他CAD] 单叶双曲面(C语言)

[复制链接]
发表于 2007-5-24 21:29 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
单叶双曲面(C语言)源代码

  1. #include <graphics.h>
  2. #include <math.h>
  3. #include <stdio.h>
  4. #define pi 3.1415926
  5. void main()
  6. {
  7. int graphdrive=DETECT,graphmode;
  8. int X[36],Y[36],x[36],y[36],i;
  9. float angle1,angle2,R1,R2,R,H;
  10. printf("Please input the radius of the ceil circle=R1(0~160):\n");
  11. scanf("%f",&R1);
  12. printf("Please input the radius of the bottom circle=R2(0~160):\n");
  13. scanf("%f",&R2);
  14. printf("Please input the radius of tht throat circle=R:\n");
  15. scanf("%f",&R);
  16. if(R>R1||R>R2)
  17. {
  18. printf("Yous input is ERROR!\n");
  19. return;
  20. }
  21. printf("Please the height of the bin-surface=H:\n");
  22. scanf("%f",&H);
  23. initgraph(&graphdrive,&graphmode,"");
  24. angle2=acos(R/R1)+acos(R/R2);
  25. cleardevice();
  26. setbkcolor(9);
  27. setcolor(15);
  28. setlinestyle(CENTER_LINE,2,NORM_WIDTH);
  29. line(160,25,160,500);
  30. line(25,400,300,400);
  31. setcolor(4);
  32. setlinestyle(SOLID_LINE,0,THICK_WIDTH);
  33. line(160-R1,280,160+R1,280);
  34. line(160-R2,280-H,160+R2,280-H);
  35. circle(160,400,R1);
  36. circle(160,400,R2);
  37. circle(160,400,R);
  38. setcolor(2);
  39. setlinestyle(SOLID_LINE,0,NORM_WIDTH);
  40. i=1;
  41. do{
  42. angle1=pi/18*i;
  43. x[i]=160+(R1*cos(angle1));
  44. X[i]=160+(R2*cos(angle1+angle2));
  45. y[i]=400+(R1*sin(angle1));
  46. Y[i]=400+(R2*sin(angle1+angle2));
  47. line(x[i],y[i],X[i],Y[i]);
  48. line(x[i],280,X[i],280-H);
  49. i++;
  50. }
  51. while(i<=36);
  52. getch();
  53. closegraph();
  54. }
复制代码
未命名4.bmp
回复
分享到:

使用道具 举报

您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-5-16 04:59 , Processed in 0.067826 second(s), 21 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表