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