-
Notifications
You must be signed in to change notification settings - Fork 6
/
Obstacle.py
31 lines (24 loc) · 1.01 KB
/
Obstacle.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
27
28
29
30
31
'''
(c) 2015 Georgia Tech Research Corporation
This source code is released under the New BSD license. Please see the LICENSE.txt file included with this software for more information
authors: Arindam Bose ([email protected]), Tucker Balch ([email protected])
'''
import numpy as np
class Obstacle(object):
'''
classdocs
'''
def __init__(self, position, radius):
'''
Constructor
'''
self.position = position
self.radius = radius
def draw(self, subplot):
#draw a sphere of specified size at specified position
u = np.linspace(0, 2 * np.pi, 50)
v = np.linspace(0, np.pi, 50)
x = self.radius * np.outer(np.cos(u), np.sin(v)) + self.position[0]
y = self.radius * np.outer(np.sin(u), np.sin(v)) + self.position[1]
z = self.radius * np.outer(np.ones(np.size(u)), np.cos(v)) + self.position[2]
subplot.plot_surface(x, y, z, rstride=4, cstride=4, linewidth = 0, color='#ffff00')