-
Notifications
You must be signed in to change notification settings - Fork 3
/
shapes.py
26 lines (22 loc) · 1.26 KB
/
shapes.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
'''Contains basic shapes to draw.
'''
import numpy as np
from three_d.primitives import Edge
from three_d.model import Model
class Cube(Model):
def __init__(self, position, color=0xFFFFFF, side=17, **kwargs):
s = side / 2.0
cube = [Edge(np.array([-s, -s, -s]), np.array([-s, -s, s]), color=color),
Edge(np.array([-s, -s, -s]), np.array([-s, s, -s]), color=color),
Edge(np.array([-s, -s, -s]), np.array([s, -s, -s]), color=color),
Edge(np.array([-s, -s, s]), np.array([-s, s, s]), color=color),
Edge(np.array([-s, -s, s]), np.array([s, -s, s]), color=color),
Edge(np.array([-s, s, -s]), np.array([-s, s, s]), color=color),
Edge(np.array([-s, s, -s]), np.array([s, s, -s]), color=color),
Edge(np.array([s, -s, -s]), np.array([s, s, -s]), color=color),
Edge(np.array([s, -s, -s]), np.array([s, -s, s]), color=color),
Edge(np.array([-s, s, s]), np.array([s, s, s]), color=color),
Edge(np.array([s, -s, s]), np.array([s, s, s]), color=color),
Edge(np.array([s, s, -s]), np.array([s, s, s]), color=color)]
super(Cube, self).__init__(position, edges=cube, **kwargs)
self.side = side