aboutsummaryrefslogtreecommitdiffstats
path: root/buch/chapters/110-elliptisch/images/torusschnitt.pov
blob: 43d50c6a20035321a5e002247dcd8794624f0bb3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
//
// kegelpara.pov
//
// (c) 2022 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule
//
#version 3.7;
#include "colors.inc"

#declare O = <0,0,0>;

global_settings {
        assumed_gamma 1
}

#declare imagescale = 0.060;

camera {
        location <28, 20, -40>
        look_at <0, 0.55, 0>
        right (16/9) * x * imagescale
        up y * imagescale
}

light_source {
        <30, 10, -40> color White
        area_light <1,0,0> <0,0,1>, 10, 10
        adaptive 1
        jitter
}

sky_sphere {
        pigment {
                color rgb<1,1,1>
        }
}


//
// draw an arrow from <from> to <to> with thickness <arrowthickness> with
// color <c>
//
#macro arrow(from, to, arrowthickness, c)
#declare arrowdirection = vnormalize(to - from);
#declare arrowlength = vlength(to - from);
union {
	sphere {
		from, 1.1 * arrowthickness
	}
	cylinder {
		from,
		from + (arrowlength - 5 * arrowthickness) * arrowdirection,
		arrowthickness
	}
	cone {
		from + (arrowlength - 5 * arrowthickness) * arrowdirection,
		2 * arrowthickness,
		to,
		0
	}
	pigment {
		color c
	}
	finish {
		specular 0.9
		metallic
	}
}
#end

arrow(<-2,0,0>,<2,0,0>,0.02,White)
arrow(<0,-1.1,0>,<0,2.2,0>,0.02,White)
arrow(<0,0,-1.6>,<0,0,2.4>,0.02,White)

#declare epsilon = 0.001;
#declare l = 1.5;


#declare a = sqrt(2);
#macro G2(phi,sg)
	a * sqrt(cos(2*phi)) * < sg * cos(phi), 0, sin(phi)>
#end

#macro Lemniskate(s, farbe)
union {
	#declare phi = -pi / 4;
	#declare phimax = pi / 4;
	#declare phisteps = 100;
	#declare phistep = phimax / phisteps;
	#while (phi < phimax - phistep/2)
		sphere { G2(phi,1), s }
		cylinder { G2(phi,1), G2(phi+phistep,1), s }
		sphere { G2(phi,-1), s }
		cylinder { G2(phi,-1), G2(phi+phistep,-1), s }
		#declare phi = phi + phistep;
	#end
	pigment {
		color farbe
	}
	finish {
		specular 0.9
		metallic
	}
}
#end

#macro Projektion(s, farbe)
union {
	#declare phistep = pi / 16;
	#declare phi = -pi / 4 + phistep;
	#declare phimax = pi / 4;
	#while (phi < phimax - phistep/2)
		cylinder { G(phi,  1), G2(phi,  1), s }
		cylinder { G(phi, -1), G2(phi, -1), s }
		#declare phi = phi + phistep;
	#end
	pigment {
		color farbe
	}
	finish {
		specular 0.9
		metallic
	}
}
#end

#macro Ebene(l, b, farbe)
mesh {
	triangle { <-l, 0, -b>, < l, 0, -b>, < l, 0,  b> }
	triangle { <-l, 0, -b>, < l, 0,  b>, <-l, 0,  b> }
	pigment {
		color farbe
	}
	finish {
		specular 0.9
		metallic
	}
}
#end

#macro Ebenengitter(l, b, s, r, farbe)
union {
	#declare lmax = floor(l / s);
	#declare ll = -lmax;
	#while (ll <= lmax)
		cylinder { <ll * s, 0, -b>, <ll * s, 0, b>, r }
		#declare ll = ll + 1;
	#end
	#declare bmax = floor(b / s);
	#declare bb = -bmax;
	#while (bb <= bmax)
		cylinder { <-l, 0, bb * s>, <l, 0, bb * s>, r }
		#declare bb = bb + 1;
	#end
	pigment {
		color farbe
	}
	finish {
		specular 0.9
		metallic
	}
}
#end

#declare b = 0.5;
#macro T(phi, theta)
	b * < (2 + cos(theta)) * cos(phi), (2 + cos(theta)) * sin(phi) + 1, sin(theta) >
#end

#macro breitenkreis(theta, r)
	#declare phi = 0;
	#declare phimax = 2 * pi;
	#declare phisteps = 200;
	#declare phistep = phimax / phisteps;
	#while (phi < phimax - phistep/2)
		cylinder { T(phi, theta), T(phi + phistep, theta), r }
		sphere { T(phi, theta), r }
		#declare phi = phi + phistep;
	#end
#end

#macro laengenkreis(phi, r)
	#declare theta = 0;
	#declare thetamax = 2 * pi;
	#declare thetasteps = 200;
	#declare thetastep = thetamax / thetasteps;
	#while (theta < thetamax - thetastep/2)
		cylinder { T(phi, theta), T(phi, theta + thetastep), r }
		sphere { T(phi, theta), r }
		#declare theta = theta + thetastep;
	#end
#end

#macro Torusgitter(farbe, r)
union {
	#declare phi = 0;
	#declare phimax = 2 * pi;
	#declare phistep = pi / 6;
	#while (phi < phimax - phistep/2)
		laengenkreis(phi, r)
		#declare phi = phi + phistep;
	#end
	#declare thetamax = pi;
	#declare thetastep = pi / 6;
	#declare theta = thetastep;
	#while (theta < thetamax - thetastep/2)
		breitenkreis(theta, r)
		breitenkreis(thetamax + theta, r)
		#declare theta = theta + thetastep;
	#end
	breitenkreis(0, 1.5 * r)
	breitenkreis(pi, 1.5 * r)
	pigment {
		color farbe
	}
	finish {
		specular 0.9
		metallic
	}
}
#end

#macro Torus(farbe)
mesh {
	#declare phi = 0;
	#declare phimax = 2 * pi;
	#declare phisteps = 200;
	#declare phistep = phimax/phisteps;
	#while (phi < phimax - phistep/2)
		#declare theta = 0;
		#declare thetamax = 2 * pi;
		#declare thetasteps = 200;
		#declare thetastep = thetamax / thetasteps;
		#while (theta < thetamax - thetastep/2)
			triangle {
				T(phi,           theta),
				T(phi + phistep, theta),
				T(phi + phistep, theta + thetastep)
			}
			triangle {
				T(phi,           theta),
				T(phi + phistep, theta + thetastep),
				T(phi,           theta + thetastep)
			}
			#declare theta = theta + thetastep;
		#end
		#declare phi = phi + phistep;
	#end
	pigment {
		color farbe
	}
	finish {
		specular 0.9
		metallic
	}
}
#end

#declare torusfarbe = rgbt<0.2,0.6,0.2,0.2>;
#declare ebenenfarbe = rgbt<0.2,0.6,1.0,0.2>;

Lemniskate(0.02, Red)
Ebene(1.8, 1.4, ebenenfarbe)
Ebenengitter(1.8, 1.4, 0.5, 0.005, rgb<0.4,1,1>)
Torus(torusfarbe)
Torusgitter(Yellow, 0.005)