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