/[escript]/branches/mvexpr/pycad/py_src/shapes.py
ViewVC logotype

Contents of /branches/mvexpr/pycad/py_src/shapes.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4401 - (show annotations)
Fri May 10 05:14:06 2013 UTC (6 years, 5 months ago) by jfenwick
File MIME type: text/x-python
File size: 2178 byte(s)
Trying a directory swap

1
2 ##############################################################################
3 #
4 # Copyright (c) 2003-2013 by University of Queensland
5 # http://www.uq.edu.au
6 #
7 # Primary Business: Queensland, Australia
8 # Licensed under the Open Software License version 3.0
9 # http://www.opensource.org/licenses/osl-3.0.php
10 #
11 # Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 # Development since 2012 by School of Earth Sciences
13 #
14 ##############################################################################
15
16 __copyright__="""Copyright (c) 2003-2013 by University of Queensland
17 http://www.uq.edu.au
18 Primary Business: Queensland, Australia"""
19 __license__="""Licensed under the Open Software License version 3.0
20 http://www.opensource.org/licenses/osl-3.0.php"""
21 __url__="https://launchpad.net/escript-finley"
22
23 """
24 some basic shapes.
25
26 :var __author__: name of author
27 :var __copyright__: copyrights
28 :var __license__: licence agreement
29 :var __url__: url entry point on documentation
30 :var __version__: version
31 :var __date__: date of the version
32 """
33
34 __author__="Lutz Gross, l.gross@uq.edu.au"
35
36 from .primitives import *
37
38 def Brick(start,end):
39 """
40 Creates a brick with given start and end point.
41 """
42 dx=end.getCoordinates()-start.getCoordinates()
43 p000=start+[ 0.,0.,0.]
44 p100=start+[dx[0],0.,0.]
45 p010=start+[0.,dx[1],0.]
46 p110=start+[dx[0],dx[1],0.]
47 p001=start+[0.,0.,dx[2]]
48 p101=start+[dx[0],0.,dx[2]]
49 p011=start+[0.,dx[1],dx[2]]
50 p111=start+[dx[0],dx[1],dx[2]]
51 l10=Line(p000,p100)
52 l20=Line(p100,p110)
53 l30=Line(p110,p010)
54 l40=Line(p010,p000)
55 l11=Line(p000,p001)
56 l21=Line(p100,p101)
57 l31=Line(p110,p111)
58 l41=Line(p010,p011)
59 l12=Line(p001,p101)
60 l22=Line(p101,p111)
61 l32=Line(p111,p011)
62 l42=Line(p011,p001)
63 bottom=PlaneSurface(CurveLoop(-l10,-l40,-l30,-l20))
64 top=PlaneSurface(CurveLoop(l12,l22,l32,l42))
65 front=PlaneSurface(CurveLoop(-l11,l10,l21,-l12))
66 back=PlaneSurface(CurveLoop(l30,l41,-l32,-l31))
67 left=PlaneSurface(CurveLoop(l11,-l42,-l41,l40))
68 right=PlaneSurface(CurveLoop(-l21,l20,l31,-l22))
69 return SurfaceLoop(bottom,top,front,back,left,right)
70

  ViewVC Help
Powered by ViewVC 1.1.26