MCPcopy Create free account
hub / github.com/ActiveState/code / spiral

Function spiral

recipes/Python/205451_Povray_for_python/recipe-205451.py:183–207  ·  view source on GitHub ↗

Fibonacci spiral

()

Source from the content-addressed store, hash-verified

181 file.write( cam, sphere, light )
182
183def spiral():
184 " Fibonacci spiral "
185 gamma = (sqrt(5)-1)/2
186 file = File()
187 Camera(location=(0,0,-128), look_at=(0,0,0)).write(file)
188 LightSource((100,100,-100), color=(1,1,1)).write(file)
189 LightSource((150,150,-100), color=(0,0,0.3)).write(file)
190 LightSource((-150,150,-100), color=(0,0.3,0)).write(file)
191 LightSource((150,-150,-100), color=(0.3,0,0)).write(file)
192 theta = 0.0
193 for i in range(200):
194 r = i * 0.5
195 color = 1,1,1
196 v = [ r*sin(theta), r*cos(theta), 0 ]
197 Sphere( v, 0.7*sqrt(i),
198 Texture(
199 Finish(
200 ambient = 0.0,
201 diffuse = 0.0,
202 reflection = 0.85,
203 specular = 1
204 ),
205 Pigment(color=color))
206 ).write(file)
207 theta += gamma * 2 * pi

Callers

nothing calls this directly

Calls 12

sqrtFunction · 0.85
CameraClass · 0.85
LightSourceClass · 0.85
rangeFunction · 0.85
sinFunction · 0.85
cosFunction · 0.85
TextureClass · 0.85
FinishClass · 0.85
PigmentClass · 0.85
FileClass · 0.70
SphereClass · 0.70
writeMethod · 0.45

Tested by

no test coverage detected