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 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638
|
## Automatically adapted for scipy Oct 31, 2005 by
# Copyright (c) 1996, 1997, The Regents of the University of California.
# All rights reserved. See Legal.htm for full text and disclaimer.
from plwf import *
from pl3d import *
from movie import *
from slice3 import *
from yorick import *
from gist import *
from gistfuncs import *
from numpy import rand
window3 (hcp = "talk.ps", dump = 1)
palette ("gray.gp")
demo5_n = 20. * ones (3)
making_movie = 0
def demo5_light (i) :
global making_movie
if i >= 30 : return 0
theta = pi / 4 + (i - 1) * 2 * pi/29
light3 (sdir = array ( [cos(theta), .25, sin(theta)], Float))
# without an explicit call to draw3, the light3 function would
# cause no changes until Python paused for input from the keyboard,
# since unlike the primitive plotting functions (plg, plf, plfp, ...)
# the fma call made by the movie function will not trigger the
# 3D display list
# any movie frame display function which uses the 3D drawing
# functions in pl3d.i will need to do this
# the !making_movie flag supresses the fma in draw3 if this function
# is called by movie (which issues its own fma), but allows it
# otherwise
draw3 ( not making_movie )
return 1
def paws ( ) :
i = raw_input ("Type in any string to continue; ^C to return to prompt. ")
return
from PR import *
def demo5 (*itest) :
"""demo5 () or demo5 (i)
Run examples of use of pl3d.i, plwf.i, and slice3.i. With
argument I = 1, 2, or 3, run that particular demonstration.
Read the source code to understand the details of how the
various effects are obtained.
demo5 (1) demonstrates the various effects which can be obtained
with the plwf (plot wire frame) function.
demo5 (2) demonstrates shading effects controlled by the light3
function
demo5 (3) demonstrates the slice3, slice2, and pl3tree functions,
as well as changing the orientation of the 3D object
"""
global making_movie
if len (itest) == 0 or itest [0] == 1 :
set_draw3_ (0)
x = span (-1, 1, 64, 64)
y = transpose (x)
z = (x + y) * exp (-6.*(x*x+y*y))
limits_(square = 1)
print "(plot wire frame) plwf,z,y,x"
orient3 ( )
light3 ( )
plwf (z, y, x)
[xmin, xmax, ymin, ymax] = draw3(1) # not necessary interactively
limits (xmin, xmax, ymin, ymax)
plt("opaque wire mesh", .30, .42)
paws ( )
print "plwf,z,y,x, shade=1,ecolor=\"red\""
plwf(z,y,x,shade=1,ecolor="red")
[xmin, xmax, ymin, ymax] = draw3(1) # not necessary interactively
limits (xmin, xmax, ymin, ymax)
paws()
print "plwf,z,y,x, shade=1,edges=0"
plwf(z,y,x,shade=1,edges=0)
[xmin, xmax, ymin, ymax] = draw3(1) # not necessary interactively
limits (xmin, xmax, ymin, ymax)
paws ( )
light3 ( diffuse=.1, specular=1., sdir=array([0,0,-1]))
[xmin, xmax, ymin, ymax] = draw3(1)
limits (xmin, xmax, ymin, ymax)
paws ( )
light3 ( diffuse=.5, specular=1., sdir=array([1,.5,1]))
[xmin, xmax, ymin, ymax] = draw3 (1)
limits (xmin, xmax, ymin, ymax)
paws ( )
light3 ( ambient=.1,diffuse=.1,specular=1.,
sdir=array([[0,0,-1],[1,.5,1]]),spower=array([4,2]))
[xmin, xmax, ymin, ymax] = draw3(1)
limits (xmin, xmax, ymin, ymax)
paws ( )
if len (itest) == 0 or itest [0] == 2 :
set_draw3_ (0)
x = span (-1, 1, 64, 64)
y = transpose (x)
z = (x + y) * exp (-6.*(x*x+y*y))
print "light3 function demo- default lighting"
orient3 ( )
light3 ( )
plwf (z,y,x,shade=1,edges=0)
[xmin, xmax, ymin, ymax] = draw3 (1) # not necessary interactively
limits (xmin, xmax, ymin, ymax)
paws( )
print "light3,diffuse=.2,specular=1"
light3(diffuse=.2,specular=1)
limits_(square = 1)
[xmin, xmax, ymin, ymax] = draw3(1) # not necessary interactively
limits (xmin, xmax, ymin, ymax)
paws()
print "light3,sdir=[cos(theta),.25,sin(theta)] -- movie"
making_movie = 1
movie(demo5_light, lims = [xmin, xmax, ymin, ymax])
making_movie = 0
fma()
demo5_light(1)
paws()
light3()
if len (itest) == 0 or itest [0] == 3 :
nx = demo5_n [0]
ny = demo5_n [1]
nz = demo5_n [2]
xyz = zeros ( (3, nx, ny, nz), Float)
xyz [0] = multiply.outer ( span (-1, 1, nx), ones ( (ny, nz), Float))
xyz [1] = multiply.outer ( ones (nx, Float),
multiply.outer ( span (-1, 1, ny), ones (nz, Float)))
xyz [2] = multiply.outer ( ones ( (nx, ny), Float), span (-1, 1, nz))
r = sqrt (xyz [0] ** 2 + xyz [1] **2 + xyz [2] **2)
theta = arccos (xyz [2] / r)
phi = arctan2 (xyz [1] , xyz [0] + logical_not (r))
y32 = sin (theta) ** 2 * cos (theta) * cos (2 * phi)
m3 = mesh3 (xyz, funcs = [r * (1. + y32)])
del r, theta, phi, xyz, y32
print " test uses " + `(nx - 1) * (ny - 1) * (nz - 1)` + " cells"
elapsed = [0., 0., 0.]
elapsed = timer_ (elapsed)
elapsed0 = elapsed
[nv, xyzv, dum] = slice3 (m3, 1, None, None, value = .50)
# (inner isosurface)
[nw, xyzw, dum] = slice3 (m3, 1, None, None, value = 1.)
# (outer isosurface)
pxy = plane3 ( array ([0, 0, 1], Float ), zeros (3, Float))
pyz = plane3 ( array ([1, 0, 0], Float ), zeros (3, Float))
[np, xyzp, vp] = slice3 (m3, pyz, None, None, 1)
# (pseudo-colored slice)
[np, xyzp, vp] = slice2 (pxy, np, xyzp, vp)
# (cut slice in half)
[nv, xyzv, d1, nvb, xyzvb, d2] = \
slice2x (pxy, nv, xyzv, None)
[nv, xyzv, d1] = \
slice2 (- pyz, nv, xyzv, None)
# (...halve one of those halves)
[nw, xyzw, d1, nwb, xyzwb, d2] = \
slice2x ( pxy , nw, xyzw, None)
# (split outer in halves)
[nw, xyzw, d1] = \
slice2 (- pyz, nw, xyzw, None)
elapsed = timer_ (elapsed)
timer_print ("slicing time", elapsed - elapsed0)
fma ()
print "split_palette,\"earth.gp\" -- generate palette for pl3tree"
split_palette ("earth.gp")
print "gnomon -- turn on gnomon"
gnomon (1)
print "pl3tree with 1 slicing plane, 2 isosurfaces"
clear3 ()
# Make sure we don't draw till ready
set_draw3_ (0)
pl3tree (np, xyzp, vp, pyz)
pl3tree (nvb, xyzvb)
pl3tree (nwb, xyzwb)
pl3tree (nv, xyzv)
pl3tree (nw, xyzw)
orient3 ()
light3 (diffuse = .2, specular = 1)
limits ()
limits (square=1)
demo5_light (1)
paws ()
hcp ()
print "spin3 animated rotation, use rot3 or orient3 for one frame"
# don't want limits to autoscale during animation
lims = limits ( )
spin3 ()
limits ( ) # back to autoscaling
demo5_light (1)
paws ()
light3 ()
gnomon (0)
limits (square = 1)
palette ("gray.gp")
if len (itest) == 0 or itest [0] == 4 :
f = PR ('./bills_plot')
n_nodes = f.NumNodes
n_z = f.NodesOnZones
x = f.XNodeCoords
y = f.YNodeCoords
z = f.ZNodeCoords
c = f.ZNodeVelocity
n_zones = f.NumZones
# Put vertices in right order for Gist
n_z = transpose (
take (transpose (n_z), array ( [0, 4, 3, 7, 1, 5, 2, 6]),axis=0))
m3 = mesh3 (x, y, z, funcs = [c], verts = n_z ) # [0:10])
[nv, xyzv, cv] = slice3 (m3, 1, None, None, 1, value = .9 * max (c) )
pyz = plane3 ( array ([1, 0, 0], Float ), zeros (3, Float))
pxz = plane3 ( array ([0, 1, 0], Float ), zeros (3, Float))
# draw a colored plane first
fma ()
clear3 ()
# Make sure we don't draw till ready
set_draw3_ (0)
[np, xyzp, vp] = slice3 (m3, pyz, None, None, 1)
pl3tree (np, xyzp, vp, pyz, split = 0)
palette ("rainbow.gp")
orient3 ()
demo5_light (1)
paws ()
# [nv, xyzv, d1] = \
# slice2 (- pyz, nv, xyzv, None)
[nw, xyzw, cw] = slice3 (m3, 1, None, None, 1, value = .9 * min (c) )
# [nw, xyzw, d1] = \
# slice2 (- pyz, nw, xyzw, None)
[nvi, xyzvi, cvi] = slice3 (m3, 1, None, None, 1, value = .5 * min (c) )
[nvi, xyzvi, cvi] = \
slice2 (- pyz, nvi, xyzvi, cvi)
[nvj, xyzvj, cvj] = slice3 (m3, 1, None, None, 1, value = .5 * max (c) )
[nvj, xyzvj, cvj] = \
slice2 (- pyz, nvj, xyzvj, cvj)
fma ()
print "gnomon -- turn on gnomon"
gnomon (1)
clear3 ()
# Make sure we don't draw till ready
set_draw3_ (0)
pl3tree (nv, xyzv) # , cv)
pl3tree (nw, xyzw) # , cw)
pl3tree (nvi, xyzvi) # , cvi)
pl3tree (nvj, xyzvj) # , cvi)
orient3 ()
light3 (ambient = 0, diffuse = .5, specular = 1, sdir = [0, 0, -1])
limits (square=1)
palette ("gray.gp")
demo5_light (1)
paws ()
print "spin3 animated rotation, use rot3 or orient3 for one frame"
# don't want limits to autoscale during animation
spin3 ()
limits ( ) # back to autoscaling
demo5_light (1)
paws ()
light3 ()
gnomon (0)
palette ("gray.gp")
draw3 ( 1 )
paws ()
clear3 ()
del nv, xyzv, cv, nw, xyzw, cw, nvi, xyzvi, cvi, nvj, xyzvj, cvj
# Make sure we don't draw till ready
set_draw3_ (0)
for i in range (8) :
[nv, xyzv, cv] = slice3 (m3, 1, None, None, 1, value = .9 * min (c) +
i * (.9 * max (c) - .9 * min (c)) / 8.)
[nv, xyzv, d1] = \
slice2 (pxz, nv, xyzv, None)
pl3tree (nv, xyzv)
orient3 ()
light3 (ambient = 0, diffuse = .5, specular = 1, sdir = [0, 0, -1])
limits (square=1)
palette ("heat.gp")
demo5_light (1)
paws ()
spin3 ()
limits ( ) # back to autoscaling
demo5_light (1)
paws ()
demo5_light (1)
paws ()
if len (itest) == 0 or itest [0] == 5 :
# Try bert's data
f = PR ('./berts_plot')
nums = array ( [63, 63, 49], Int)
dxs = array ( [2.5, 2.5, 10.], Float )
x0s = array ( [-80., -80., 0.0], Float )
c = f.c
m3 = mesh3 (nums, dxs, x0s, funcs = [transpose (c)])
[nv, xyzv, dum] = slice3 (m3, 1, None, None, value = 6.5)
fma ()
clear3 ()
print "gnomon -- turn on gnomon"
gnomon (1)
# Make sure we don't draw till ready
set_draw3_ (0)
palette ("rainbow.gp")
pl3tree (nv, xyzv)
orient3 ()
light3 (diffuse = .2, specular = 1)
limits (square=1)
demo5_light (1)
paws ()
spin3 ()
demo5_light (1)
paws ()
if len (itest) == 0 or itest [0] == 6 :
# Try Bill's irregular mesh
f = PR ("ball.s0001")
ZLss = f.ZLstruct_shapesize
ZLsc = f.ZLstruct_shapecnt
ZLsn = f.ZLstruct_nodelist
x = f.sap_mesh_coord0
y = f.sap_mesh_coord1
z = f.sap_mesh_coord2
c = f.W_vel_data
# Now we need to convert this information to avs-style data
istart = 0 # beginning index into ZLstruct_nodelist
NodeError = "NodeError"
ntet = 0
nhex = 0
npyr = 0
nprism = 0
nz_tet = []
nz_hex = []
nz_pyr = []
nz_prism = []
for i in range (4) :
if ZLss [i] == 4 : # TETRAHEDRON
nz_tet = reshape (ZLsn [istart: istart + ZLss [i] * ZLsc [i]],
(ZLsc [i], ZLss [i]))
ntet = ZLsc [i]
istart = istart + ZLss [i] * ZLsc [i]
elif ZLss[i] == 5 : # PYRAMID
nz_pyr = reshape (ZLsn [istart: istart + ZLss [i] * ZLsc [i]],
(ZLsc [i], ZLss [i]))
npyr = ZLsc [i]
# Now reorder the points (bill has the apex last instead of first)
nz_pyr = transpose (
take (transpose (nz_pyr), array ( [4, 0, 1, 2, 3]),axis=0))
istart = istart + ZLss [i] * ZLsc [i]
elif ZLss[i] == 6 : # PRISM
nz_prism = reshape (ZLsn [istart: istart + ZLss [i] * ZLsc [i]],
(ZLsc [i], ZLss [i]))
nprism = ZLsc [i]
# now reorder the points (bill goes around a square face
# instead of traversing the opposite sides in the same direction.
nz_prism = transpose (
take (transpose (nz_prism), array ( [0, 1, 3, 2, 4, 5]),axis=0))
istart = istart + ZLss [i] * ZLsc [i]
elif ZLss[i] == 8 : # HEXAHEDRON
nz_hex = reshape (ZLsn [istart: istart + ZLss [i] * ZLsc [i]],
(ZLsc [i], ZLss [i]))
# now reorder the points (bill goes around a square face
# instead of traversing the opposite sides in the same direction.
nz_hex = transpose (
take (transpose (nz_hex), array ( [0, 1, 3, 2, 4, 5, 7, 6]),axis=0))
nhex = ZLsc [i]
istart = istart + ZLss [i] * ZLsc [i]
else :
raise NodeError, `ZLss[i]` + "is an incorrect number of nodes."
m3 = mesh3 (x, y, z, funcs = [c], verts = [nz_tet, nz_pyr, nz_prism,
nz_hex])
[nv, xyzv, cv] = slice3 (m3, 1, None, None, 1, value = .9 * max (c) )
pyz = plane3 ( array ([1, 0, 0], Float ), zeros (3, Float))
pxz = plane3 ( array ([0, 1, 0], Float ), zeros (3, Float))
# draw a colored plane first
fma ()
clear3 ()
# Make sure we don't draw till ready
set_draw3_ (0)
[np, xyzp, vp] = slice3 (m3, pyz, None, None, 1)
pl3tree (np, xyzp, vp, pyz, split = 0)
palette ("rainbow.gp")
orient3 ()
limits (square=1)
demo5_light (1)
paws ()
[nw, xyzw, cw] = slice3 (m3, 1, None, None, 1, value = .9 * min (c) )
[nvi, xyzvi, cvi] = slice3 (m3, 1, None, None, 1, value = .1 * min (c) )
[nvi, xyzvi, cvi] = \
slice2 (- pyz, nvi, xyzvi, cvi)
[nvj, xyzvj, cvj] = slice3 (m3, 1, None, None, 1, value = .1 * max (c) )
[nvj, xyzvj, cvj] = \
slice2 (- pyz, nvj, xyzvj, cvj)
[nvii, xyzvii, cvii] = slice3 (m3, 1, None, None, 1,
value = 1.e-12 * min (c) )
[nvii, xyzvii, cvii] = \
slice2 (- pyz, nvii, xyzvii, cvii)
[nvjj, xyzvjj, cvjj] = slice3 (m3, 1, None, None, 1,
value = 1.e-12 * max (c) )
[nvjj, xyzvjj, cvjj] = \
slice2 (- pyz, nvjj, xyzvjj, cvjj)
fma ()
print "gnomon -- turn on gnomon"
gnomon (1)
clear3 ()
# Make sure we don't draw till ready
set_draw3_ (0)
pl3tree (nv, xyzv) # , cv)
pl3tree (nw, xyzw) # , cw)
pl3tree (nvi, xyzvi) # , cvi)
pl3tree (nvj, xyzvj) # , cvj)
pl3tree (nvii, xyzvii) # , cvii)
pl3tree (nvjj, xyzvjj) # , cvjj)
orient3 ()
light3 (ambient = 0, diffuse = .5, specular = 1, sdir = [0, 0, -1])
limits (square=1)
palette ("gray.gp")
demo5_light (1)
paws ()
palette ("heat.gp")
paws ()
if len (itest) == 0 or itest [0] == 7 :
# test plwf on the sombrero function
# compute sombrero function
x = arange (-20, 21, dtype = Float)
y = arange (-20, 21, dtype = Float)
z = zeros ( (41, 41), Float)
r = sqrt (add.outer ( x ** 2, y **2)) + 1e-6
z = sin (r) / r
fma ()
clear3 ()
gnomon (0)
# Make sure we don't draw till ready
set_draw3_ (0)
palette ("rainbow.gp")
limits (square=1)
orient3 ()
light3 ()
plwf (z, fill = z, ecolor = "black")
[xmin, xmax, ymin, ymax] = draw3 (1)
limits (xmin, xmax, ymin, ymax)
paws ()
##### Try smooth contours, log mode
[nv, xyzv, dum] = slice3mesh (x, y, z)
zmult = max (max (abs (x)), max (abs (y)))
plzcont (nv, xyzv, contours = 20, scale = "normal")
[xmin, xmax, ymin, ymax] = draw3 (1)
limits (xmin, xmax, ymin, ymax)
paws ()
plzcont (nv, xyzv, contours = 20, scale = "lin", edges=1)
[xmin, xmax, ymin, ymax] = draw3 (1)
limits (xmin, xmax, ymin, ymax)
paws ()
plwf (z, fill = z, shade = 1, ecolor = "black")
[xmin, xmax, ymin, ymax] = draw3 (1)
limits (xmin, xmax, ymin, ymax)
paws ()
plwf (z, fill = z, shade = 1, edges = 0)
[xmin, xmax, ymin, ymax] = draw3 (1)
limits (xmin, xmax, ymin, ymax)
paws ()
light3(diffuse=.2,specular=1)
print "light3,sdir=[cos(theta),.25,sin(theta)] -- movie"
making_movie = 1
movie(demo5_light, lims = [xmin, xmax, ymin, ymax])
making_movie = 0
fma()
demo5_light(1)
paws ()
plwf (z, fill = None, shade = 1, edges = 0)
[xmin, xmax, ymin, ymax] = draw3 (1)
palette("gray.gp")
limits (xmin, xmax, ymin, ymax)
paws ()
if len (itest) == 0 or itest [0] == 8 :
# test pl3surf on the sombrero function
# compute sombrero function
nc1 = 100
nv1 = nc1 + 1
br = - (nc1 / 2)
tr = nc1 / 2 + 1
x = arange (br, tr, dtype = Float) * 40. / nc1
y = arange (br, tr, dtype = Float) * 40. / nc1
z = zeros ( (nv1, nv1), Float)
r = sqrt (add.outer ( x ** 2, y **2)) + 1e-6
z = sin (r) / r
# In order to use pl3surf, we need to construct a mesh
# using mesh3. The way I am going to do that is to define
# a function on the 3d mesh so that the sombrero function
# is its 0-isosurface.
z0 = min (ravel (z))
z0 = z0 - .05 * abs (z0)
maxz = max (ravel (z))
maxz = maxz + .05 * abs (maxz)
zmult = max (max (abs (x)), max (abs (y)))
dz = (maxz - z0)
nxnynz = array ( [nc1, nc1, 1], Int)
dxdydz = array ( [1.0, 1.0, zmult*dz], Float )
x0y0z0 = array ( [float (br), float (br), z0*zmult], Float )
meshf = zeros ( (nv1, nv1, 2), Float )
meshf [:, :, 0] = zmult*z - (x0y0z0 [2])
meshf [:, :, 1] = zmult*z - (x0y0z0 [2] + dxdydz [2])
m3 = mesh3 (nxnynz, dxdydz, x0y0z0, funcs = [meshf])
fma ()
# Make sure we don't draw till ready
set_draw3_ (0)
pldefault(edges=0)
[nv, xyzv, col] = slice3 (m3, 1, None, None, value = 0.)
orient3 ()
pl3surf (nv, xyzv)
lim = draw3 (1)
limits (lim [0], lim [1], 1.5*lim [2], 1.5*lim [3])
palette ("gray.gp")
paws ()
# Try new slicing function to get color graph
[nv, xyzv, col] = slice3mesh (nxnynz [0:2], dxdydz [0:2], x0y0z0 [0:2],
zmult * z, color = zmult * z)
pl3surf (nv, xyzv, values = col)
lim = draw3 (1)
dif = 0.5 * (lim [3] - lim [2])
limits (lim [0], lim [1], lim [2] - dif, lim [3] + dif)
palette ("rainbow.gp")
paws ()
palette ("heat.gp")
# Try plzcont--see if smooth mode possible
plzcont (nv, xyzv)
draw3 (1)
paws ()
plzcont (nv, xyzv, contours = 20)
draw3 (1)
paws ()
plzcont (nv, xyzv, contours = 20, scale = "log")
draw3(1)
paws ()
plzcont (nv, xyzv, contours = 20, scale = "normal")
draw3(1)
paws ()
if len (itest) == 0 or itest [0] == 9 :
vsf = 0.
c = 1
s = 1000.
kmax = 25
lmax = 35
# The following computations define an interesting 3d surface.
xr = multiply.outer (
arange (1, kmax + 1, dtype = Float), ones (lmax, Float))
yr = multiply.outer (
ones (kmax, Float), arange (1, lmax + 1, dtype = Float))
zt = 5. + xr + .2 * rand (kmax, lmax) # ranf (xr)
rt = 100. + yr + .2 * rand (kmax, lmax) # ranf (yr)
z = s * (rt + zt)
z = z + .02 * z * rand (kmax, lmax) # ranf (z)
ut = rt/sqrt (rt ** 2 + zt ** 2)
vt = zt/sqrt (rt ** 2 + zt ** 2)
ireg = multiply.outer ( ones (kmax, Float), ones (lmax, Float))
ireg [0:1, 0:lmax]=0
ireg [0:kmax, 0:1]=0
ireg [1:15, 7:12]=2
ireg [1:15, 12:lmax]=3
ireg [3:7, 3:7]=0
freg=ireg + .2 * (1. - rand (kmax, lmax)) # ranf (ireg))
freg=array (freg, Float)
#rt [4:6, 4:6] = -1.e8
z [3:10, 3:12] = z [3:10, 3:12] * .9
z [5, 5] = z [5, 5] * .9
z [17:22, 15:18] = z [17:22, 15:18] * 1.2
z [16, 16] = z [16, 16] * 1.1
orient3 ()
plwf (freg, shade = 1, edges = 0)
[xmin, xmax, ymin, ymax] = draw3 (1)
limits (xmin, xmax, ymin, ymax)
paws ()
nxny = array ( [kmax - 1, lmax - 1])
x0y0 = array ( [0., 0.])
dxdy = array ( [1., 1.])
[nv, xyzv, col] = slice3mesh (nxny, dxdy, x0y0, freg)
[nw, xyzw, col] = slice3mesh (nxny, dxdy, x0y0, freg + ut)
pl3tree (nv, xyzv)
pl3tree (nw, xyzw)
draw3 (1)
limits ( )
paws ()
light3 (ambient = 0, diffuse = .5, specular = 1, sdir = [0, 0, -1])
demo5_light (1)
paws ()
[nv, xyzv, col] = slice3mesh (nxny, dxdy, x0y0, freg, color = freg)
pl3surf (nv, xyzv, values = col)
draw3 (1)
palette ("rainbow.gp")
paws ()
[nv, xyzv, col] = slice3mesh (nxny, dxdy, x0y0, freg, color = z)
pl3surf (nv, xyzv, values = col)
draw3 (1)
paws ()
palette ("stern.gp")
paws ()
[nv, xyzv, col] = slice3mesh (nxny, dxdy, x0y0, z, color = z)
pl3surf (nv, xyzv, values = col)
orient3(phi=0,theta=0)
draw3 (1)
paws ()
set_draw3_ (0)
palette ("gray.gp")
light3 ( diffuse=.1, specular=1., sdir=array([0,0,-1]))
pl3surf (nv, xyzv)
draw3 (1)
paws ()
# spin3 ()
# paws ()
hcp_finish ()
|