diff options
author | Anthony LaTorre <tlatorre9@gmail.com> | 2011-06-18 00:12:09 -0400 |
---|---|---|
committer | Anthony LaTorre <tlatorre9@gmail.com> | 2011-06-18 00:12:09 -0400 |
commit | ab54917bceb4943f6750f589ffe6a032b2770fb1 (patch) | |
tree | e76ede76a1344820c424f2c07bc44ef22201864c /solid.py | |
parent | 34ff4d6c734e5adf3aa8a0e7ca89031effdb1489 (diff) | |
download | chroma-ab54917bceb4943f6750f589ffe6a032b2770fb1.tar.gz chroma-ab54917bceb4943f6750f589ffe6a032b2770fb1.tar.bz2 chroma-ab54917bceb4943f6750f589ffe6a032b2770fb1.zip |
moved class definitions for Solid, Mesh, Material, and Surface into geometry.py and moved instances of these classes into separate folders. the Solid object no longer contains a rotation, displacement, or id variable; instead, they are passed to a geometry object when calling add_solid().
Diffstat (limited to 'solid.py')
-rw-r--r-- | solid.py | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/solid.py b/solid.py deleted file mode 100644 index 707a786..0000000 --- a/solid.py +++ /dev/null @@ -1,49 +0,0 @@ -import numpy as np - -class Solid(object): - def __init__(self, id, mesh, rotation=np.identity(3), displacement=(0,0,0), material1=None, material2=None, surface=None, color=0xffffffff): - self.id = id - self.mesh = mesh - - if rotation.shape != (3,3): - raise ValueError('shape mismatch') - - self.rotation = rotation.astype(np.float32) - - displacement = np.asarray(displacement, dtype=np.float32) - - if displacement.shape != (3,): - raise ValueError('shape mismatch') - - self.displacement = displacement - - if np.iterable(material1): - if len(material1) != len(mesh): - raise ValueError('shape mismatch') - self.material1 = np.array(material1, dtype=np.object) - else: - self.material1 = np.tile(material1, len(self.mesh)) - - if np.iterable(material2): - if len(material2) != len(mesh): - raise ValueError('shape mismatch') - self.material2 = np.array(material2, dtype=np.object) - else: - self.material2 = np.tile(material2, len(self.mesh)) - - if np.iterable(surface): - if len(surface) != len(mesh): - raise ValueError('shape mismatch') - self.surface = np.array(surface, dtype=np.object) - else: - self.surface = np.tile(surface, len(self.mesh)) - - if np.iterable(color): - if len(color) != len(mesh): - raise ValueError('shape mismatch') - self.color = np.array(color, dtype=np.uint32) - else: - self.color = np.tile(color, len(self.mesh)).astype(np.uint32) - - def __len__(self): - return len(self.mesh) |