Commits

German Larrain  committed eaea3a9

simulator.Simulation: added attribute 'graph_adapter', needed to remove the
direct access to module 'graphics.adapters'.

  • Participants
  • Parent commits eae8447

Comments (0)

Files changed (2)

File ars/app/__init__.py

 		"""
 		# set up the simulation parameters
 		self.sim = Simulation(self.FPS, self.STEPS_PER_FRAME)
+		self.sim.graph_adapter = gp
 		self.sim.add_basic_simulation_objects()
 
 		if add_axes:

File ars/model/simulator/__init__.py

 from abc import ABCMeta, abstractmethod
 
 from ...constants import G_VECTOR
-from ...graphics import adapters as gp
 from ...lib.pydispatch import dispatcher
 from ...model.collision import adapters as coll
 from ...model.physics import adapters as phs
 
 		self.coll_engine = coll.Engine()
 		self.phs_engine = phs.Engine()
+		self.graph_adapter = None  # perhaps visualization is a better suited name
 
 	def add_basic_simulation_objects(self, gravity=G_VECTOR):
 		"""Create the basic simulation objects needed for physics and collision
 		return self._space
 
 	def add_axes(self):
-		gAxes = gp.Axes()
+		gAxes = self.graph_adapter.Axes()
 		name = 'axes'
 		return self.add_object(SimulatedObject(name, actor=gAxes))
 
 		# 	of the box
 		self._floor_geom = coll.Plane(self._space, normal, dist)
 		# TODO: use normal parameter for orientation
-		gFloor = gp.Box(box_size, box_center)
+		gFloor = self.graph_adapter.Box(box_size, box_center)
 		gFloor.set_color(color)
 		name = "floor"
 		# TODO: why SimulatedObject? See 'add_trimesh_floor'
 		self._floor_geom = coll.Trimesh(self._space, vertices, faces)
 		self._floor_geom.set_position(center)
 
-		gFloor = gp.Trimesh(vertices, faces, center)
+		gFloor = self.graph_adapter.Trimesh(vertices, faces, center)
 		gFloor.set_color(color)
 		name = 'floor'
 		# TODO: why SimulatedBody? See 'add_floor'
 		body = phs.Sphere(self._world, self._space, radius, mass, density)
 		body.set_position(center)
 
-		g_sphere = gp.Sphere(radius, center)
+		g_sphere = self.graph_adapter.Sphere(radius, center)
 		name = 'sphere'
 		return self.add_object(SimulatedBody(name, body, g_sphere))
 
 		body = phs.Box(self._world, self._space, size, mass, density)
 		body.set_position(center)
 
-		g_box = gp.Box(size, center)
+		g_box = self.graph_adapter.Box(size, center)
 		name = 'box' + str(center)  # FIXME
 		return self.add_object(SimulatedBody(name, body, g_box))
 
 		body = phs.Cylinder(self._world, self._space, length, radius, mass, density)
 		body.set_position(center)
 
-		g_cylinder = gp.Cylinder(length, radius, center)
+		g_cylinder = self.graph_adapter.Cylinder(length, radius, center)
 		name = 'cylinder'
 		return self.add_object(SimulatedBody(name, body, g_cylinder))
 
 		body = phs.Capsule(self._world, self._space, length, radius, mass, density)
 		body.set_position(center)
 
-		g_capsule = gp.Capsule(length, radius, center)
+		g_capsule = self.graph_adapter.Capsule(length, radius, center)
 		name = 'capsule'
 		return self.add_object(SimulatedBody(name, body, g_capsule))