2
Copyright 2005 by Mark Weyer
4
This program is free software; you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation; either version 2 of the License, or
7
(at your option) any later version.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
You should have received a copy of the GNU General Public License
15
along with this program; if not, write to the Free Software
16
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23
#declare FesteFarben = 8;
24
#declare Farben = 2*FesteFarben;
27
#declare Hintergrund = 1;
28
#declare Dreifachlicht = 1;
29
#declare Breite=Breite1*Farben+Breite0;
30
#declare Hoehe=Hoehe1*Farben+Hoehe0;
32
#include "cuyopov.inc"
37
#declare Rad_gross = 0.9;
38
#declare Rad_klein = Rad_gross/pow(2,1/3);
40
#declare FesteFarben = 8;
41
#declare Farben = 2*FesteFarben;
43
#declare Farbe = array[Farben];
46
#while (N<FesteFarben)
47
#local A=3*(N+1/2)/FesteFarben;
48
#local F=mod(N+1,2)/4;
49
#local B=(mod(A,1)+1)/2-1/7;
53
#declare Farbe[N]=<C+F,B+F,E+F,0>;
56
#declare Farbe[N]=<E+F,C+F,B+F,0>;
58
#declare Farbe[N]=<B+F,E+F,C+F,0>;
61
#declare Farbe[N+FesteFarben]=Farbe[N]+<0,0,0,1>;
68
#declare Seite = array[Farben][Farben];
70
#local Zufall = seed(58);
76
#if (rand(Zufall)>=0.5)
77
#declare Seite[M][N] = -1;
78
#declare Seite[N][M] = 1;
80
#declare Seite[M][N] = 1;
81
#declare Seite[N][M] = -1;
90
#declare Threshold = 0.5;
92
#declare Bozo = function{pattern {bozo scale 1/2}}
94
#declare Misch = function (X,Y,Z,I,J,D,S) {
95
min(1,max(0,S*(Bozo(X+2*min(I,J),Y-D/2+4*max(I,J),Z)-1/2+X*cos(D*pi/4)/2)
96
+1/2+(Y-D/2)*sin(D*pi/4)/2))
99
#macro Bunt_mods(I,J,D)
102
function {Misch(x,y,z,I,J,D,Seite[I][J])}
103
colour_map {[1/2 rgbt Farbe[I]] [1/2 rgbt Farbe[J]]}
105
finish {specular 1/3 ambient 1/3}
112
function {Misch(x,y,z,I,J,D,Seite[I][J])}
113
colour_map {[1/2 rgbt 1-Farbe[I]] [1/2 rgbt 1-Farbe[J]]}
118
#macro Bunt_iso(D,Th)
121
// Die Funktion Radius^2 hat die Gestalt
122
// (Alpha*|y|+Beta)*(|y|-Gamma)*(|y|-Delta)
123
// beziehungsweise C3*|y|^3+C2*|y|^2+C1*|y|+C0
124
// Dabei ist Alpha,Beta>=0 und 0<=Gamma<Delta,
125
// also sind Gamma und Delta die einzigen Nullstellen >0
126
// Das ganze wird dann so skaliert, da� das Volumen des K�rpers stimmt
131
#local Gamma=TT*(1-Rad_klein);
132
#local Delta=TT*(1+Rad_klein) + T*(1+Rad_klein+Rad_gross)/2;
134
#local C2=Beta-Alpha*(Gamma+Delta);
135
#local C1=Alpha*Gamma*Delta-Beta*(Gamma+Delta);
136
#local C0=Beta*Gamma*Delta;
137
#local Volumen = C3/4*(pow(Delta,4)-pow(Gamma,4))
138
+C2/3*(pow(Delta,3)-pow(Gamma,3))
139
+C1/2*(pow(Delta,2)-pow(Gamma,2))
141
#local Skalierung = 4/3*pow(Rad_klein,3)/Volumen;
144
-(C3*pow(abs(y),3)+C2*pow(abs(y),2)+C1*abs(y)+C0)*Skalierung}
146
// Jetzt, nach dem Kontakt, hat Radius^2 die Gestalt
147
// (Alpha*y^2+Beta)*(y^2-Gamma^2)
148
// bezeihungsweise C4*y^4+C2*y^2+C0
149
// Dabei ist wieder Alpha,Beta,Gamma>=0,
150
// also ist Gamma die einzige Nullstelle >0
151
// Skalierung wieder nach Volumen
156
#local Gamma=TT*(1+Rad_klein+Rad_gross)/2+T*Rad_gross;
158
#local C2=Beta-Alpha*Gamma*Gamma;
159
#local C0=-Beta*Gamma*Gamma;
160
#local Volumen = C4/5*pow(Gamma,5)+C2/3*pow(Gamma,3)+C0*Gamma;
161
// Dies ist nur das Volumen f�r die obere H�lfte,
162
// also wird es nur mit Rad_klein verglichen
163
#local Skalierung = 4/3*pow(Rad_klein,3)/Volumen;
165
function {x*x+z*z-(C4*pow(y,4)+C2*pow(y,2)+C0)*Skalierung}
169
contained_by {box {<-1,-2,-1> <1,2,1>}}
187
#macro Misch_shape (I,J,D,T)
189
function {Misch(x,y,z,I,J,D,Seite[I][J])}
192
contained_by {box {-1 1+y}}
207
Misch_shape (I,J,D,1/2-1e-2)
212
Misch_shape (I,J,D,1/2+1e-2)
222
Misch_shape (I,J,D,1/2-1e-2)
227
Misch_shape (I,J,D,1/2+1e-2)