~ubuntu-branches/ubuntu/saucy/cuyo/saucy

« back to all changes in this revision

Viewing changes to datasrc/pics/bunt.inc

  • Committer: Bazaar Package Importer
  • Author(s): Angel Abad
  • Date: 2010-07-19 09:54:44 UTC
  • mfrom: (4.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20100719095444-ecoegzo1vvvdwra9
Tags: 2.~-1.1.brl3-1ubuntu1
* Merge from debian unstable (LP: #607106). Remaining changes:
  - Don't register MimeType=application/x-executable in
    the .desktop file.
  - Remove UTF-8 in the .desktop file
  - 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
    Copyright 2005 by Mark Weyer
3
 
 
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.
8
 
 
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.
13
 
 
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
17
 
*/
18
 
 
19
 
global_settings {
20
 
  max_trace_level 200
21
 
}
22
 
 
23
 
#declare FesteFarben = 8;
24
 
#declare Farben = 2*FesteFarben;
25
 
 
26
 
 
27
 
#declare Hintergrund = 1;
28
 
#declare Dreifachlicht = 1;
29
 
#declare Breite=Breite1*Farben+Breite0;
30
 
#declare Hoehe=Hoehe1*Farben+Hoehe0;
31
 
 
32
 
#include "cuyopov.inc"
33
 
 
34
 
 
35
 
 
36
 
 
37
 
#declare Rad_gross = 0.9;
38
 
#declare Rad_klein = Rad_gross/pow(2,1/3);
39
 
 
40
 
#declare FesteFarben = 8;
41
 
#declare Farben = 2*FesteFarben;
42
 
 
43
 
#declare Farbe = array[Farben];
44
 
 
45
 
#local N=0;
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;
50
 
  #local C=3/2-B-2/7;
51
 
  #local E=1/3;
52
 
  #if (A<1)
53
 
    #declare Farbe[N]=<C+F,B+F,E+F,0>;
54
 
  #else
55
 
    #if (A<2)
56
 
      #declare Farbe[N]=<E+F,C+F,B+F,0>;
57
 
    #else
58
 
      #declare Farbe[N]=<B+F,E+F,C+F,0>;
59
 
    #end
60
 
  #end
61
 
  #declare Farbe[N+FesteFarben]=Farbe[N]+<0,0,0,1>;
62
 
  #local N=N+1;
63
 
#end
64
 
 
65
 
 
66
 
 
67
 
 
68
 
#declare Seite = array[Farben][Farben];
69
 
 
70
 
#local Zufall = seed(58);
71
 
 
72
 
#local N=0;
73
 
#while (N<Farben)
74
 
  #local M=0;
75
 
  #while (M<=N)
76
 
    #if (rand(Zufall)>=0.5)
77
 
      #declare Seite[M][N] = -1;
78
 
      #declare Seite[N][M] = 1;
79
 
    #else
80
 
      #declare Seite[M][N] = 1;
81
 
      #declare Seite[N][M] = -1;
82
 
    #end
83
 
    #local M=M+1;
84
 
  #end
85
 
  #local N=N+1;
86
 
#end
87
 
 
88
 
 
89
 
 
90
 
#declare Threshold = 0.5;
91
 
 
92
 
#declare Bozo = function{pattern {bozo scale 1/2}}
93
 
 
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))
97
 
  }
98
 
 
99
 
#macro Bunt_mods(I,J,D)
100
 
  Textur(texture{
101
 
    pigment {
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]]}
104
 
    }
105
 
    finish {specular 1/3 ambient 1/3}
106
 
  })
107
 
  no_shadow
108
 
  hollow
109
 
  interior {media {
110
 
    absorption 6
111
 
    density {
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]]}
114
 
    }
115
 
  }}
116
 
#end
117
 
 
118
 
#macro Bunt_iso(D,Th)
119
 
  isosurface {
120
 
    #if (D>=1)
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
127
 
      #local T=2-D;
128
 
      #local TT=1-T;
129
 
      #local Alpha=T;
130
 
      #local Beta=TT;
131
 
      #local Gamma=TT*(1-Rad_klein);
132
 
      #local Delta=TT*(1+Rad_klein) + T*(1+Rad_klein+Rad_gross)/2;
133
 
      #local C3=Alpha;
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))
140
 
        +C0*(Delta-Gamma);
141
 
      #local Skalierung = 4/3*pow(Rad_klein,3)/Volumen;
142
 
 
143
 
      function {x*x+z*z
144
 
        -(C3*pow(abs(y),3)+C2*pow(abs(y),2)+C1*abs(y)+C0)*Skalierung}
145
 
    #else
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
152
 
      #local T=1-D;
153
 
      #local TT=1-T;
154
 
      #local Alpha=TT;
155
 
      #local Beta=T;
156
 
      #local Gamma=TT*(1+Rad_klein+Rad_gross)/2+T*Rad_gross;
157
 
      #local C4=Alpha;
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;
164
 
 
165
 
      function {x*x+z*z-(C4*pow(y,4)+C2*pow(y,2)+C0)*Skalierung}
166
 
    #end
167
 
    threshold Th
168
 
    max_gradient 10
169
 
    contained_by {box {<-1,-2,-1> <1,2,1>}}
170
 
    translate D/2*y
171
 
  }
172
 
#end
173
 
 
174
 
 
175
 
 
176
 
#macro Bunt_voll (D)
177
 
  Bunt_iso(D,0)
178
 
#end
179
 
 
180
 
#macro Bunt_hohl (D)
181
 
  difference {
182
 
    Bunt_iso(D,0)
183
 
    Bunt_iso(D,-0.1)
184
 
  }
185
 
#end
186
 
 
187
 
#macro Misch_shape (I,J,D,T)
188
 
  isosurface {
189
 
    function {Misch(x,y,z,I,J,D,Seite[I][J])}
190
 
    threshold T
191
 
    max_gradient 2.6
192
 
    contained_by {box {-1 1+y}}
193
 
  }
194
 
#end
195
 
 
196
 
#macro Bunt (I,J,D)
197
 
  #if (I<FesteFarben)
198
 
    #if (J<FesteFarben)
199
 
      object {
200
 
        Bunt_voll(D)
201
 
        Bunt_mods(I,J,D)
202
 
      }
203
 
    #else
204
 
      union {
205
 
        intersection {
206
 
          Bunt_voll (D)
207
 
          Misch_shape (I,J,D,1/2-1e-2)
208
 
          Bunt_mods(I,I,D)
209
 
        }
210
 
        difference {
211
 
          Bunt_hohl (D)
212
 
          Misch_shape (I,J,D,1/2+1e-2)
213
 
          Bunt_mods(J,J,D)
214
 
        }
215
 
      }
216
 
    #end
217
 
  #else
218
 
    #if (J<FesteFarben)
219
 
      union {
220
 
        intersection {
221
 
          Bunt_hohl (D)
222
 
          Misch_shape (I,J,D,1/2-1e-2)
223
 
          Bunt_mods(I,I,D)
224
 
        }
225
 
        difference {
226
 
          Bunt_voll (D)
227
 
          Misch_shape (I,J,D,1/2+1e-2)
228
 
          Bunt_mods(J,J,D)
229
 
        }
230
 
      }
231
 
    #else
232
 
      object {
233
 
        Bunt_hohl(D)
234
 
        Bunt_mods(I,J,D)
235
 
      }
236
 
    #end
237
 
  #end
238
 
#end
239
 
 
240