Commits

German Larrain committed cae92a9

new test graphics_adapters, which took the code in adapters._run_tests

Comments (0)

Files changed (2)

ars/graphics/adapters.py

 		triangles_actor.SetMapper(mapper)
 
 		self._actor = triangles_actor
-
-def _run_tests():
-	gAdapter = VtkAdapter()
-	gAdapter.create_window("test")
-	
-	axes1 = Axes()
-	axes2 = Axes(cylinder_radius=0.02)
-	box = Box(size=(0.5,1.0,2.0), position=(2,2,2))
-	cone = Cone(1.0, 0.2, center=(1,1,1))
-	sphere = Sphere(0.5, center=(-2,-2,-2))
-	cyl = Cylinder(length=2, radius=0.25, center=(1,-1,1)) #, orientation=(mut.pi/3,mut.pi/3,mut.pi/3))
-	caps = Capsule(length=2, radius=0.25, center=(-1,-1,-1)) 
-	
-	gAdapter.add_object(axes1)
-	gAdapter.add_object(axes2)
-	gAdapter.add_object(box)
-	gAdapter.add_object(cone)
-	gAdapter.add_object(sphere)
-	gAdapter.add_object(cyl)
-	gAdapter.add_object(caps)
-	
-	# initialized as identity matrix
-	vtk_matrix1 = vtk.vtkMatrix4x4()
-	vtk_matrix2 = vtk.vtkMatrix4x4()
-	vtk_matrix3 = vtk.vtkMatrix4x4()
-	#_values = gut.nestedIterable2tuple(iterable_)
-	#vtk_matrix.DeepCopy(_values)
-
-	# translation
-	vtk_matrix1.Identity()
-	vtk_matrix1.SetElement(0, 3, 1)
-	vtk_matrix1.SetElement(1, 3, 0)
-	vtk_matrix1.SetElement(2, 3, 4)
-	
-	# axes permutation
-	vtk_matrix2.Zero(); vtk_matrix2.SetElement(3, 3, 1) # don't forget to set the lower left corner value!
-	vtk_matrix2.SetElement(0, 2, 1)
-	vtk_matrix2.SetElement(1, 0, 1)
-	vtk_matrix2.SetElement(2, 1, 1)
-	
-	# corresponds to a rotation -74 degrees aprox. around the axis 1/3*(-1,2,2)
-	vtk_matrix3.SetElement(0, 0, 0.36)
-	vtk_matrix3.SetElement(0, 1, 0.48)
-	vtk_matrix3.SetElement(0, 2, -0.8)
-	vtk_matrix3.SetElement(1, 0, -0.8)
-	vtk_matrix3.SetElement(1, 1, 0.60)
-	vtk_matrix3.SetElement(1, 2, 0)
-	vtk_matrix3.SetElement(2, 0, 0.48)
-	vtk_matrix3.SetElement(2, 1, 0.64)
-	vtk_matrix3.SetElement(2, 2, 0.60)
-	
-	#box.bodyObject.SetUserMatrix(vtk_matrix) # concatenates the transform
-	sphere.get_actor().PokeMatrix(vtk_matrix1) # sets the final transform
-	cone.get_actor().PokeMatrix(vtk_matrix2)
-	axes1.get_actor().PokeMatrix(vtk_matrix3)
-	caps.get_actor().PokeMatrix(vtk_matrix3)
-	
-	gAdapter.start_window()
-
-if __name__ == '__main__':
-	print('this is adapters.py')
-	_run_tests()

tests/graphics_adapters.py

+
+# Created on 2012.01.07
+#
+# @author: german
+
+from ars.graphics.adapters import vtk, VtkAdapter, Axes, Box, Capsule, Cone, Cylinder, Sphere
+
+def run_tests():
+	gAdapter = VtkAdapter()
+	gAdapter.create_window("test")
+	
+	axes1 = Axes()
+	axes2 = Axes(cylinder_radius=0.02)
+	box = Box(size=(0.5,1.0,2.0), position=(2,2,2))
+	cone = Cone(1.0, 0.2, center=(1,1,1))
+	sphere = Sphere(0.5, center=(-2,-2,-2))
+	cyl = Cylinder(length=2, radius=0.25, center=(1,-1,1)) #, orientation=(mut.pi/3,mut.pi/3,mut.pi/3))
+	caps = Capsule(length=2, radius=0.25, center=(-1,-1,-1)) 
+	
+	gAdapter.add_object(axes1)
+	gAdapter.add_object(axes2)
+	gAdapter.add_object(box)
+	gAdapter.add_object(cone)
+	gAdapter.add_object(sphere)
+	gAdapter.add_object(cyl)
+	gAdapter.add_object(caps)
+	
+	# initialized as identity matrix
+	vtk_matrix1 = vtk.vtkMatrix4x4()
+	vtk_matrix2 = vtk.vtkMatrix4x4()
+	vtk_matrix3 = vtk.vtkMatrix4x4()
+	#_values = gut.nestedIterable2tuple(iterable_)
+	#vtk_matrix.DeepCopy(_values)
+
+	# translation
+	vtk_matrix1.Identity()
+	vtk_matrix1.SetElement(0, 3, 1)
+	vtk_matrix1.SetElement(1, 3, 0)
+	vtk_matrix1.SetElement(2, 3, 4)
+	
+	# axes permutation
+	vtk_matrix2.Zero(); vtk_matrix2.SetElement(3, 3, 1) # don't forget to set the lower left corner value!
+	vtk_matrix2.SetElement(0, 2, 1)
+	vtk_matrix2.SetElement(1, 0, 1)
+	vtk_matrix2.SetElement(2, 1, 1)
+	
+	# corresponds to a rotation -74 degrees aprox. around the axis 1/3*(-1,2,2)
+	vtk_matrix3.SetElement(0, 0, 0.36)
+	vtk_matrix3.SetElement(0, 1, 0.48)
+	vtk_matrix3.SetElement(0, 2, -0.8)
+	vtk_matrix3.SetElement(1, 0, -0.8)
+	vtk_matrix3.SetElement(1, 1, 0.60)
+	vtk_matrix3.SetElement(1, 2, 0)
+	vtk_matrix3.SetElement(2, 0, 0.48)
+	vtk_matrix3.SetElement(2, 1, 0.64)
+	vtk_matrix3.SetElement(2, 2, 0.60)
+	
+	#box.bodyObject.SetUserMatrix(vtk_matrix) # concatenates the transform
+	sphere.get_actor().PokeMatrix(vtk_matrix1) # sets the final transform
+	cone.get_actor().PokeMatrix(vtk_matrix2)
+	axes1.get_actor().PokeMatrix(vtk_matrix3)
+	caps.get_actor().PokeMatrix(vtk_matrix3)
+	
+	gAdapter.start_window()
+
+if __name__ == '__main__':
+	run_tests()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.