fdf1cc7b363fddbf650b92fdcd973bad03a038dc
3 # Copyright 2014 MINES ParisTech
5 # This file is part of LinPy.
7 # LinPy is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # LinPy is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with LinPy. If not, see <http://www.gnu.org/licenses/>.
20 import matplotlib
.pyplot
as plt
22 from matplotlib
import pylab
23 from mpl_toolkits
.mplot3d
import Axes3D
27 x
, y
, z
= symbols('x y z')
29 fig
= plt
.figure(facecolor
='white')
31 diam_plot
= fig
.add_subplot(2, 2, 1, aspect
='equal')
32 diam_plot
.set_title('Diamond')
33 diam
= Ge(y
, x
- 1) & Le(y
, x
+ 1) & Ge(y
, -x
- 1) & Le(y
, -x
+ 1)
34 diam
.plot(diam_plot
, fill
=True, edgecolor
='red', facecolor
='yellow')
36 cham_plot
= fig
.add_subplot(2, 2, 2, projection
='3d', aspect
='equal')
37 cham_plot
.set_title('Chamfered cube')
38 cham
= Le(0, x
) & Le(x
, 3) & Le(0, y
) & Le(y
, 3) & Le(0, z
) & Le(z
, 3) & \
39 Le(z
- 2, x
) & Le(x
, z
+ 2) & Le(1 - z
, x
) & Le(x
, 5 - z
) & \
40 Le(z
- 2, y
) & Le(y
, z
+ 2) & Le(1 - z
, y
) & Le(y
, 5 - z
) & \
41 Le(y
- 2, x
) & Le(x
, y
+ 2) & Le(1 - y
, x
) & Le(x
, 5 - y
)
42 cham
.plot(cham_plot
, facecolors
=(1, 0, 0, 0.75))
44 rhom_plot
= fig
.add_subplot(2, 2, 3, projection
='3d', aspect
='equal')
45 rhom_plot
.set_title('Rhombicuboctahedron')
47 Le(x
+ y
+ z
, 7) & Ge(-2, -x
- y
- z
) & \
48 Le(-1, x
+ y
- z
) & Le(x
+ y
- z
, 4) & \
49 Le(-1, x
- y
+ z
) & Le(x
- y
+ z
, 4) & \
50 Le(-1, -x
+ y
+ z
) & Le(-x
+ y
+ z
, 4)
51 rhom
.plot(rhom_plot
, facecolors
=(0, 1, 0, 0.75))
53 cubo_plot
= fig
.add_subplot(2, 2, 4, projection
='3d', aspect
='equal')
54 cubo_plot
.set_title('Truncated cuboctahedron')
55 cubo
= Le(0, x
) & Le(x
, 5) & Le(0, y
) & Le(y
, 5) & Le(0, z
) & Le(z
, 5) & \
56 Le(x
-4, y
) & Le(y
, x
+ 4) & Le(-x
+ 1, y
) & Le(y
, -x
+ 9) & \
57 Le(y
-4, z
) & Le(z
, y
+ 4) & Le(-y
+ 1, z
) & Le(z
, -y
+ 9) & \
58 Le(z
-4, x
) & Le(x
, z
+ 4) & Le(-z
+ 1, x
) & Le(x
, -z
+ 9) & \
59 Le(3, x
+ y
+ z
) & Le(x
+ y
+ z
, 12) & \
60 Le(-2, x
- y
+ z
) & Le(x
- y
+ z
, 7) & \
61 Le(-2, -x
+ y
+ z
) & Le(-x
+ y
+ z
, 7) & \
62 Le(-2, x
+ y
- z
) & Le(x
+ y
- z
, 7)
63 cubo
.plot(cubo_plot
, facecolors
=(0, 0, 1, 0.75))