~ubuntu-branches/ubuntu/wily/pygts/wily

« back to all changes in this revision

Viewing changes to .pc/fix_examples.patch/examples/test/die.py

  • Committer: Package Import Robot
  • Author(s): Anton Gladky, Václav Šmilauer
  • Date: 2013-01-26 21:22:37 UTC
  • Revision ID: package-import@ubuntu.com-20130126212237-5l783abxeg1k9iuh
Tags: 0.3.1-1
[ Václav Šmilauer ]
Initial debian package. (Closes: #691799)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /usr/bin/env python
 
2
 
 
3
"""die.py - plots a die
 
4
 
 
5
  Copyright (C) 2009 Thomas J. Duck
 
6
  All rights reserved.
 
7
 
 
8
  Thomas J. Duck <tom.duck@dal.ca>
 
9
  Department of Physics and Atmospheric Science,
 
10
  Dalhousie University, Halifax, Nova Scotia, Canada, B3H 3J5
 
11
 
 
12
NOTICE
 
13
 
 
14
  This library is free software; you can redistribute it and/or
 
15
  modify it under the terms of the GNU Library General Public
 
16
  License as published by the Free Software Foundation; either
 
17
  version 2 of the License, or (at your option) any later version.
 
18
 
 
19
  This library is distributed in the hope that it will be useful,
 
20
  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
21
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
22
  Library General Public License for more details.
 
23
 
 
24
  You should have received a copy of the GNU Library General Public
 
25
  License along with this library; if not, write to the
 
26
  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
27
  Boston, MA 02111-1307, USA.
 
28
"""
 
29
 
 
30
import gts
 
31
from enthought.mayavi import mlab
 
32
import sys
 
33
 
 
34
s1 = gts.cube()
 
35
 
 
36
def add_dot(s1,x,y,z):
 
37
 
 
38
    s2 = gts.sphere(2)
 
39
    s2.scale(0.2,0.2,0.2)
 
40
    s2.translate(x,y,z)
 
41
 
 
42
    return s1.difference(s2)
 
43
 
 
44
## 1
 
45
#s1 = add_dot(s1,0,0,1)
 
46
#
 
47
## 2
 
48
#s1 = add_dot(s1,1,0,0.5)
 
49
#s1 = add_dot(s1,1,0,-0.5)
 
50
#
 
51
## 3
 
52
#s1 = add_dot(s1,0,1,0.65)
 
53
#s1 = add_dot(s1,0,1,-0.65)
 
54
#s1 = add_dot(s1,0,1,0)
 
55
 
 
56
s1.tessellate()
 
57
 
 
58
# 6
 
59
#s1 = add_dot(s1,-0.5,-1,0.65)
 
60
#s1 = add_dot(s1,-0.5,-1.0,0.0)
 
61
#s1 = add_dot(s1,-0.5,-1.0,-0.65)
 
62
#
 
63
#s1 = add_dot(s1,0.5,-1,0.65)
 
64
#s1 = add_dot(s1,0.5,-1,0)
 
65
#s1 = add_dot(s1,0.5,-1,-0.65)
 
66
 
 
67
# Plot the surfaces
 
68
x,y,z,t = gts.get_coords_and_face_indices(s1,True)
 
69
 
 
70
mlab.triangular_mesh(x,y,z,t,color=(0.9,0.9,0.9),representation='fancymesh')
 
71
 
 
72
sys.stdout.flush()
 
73
 
 
74
#x,y,z,t = gts.get_coords_and_face_indices(dot,True)
 
75
#mlab.triangular_mesh(x,y,z,t,color=(0,0,0))
 
76
 
 
77
 
 
78
mlab.show()