// 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());
}
Last active
January 11, 2018 20:27
-
-
Save arnholm/e9f44039aa389720dc63433e2a245cfa to your computer and use it in GitHub Desktop.
AngelCAD code (angelscript) - generate solid from math functions
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment