Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ```cpp
- // AngelCAD
- double f(double sign, double x, double n)
- {
- double xn = pow(x,n);
- double x1n = pow(1-x,n);
- return sign*(xn/(xn+x1n) + 0.5);
- }
- shape@ main_shape()
- {
- double nv= 10;
- double n = 2;
- pos2d@[] v;
- for(double i=0 ; i<nv; i++) { v.push_back(pos2d(i/nv,f(-1,i/nv,n))); };
- for(double i=nv-1; i>=0; i--) { v.push_back(pos2d(i/nv,f(+1,i/nv,n))); };
- return linear_extrude(scale(8,1)*polygon(v),0.1);
- }
- void main()
- {
- shape@ obj = main_shape();
- obj.write_xcsg(GetInputFullPath());
- }
- ```
Add Comment
Please, Sign In to add comment