forked from arindam1993/PyBioSim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
World.py
38 lines (27 loc) · 820 Bytes
/
World.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
32
33
34
35
36
37
38
'''
Created on Jan 16, 2015
@author: Arindam
'''
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
from pylab import *
import os
class World(object):
def __init__(self, width, height):
self.agents=[]
self.obstacles=[]
self.balls=[]
self.width = width
self.height = height
def draw(self, ax):
ax.set_xlim3d(-self.width,self.width)
ax.set_ylim3d(-self.width,self.width)
ax.set_zlim3d(-self.height,self.height)
for agent in self.agents:
agent.draw(ax)
for obstacle in self.obstacles:
obstacle.draw(ax)
for ball in self.balls:
ball.draw(ax)
return ax