Exemplo n.º 1
0
 def __init__(self, rest_length=0.0):
     Terminus.__init__(self)
     self.coordinates = []
     self.frames = []
     if rest_length < 0.0:
         raise Error("The rest length of a spring must be zero or positive.")
     self.rest_length = rest_length
Exemplo n.º 2
0
 def __init__(self, rest_length=0.0):
     Terminus.__init__(self)
     self.coordinates = []
     self.frames = []
     if rest_length < 0.0:
         raise Error(
             "The rest length of a spring must be zero or positive.")
     self.rest_length = rest_length
Exemplo n.º 3
0
 def sanity_check(self):
     if len(self.frames) != 2:
         raise Error("A Spring expression needs two frames.")
     if len(self.input_variables) > 2:
         raise Error("A Spring expression needs at most two input_variables.")
     if len(self.coordinates) != 2:
         raise Error("A Spring energy term must have two coordinates.")
     Terminus.sanity_check(self)
Exemplo n.º 4
0
 def register_input_variable(self, variable, coordinate):
     if not (isinstance(variable, Frame) or isinstance(variable, Translation) or isinstance(variable, NoFrame)):
         raise Error("Expression requires iterative.var.Frame or iterative.var.Translation as variable")
     self.coordinates.append(coordinate)
     self.frames.append(variable)
     if not isinstance(variable, NoFrame):
         variable.add_mass(coordinate)
         Terminus.register_input_variable(self, variable)
Exemplo n.º 5
0
 def sanity_check(self):
     if len(self.frames) != 2:
         raise Error("A Spring expression needs two frames.")
     if len(self.input_variables) > 2:
         raise Error(
             "A Spring expression needs at most two input_variables.")
     if len(self.coordinates) != 2:
         raise Error("A Spring energy term must have two coordinates.")
     Terminus.sanity_check(self)
Exemplo n.º 6
0
 def register_input_variable(self, variable, coordinate):
     if not (isinstance(variable, Frame) or isinstance(
             variable, Translation) or isinstance(variable, NoFrame)):
         raise Error(
             "Expression requires iterative.var.Frame or iterative.var.Translation as variable"
         )
     self.coordinates.append(coordinate)
     self.frames.append(variable)
     if not isinstance(variable, NoFrame):
         variable.add_mass(coordinate)
         Terminus.register_input_variable(self, variable)