4 restricted surface unitsolidcylinder = surface(unitcylinder,
8 surface torus(real R, real a, real theta1, real theta2)
10 //return surface(revolution(reverse(Circle(R*X,a,Y,32)),Z,90,345));
13 return ((R+a*cos(t.y))*cos(t.x),(R+a*cos(t.y))*sin(t.x),a*sin(t.y));
16 surface s = surface(f, (radians(theta1),0), (radians(theta2),2pi), 8, 8, Spline);
21 surface carrow(real radius, real a,
22 real theta1, real theta2, int direction)
26 s.append(torus(radius, a, theta1, theta2));
29 s.append( rotate(theta1, Z) * shift(radius, 0, 0) * rotate(90., X) * scale(2*a, 2*a, 6*a) * unitsolidcone );
31 s.append( rotate(theta2, Z) * shift(radius, 0, 0) * rotate(-90., X) * scale(2*a, 2*a, 6*a) * unitsolidcone );
36 surface tpp(real height, real radius)
38 // put the centre of the top surface of the cube at the origin
39 surface s=shift(-0.5, -0.5, -1) * unitcube;
40 s = shift(0, 0, -height) * scale(3*radius, 3*radius, radius/5) * s;
44 surface _support(real hight, real radius, int arrow1, int arrow2, bool draw_cylinder=false)
48 real dx = alpha * radius;
49 real dz = radius * sqrt(alpha * (2-alpha));
51 // becarefulle reference of the unitsolidcylinder and the unitcube are not
52 // at the same place, so me must take this into account.
54 s.append( shift(0, 0, -hight) * scale(radius, radius, radius/5) * unitsolidcylinder );
55 s.append( shift(-dz, -radius+dx, -hight) * scale(2*dz, dx, hight) * unitcube );
56 s.append( shift(0, -radius+2*dx, 0) * rotate(90, X) * scale(dz, dz, dx) * unitsolidcylinder );
59 s.append( shift(0, -radius+1.5*dx, 0) * rotate(90, X) * carrow(1.3 * dz, 0.5, 0., 90., arrow1) );
62 s.append( shift(0, 0, -hight+radius/5+.5) * carrow(.8*radius, .5, 0, 90, arrow2) );
67 surface detector_arm(real length, real radius, int arrow1)
71 real dx = alpha * radius;
72 real dz = radius*sqrt(alpha*(2-alpha));
74 s.append( shift(-dz, -radius+dx+.1, -dz) * scale(length+dz, dx, 2*dz) * unitcube );
75 s.append( shift(length, -radius+dx+.2, -dz) * scale(-dx, radius-dx-.2, 2*dz) * unitcube );
76 s.append( shift(length-dx, 0, 0) * rotate(90, Y) * scale(dz, dz, dx) * unitsolidcylinder );
79 s.append( shift(0, -radius+1.5dx,0) * rotate(90, X) * carrow(1.3 * dz, 0.5, 0., 90., arrow1) );
84 surface sample_holder(real radius, int arrow1)
88 real dx = alpha * radius;
89 real dz = radius*sqrt(alpha*(2-alpha));
91 s.append( shift(0, -.8*(radius-dx), 0) * rotate(90, X) * scale(dz/2, dz/2, 0.15*(radius-dx)) *unitsolidcylinder );
92 s.append( shift(0, -.8*(radius-dx), 0) * rotate(90, X) * scale(dz, dz, dx) *shift(-.5, -.5, -1) * unitcube );
95 s.append( shift(0, -.8*(radius-dx)+dx, 0) * rotate(90, X) * carrow(0.15*(radius-dx), .3, 0, 270, arrow1) );
104 surface support_e4cv(real hight, real detector, real sample)
107 s.append( _support(hight, detector, 0, 0, true) );
108 s.append( _support(hight, sample, 1, 0, false) );
113 surface chi_circle(real radius, int arrow1)
117 real dx = alpha * radius;
118 real dz = radius*sqrt(alpha*(2-alpha));
120 // create a revolution surface
121 triple p1 = (radius-dx-.1)*Y-(dz/2)*X;
122 triple p2 = p1 + dz*X;
123 triple p3 = p2 - (.1*(radius-dx-.1) * Y);
124 triple p4 = p3 - dz*X;
125 path3 p= p1--p2--p3--p4--cycle;
127 s.append( surface(O, p, X) );
130 s.append( rotate(90, Y) * rotate(-90, Z) * carrow(.7 * (radius-dx-.1), .5, -90, 90, arrow1) );
139 surface support_k4cv(real hight, real detector, real sample)
142 s.append( _support(hight, detector, 0, 0, true) );
143 s.append( _support(hight, sample, 0, 0, false) );
148 surface komega_circle(real radius, int arrow1, real kalpha=50)
152 real dx = alpha * radius;
153 real dz = radius*sqrt(alpha*(2-alpha));
154 real hight = radius * sin(radians(kalpha) / 2);
156 s.append(shift(-dz, -radius+dx, -hight) * scale(2*dz, dx, 2 * hight) * unitcube);
157 s.append(rotate(kalpha, X) * shift(-dz, -radius+dx, -hight) * scale(2*dz, dx, 2 * hight) * unitcube);
160 s.append( shift(0, -radius+1.5dx,0) * rotate(90, X) * carrow(1.3 * dz, 0.5, 0., 90., arrow1) );
165 surface kappa_circle(real radius, int arrow1, real kalpha=50)
169 real dx = alpha * radius;
170 real dz = radius*sqrt(alpha*(2-alpha));
171 real hight = (radius-dx) * sin(radians(kalpha) / 2);
173 s.append(shift(-dz, -radius+dx+dx, -hight) * scale(2*dz, dx, 2 * hight) * unitcube);
174 s.append(rotate(kalpha, X) * shift(-dz, -radius+dx+dx, -hight) * scale(2*dz, dx, 2 * hight) * unitcube);
177 s.append( rotate(kalpha, X) * shift(0, -radius+dx+dx+dx, 0) * rotate(90, X) * carrow(.6*dz, .3, 0, 270, arrow1) );