1. German Larrain
  2. ars

Commits

German Larrain  committed 580a59f

graphics.adapters: comments cleanup, classdocs update for Sphere, and some debug printing was commented out

  • Participants
  • Parent commits 1b79691
  • Branches dev

Comments (0)

Files changed (1)

File ars/graphics/adapters.py

View file
  • Ignore whitespace
 
 import vtk
 
-from ars import graphics as gp #TODO: change to import ars.graphics as gp
+import ars.graphics as gp
 from ..utilities import mathematical as mut
 
 class VtkAdapter(gp.Adapter):
 		
 		self.renWin.Render()
 		
-		print(self.ren.GetActiveCamera().GetPosition())
-		print(self.ren.GetActiveCamera().GetFocalPoint())
+		#=======================================================================
+		# print(self.ren.GetActiveCamera().GetPosition())
+		# print(self.ren.GetActiveCamera().GetFocalPoint())
+		#=======================================================================
 		
 		#=======================================================================
 		# if not self._windowStarted:
 		raise Exception()
 
 	@staticmethod
-	def _update_body(body, position, rotation): #orientation):
+	def _update_body(body, position, rotation):
 		t = VtkAdapter._create_transform_matrix(position, rotation)
 		VtkAdapter._set_object_transform_matrix(body, t)
 		
 	def __init__(self, position=(0,0,0), cylinder_radius=0.05):
 		super(Axes, self).__init__(position, cylinder_radius)
 		
-		# 2 different methods were used here
+		# 2 different methods may be used here
 		# see http://stackoverflow.com/questions/7810632/how-to-use-and-set-axes-in-a-3d-scene
 
 		axesActor = vtk.vtkAxesActor()
 
 class Box(VtkBody, gp.Box):
 	def __init__(self, size, position, rotation=None):
-		super(Box, self).__init__(size, position, rotation) # http://docs.python.org/library/functions.html#super
+		super(Box, self).__init__(size, position, rotation)
 
 		box = vtk.vtkCubeSource()
 		box.SetXLength(size[0])
 		self._actor = coneActor
 
 class Sphere(VtkBody, gp.Sphere):
+	'''
+	VTK: sphere (represented by polygons) of specified radius centered at the origin.
+	The resolution (polygonal discretization) in both the latitude (phi) and longitude (theta)
+	directions can be specified.
+	'''
+	
 	def __init__(self, radius, center, rotation=None, phiResolution = 20, thetaResolution = 20):
 		super(Sphere, self).__init__(radius, center, rotation, phiResolution, thetaResolution)
 
-		'''
-		VTK: sphere (represented by polygons) of specified radius centered at the origin.
-		The resolution (polygonal discretization) in both the latitude (phi) and longitude (theta)
-		directions can be specified.
-		'''
 		sphere = vtk.vtkSphereSource()	
 		sphere.SetRadius(radius)
 		sphere.SetPhiResolution(phiResolution) # it is the circumferential number of facets
 	def __init__(self, length, radius, center, rotation=None, resolution=20):
 		super(Cylinder, self).__init__(length, radius, center, rotation, resolution)
 
-		'''
-		VTK: The axis of the cylinder is aligned along the global y-axis.
-		'''
+		# VTK: The axis of the cylinder is aligned along the global y-axis.
 		cyl = vtk.vtkCylinderSource()
 		cyl.SetHeight(length)
 		cyl.SetRadius(radius)