Commits

German Larrain committed 1b79691

graphics.adapters.Trimesh: comments added

  • Participants
  • Parent commits 8009098

Comments (0)

Files changed (1)

File ars/graphics/adapters.py

 		triangle_list = []
 	
 		for face in faces:
+			# get the 3 points of each face
 			p_id = points.InsertNextPoint(*vertices[face[0]])
 			points.InsertNextPoint(*vertices[face[1]])
 			points.InsertNextPoint(*vertices[face[2]])
 			
+			# the triangle is defined by 3 points
 			triangle = vtk.vtkTriangle()
-			triangle.GetPointIds().SetId(0, p_id)
-			triangle.GetPointIds().SetId(1, p_id + 1)
-			triangle.GetPointIds().SetId(2, p_id + 2)
+			triangle.GetPointIds().SetId(0, p_id)		# point 0
+			triangle.GetPointIds().SetId(1, p_id + 1)	# point 1
+			triangle.GetPointIds().SetId(2, p_id + 2)	# point 2
 			triangle_list.append(triangle)
 
+		# insert each triangle into the Vtk data structure
 		for triangle in triangle_list:
 			triangles.InsertNextCell(triangle)
 		
-		# polydata object
+		# polydata object: represents a geometric structure consisting of
+		# vertices, lines, polygons, and/or triangle strips
 		trianglePolyData = vtk.vtkPolyData()
 		trianglePolyData.SetPoints(points)
 		trianglePolyData.SetPolys(triangles)
 		mapper = vtk.vtkPolyDataMapper()
 		mapper.SetInput(trianglePolyData)
 		
-		# actor
+		# actor: represents an object (geometry & properties) in a rendered scene
 		triangles_actor = vtk.vtkActor()
 		VtkAdapter._update_body(triangles_actor, position, rotation)
 		triangles_actor.SetMapper(mapper)