Changeset 7490:f8c7503f9520
- Timestamp:
- 12/01/07 22:01:05 (6 years ago)
- Branch:
- default
- File:
-
- 1 edited
-
sage/plot/tachyon.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sage/plot/tachyon.py
r6997 r7490 7 7 -- Joshua Kantor: 3d function plotting 8 8 -- Tom Boothby: 3d function plotting n'stuff 9 -- Leif Hille: key idea for bugfix for texfunc issue (trac #799) 9 10 10 11 TODO: … … 268 269 269 270 def texfunc(self, type=0, center=(0,0,0), rotate=(0,0,0), scale=(1,1,1)): 271 """ 272 273 INPUT: 274 type -- (default: 0) 275 0: No special texture, plain shading 276 1: 3D checkerboard function, like a rubik's cube 277 2: Grit Texture, randomized surface color 278 3: 3D marble texture, uses object's base color 279 4: 3D wood texture, light and dark brown, not very good yet 280 5: 3D gradient noise function (can't remember what it look like 281 6: Don't remember 282 7: Cylindrical Image Map, requires ppm filename (don't know how to specify name in sage?!) 283 8: Spherical Image Map, requires ppm filename (don't know how to specify name in sage?!) 284 9: Planar Image Map, requires ppm filename (don't know how to specify name in sage?!) 285 center -- (default: (0,0,0)) 286 rotate -- (default: (0,0,0)) 287 scale -- (default: (1,1,1)) 288 289 EXAMPLES: 290 We draw an infinite checkboard: 291 sage: t = Tachyon(camera_center=(2,7,4), look_at=(2,0,0)) 292 sage: t.texture('black', color=(0,0,0), texfunc=1) 293 sage: t.plane((0,0,0),(0,0,1),'black') 294 sage: t.show() 295 """ 270 296 return Texfunc(type,center,rotate,scale).str() 271 297 … … 273 299 specular=0.0, opacity=1.0, 274 300 color=(1.0,0.0, 0.5), texfunc=0, phong=0, phongsize=.5, phongtype="PLASTIC"): 301 """ 302 INPUT: 303 name -- string; the name of the texture (to be used later) 304 ambient -- (default: 0.2) 305 diffuse -- (default: 0.8) 306 specular -- (default: 0.0) 307 opacity -- (default: 1.0) 308 color -- (default: (1.0,0.0,0.5)) 309 texfunc -- (default: 0); a texture function; this is either the output of 310 self.texfunc, or a number between 0 and 9, inclusive. See 311 the docs for self.texfunc. 312 phong -- (default: 0) 313 phongsize -- (default: 0.5) 314 phongtype -- (default: "PLASTIC") 315 316 EXAMPLES: 317 We draw a scene with 4 sphere that illustrates various uses of the texture command: 318 sage: t = Tachyon(camera_center=(2,5,4), look_at=(2,0,0), raydepth=6) 319 sage: t.light((10,3,4), 1, (1,1,1)) 320 sage: t.texture('mirror', ambient=0.05, diffuse=0.05, specular=.9, opacity=0.9, color=(.8,.8,.8)) 321 sage: t.texture('grey', color=(.8,.8,.8), texfunc=3) 322 sage: t.plane((0,0,0),(0,0,1),'grey') 323 sage: t.sphere((4,-1,1), 1, 'mirror') 324 sage: t.sphere((0,-1,1), 1, 'mirror') 325 sage: t.sphere((2,-1,1), 0.5, 'mirror') 326 sage: t.sphere((2,1,1), 0.5, 'mirror') 327 sage: show(t) 328 """ 329 if texfunc and not isinstance(texfunc, Texfunc): 330 texfunc = self.texfunc(int(texfunc)) 275 331 self._objects.append(Texture(name, ambient, diffuse, 276 332 specular, opacity, color, texfunc,
Note: See TracChangeset
for help on using the changeset viewer.
