Guest User

Untitled

a guest
Jan 21st, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. ```cpp
  2. // AngelCAD
  3. double f(double sign, double x, double n)
  4. {
  5. double xn = pow(x,n);
  6. double x1n = pow(1-x,n);
  7. return sign*(xn/(xn+x1n) + 0.5);
  8. }
  9.  
  10. shape@ main_shape()
  11. {
  12. double nv= 10;
  13. double n = 2;
  14. pos2d@[] v;
  15. for(double i=0 ; i<nv; i++) { v.push_back(pos2d(i/nv,f(-1,i/nv,n))); };
  16. for(double i=nv-1; i>=0; i--) { v.push_back(pos2d(i/nv,f(+1,i/nv,n))); };
  17. return linear_extrude(scale(8,1)*polygon(v),0.1);
  18. }
  19.  
  20. void main()
  21. {
  22. shape@ obj = main_shape();
  23. obj.write_xcsg(GetInputFullPath());
  24. }
  25. ```
Add Comment
Please, Sign In to add comment