Created
April 2, 2021 07:57
-
-
Save wduminy/b8809e23878cd788c986c31ec6b5f929 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import graph3; | |
size(10cm,0); | |
currentprojection=perspective(0,100,0); | |
real h_0 = 0.357; | |
real h_1 = 0.956; | |
real w_0 = 0.7; | |
real w_1 = 0.547; | |
real t_0 = 0.367; | |
real t_1 = 0.965; | |
real worls = 6.5; | |
triple e(triple v, real r, real beta) { | |
return cos(beta) * v + (0,0,sin(beta) * r); | |
} | |
real f(real a, real b, real alpha) { | |
return a*(1+b)^(alpha/(2pi)); | |
} | |
typedef real RtoR(real); | |
typedef triple RtoR3(real); | |
RtoR3 xy(RtoR f) { | |
return new triple(real p) { return (cos(p),-sin(p),0)*f(p); }; | |
} | |
triple s(RtoR h, RtoR3 v, RtoR t, real alpha, real beta) { | |
return (0,0,h(alpha)) + e(v(alpha),t(alpha),beta); | |
} | |
RtoR l_f(real a, real b, real m=1) { | |
return new real(real alpha) {return f(a,b,alpha)*m;}; | |
} | |
RtoR l_h() { return l_f(h_0,h_1,-1);} | |
RtoR3 l_v() { return xy(l_f(w_0,w_1));} | |
RtoR l_t() { return l_f(t_0,t_1,0.5);} | |
triple shell(pair t) { | |
return s(l_h(),l_v(),l_t(),t.x,t.y); | |
} | |
surface s=surface(shell,(0.01,-pi/2),(2pi*worls,pi/2),50,8,Spline); | |
draw(s,rgb(0.6,0.6,0.7)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment