Beispiel #1
0
  def update_pos(self,matrix) :
    ''' Apply changing contains in the matrix argument. '''
    
    if not isinstance(matrix, Matrix) :
      raise TypeError(matrix,Matrix)
    
    center=[]
    tmp_polyhedron=[]
    
    for polygon in self.polyhedron :
      # Loop over every polygon from the polyhedron. 
      tmp_polygon=[]
      
      for vertex in polygon :
	# Loop over every vertice from the polygon.
	
	res_vertex= matrix * vertex # Multiply the current vertice with the matrix
 	
 	# Storing the new position from the vertice.
 	tmp_polygon.append(res_vertex)  # For the polyhedron polygon container.
	center.append(res_vertex)       # For polyhedron center computing.
      
      tmp_polyhedron.append(tmp_polygon)
    
    self.polyhedron=tmp_polyhedron                  # Update the polygon container with the new postion from every vertice.
    
    self.center=get_center_from_polyhedron(center)  # Update the polyhedron center.  
    
    self.ls= matrix * self.ls                       # Update the localview.
    def update_pos(self, matrix):
        ''' Apply changing contains in the matrix argument. '''

        if not isinstance(matrix, Matrix):
            raise TypeError(matrix, Matrix)

        center = []
        tmp_polyhedron = []

        for polygon in self.polyhedron:
            # Loop over every polygon from the polyhedron.
            tmp_polygon = []

            for vertex in polygon:
                # Loop over every vertice from the polygon.

                res_vertex = matrix * vertex  # Multiply the current vertice with the matrix

                # Storing the new position from the vertice.
                tmp_polygon.append(
                    res_vertex)  # For the polyhedron polygon container.
                center.append(res_vertex)  # For polyhedron center computing.

            tmp_polyhedron.append(tmp_polygon)

        self.polyhedron = tmp_polyhedron  # Update the polygon container with the new postion from every vertice.

        self.center = get_center_from_polyhedron(
            center)  # Update the polyhedron center.

        self.ls = matrix * self.ls  # Update the localview.
Beispiel #3
0
  def update_pos(self,matrix) :
    ''' Apply changing contains in the matrix argument. '''
    
    if not isinstance(matrix, Matrix) :
      raise TypeError(matrix,Matrix)
    
    center=[]
    tmp_polyhedron=[]
    for lines in self.polygons :
      # Loop over every line from the sphere. 
      tmp_polygon=[]
      for vertex in lines :
	# Loop over every line from the line.
	
	res_vertex= matrix * vertex # Multiply the current vertice with the matrix
 	
 	# Storing the new position from the vertice.
 	tmp_polygon.append(res_vertex)  # For the sphere polygon container.
	center.append(res_vertex)       # For sphere center computing.
	
      tmp_polyhedron.append(tmp_polygon)
    
    self.polygons=tmp_polyhedron
    
    self.center=get_center_from_polyhedron(center)  
    
    self.ls= matrix * self.ls