返回列表 发帖

抛物线螺旋[Parabolic Spiral]

sample2.jpg
2012-10-15 16:49


  1. //抛物线螺旋[Parabolic Spiral]
  2. double dTSt = 0.0;
  3. double dTEd = 10*PI;
  4. double dTol = 0.05;
  5. point ptSt, ptEd;
  6. for(double t = dTSt; t <= dTEd; t += dTol)
  7. {
  8. double a=0.5;
  9. double c=5.0;
  10. double x=a*sin(t);
  11. double y=a*cos(t);
  12. double z=pow(t,2)/pow(2*PI*c,2);
  13. if(fabs(t - dTSt) < ZERO)
  14. {
  15. ptSt = point(x, y, z);
  16. }
  17. else
  18. {
  19. ptEd = point(x, y, z);
  20. line(ptSt, ptEd);
  21. ptSt = ptEd;
  22. }
  23. }
复制代码

返回列表