返回列表 发帖

锥形螺旋[Conical Helix]

sample1.jpg
2012-10-15 16:47



  1. //锥形螺旋[Conical Helix]
  2. double dTSt = 0.0;
  3. double dTEd = 10*PI;
  4. double dTol = 0.01;
  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 z= t/(2*PI*c);
  11. double x= a* (t/(2*PI*c))*sin(t);
  12. double y= a* (t/(2*PI*c))*cos(t);
  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. }
复制代码

返回列表