Esempio n. 1
0
 def set_transformation(self, transformation, init=False):
     if not transformation.__class__ == self.Transformation:
         # create an object of the proper type and take only the attributes
         # of interest.
         if isinstance(transformation, Translation):
             t = transformation.t
         else:
             t = None
         if isinstance(transformation, Rotation):
             r = transformation.r
         else:
             r = None
         if self.Transformation == Translation:
             if t is None:
                 transformation = Translation.identity()
             else:
                 transformation = Translation(t)
         elif self.Transformation == Rotation:
             if r is None:
                 transformation = Rotation.identity()
             else:
                 transformation = Rotation(r)
         else:  # self.Transformation == Complete:
             if r is None:
                 r = numpy.identity(3, float)
             if t is None:
                 t = numpy.zeros(3, float)
             transformation = Complete(r, t)
     self.transformation = transformation
     if not init:
         self.invalidate_transformation_list()
Esempio n. 2
0
 def set_transformation(self, transformation, init=False):
     if not transformation.__class__ == self.Transformation:
         # create an object of the proper type and take only the attributes
         # of interest.
         if isinstance(transformation, Translation):
             t = transformation.t
         else:
             t = None
         if isinstance(transformation, Rotation):
             r = transformation.r
         else:
             r = None
         if self.Transformation == Translation:
             if t is None:
                 transformation = Translation.identity()
             else:
                 transformation = Translation(t)
         elif self.Transformation == Rotation:
             if r is None:
                 transformation = Rotation.identity()
             else:
                 transformation = Rotation(r)
         else:  # self.Transformation == Complete:
             if r is None:
                 r = numpy.identity(3, float)
             if t is None:
                 t = numpy.zeros(3, float)
             transformation = Complete(r, t)
     self.transformation = transformation
     if not init:
         self.invalidate_transformation_list()
Esempio n. 3
0
 def reset(self):
     config = context.application.configuration
     self.rotation_center = Translation.identity()
     self.rotation = Rotation.identity()
     self.eye = Translation([0,0,config.viewer_distance])
     self.opening_angle = config.opening_angle
     self.window_size = config.window_size
     self.window_depth = config.window_depth
Esempio n. 4
0
 def reset(self):
     config = context.application.configuration
     self.rotation_center = Translation.identity()
     self.rotation = Rotation.identity()
     self.eye = Translation([0, 0, config.viewer_distance])
     self.opening_angle = config.opening_angle
     self.window_size = config.window_size
     self.window_depth = config.window_depth
Esempio n. 5
0
 def initnonstate(self):
     GLPeriodicContainer.initnonstate(self)
     self.model_center = Translation.identity()
Esempio n. 6
0
 def default_parameters(cls):
     result = Parameters()
     result.translation = Translation.identity()
     return result
Esempio n. 7
0
 def default_parameters(cls):
     result = Parameters()
     result.center = Translation.identity()
     result.rotation = Rotation.identity()
     return result
Esempio n. 8
0
 def get_model_center(self):
     universe = context.application.model.universe
     if universe is None:
         return Translation.identity()
     else:
         return universe.model_center
Esempio n. 9
0
 def initnonstate(self):
     GLPeriodicContainer.initnonstate(self)
     self.model_center = Translation.identity()
Esempio n. 10
0
 def default_parameters(cls):
     result = Parameters()
     result.translation = Translation.identity()
     return result
Esempio n. 11
0
 def default_parameters(cls):
     result = Parameters()
     result.center = Translation.identity()
     result.rotation = Rotation.identity()
     return result
Esempio n. 12
0
 def get_model_center(self):
     universe = context.application.model.universe
     if universe is None:
         return Translation.identity()
     else:
         return universe.model_center