Beispiel #1
0
 def deserialize(self, version, context):
     quaternion = Quaternion()
     x = context.read_float()
     y = context.read_float()
     z = context.read_float()
     w = context.read_float()
     quaternion.set(x, y, z, w)
     return quaternion
 def make_menu(self):
     self.menu = nanome.ui.Menu()
     self.menu_position = Vector3()
     self.menu_rotation = Quaternion()
     self.menu_scale = Vector3()
     self.last = time.time()
     self.outstanding = True
     self.update_menu(self.menu)
     self.request_menu_transform(0, lambda _1, _2, _3: None)
     self.set_menu_transform(0, self.menu_position, self.menu_rotation,
                             self.menu_scale)
     self.request_menu_transform(0, self.check_menu_stats)
Beispiel #3
0
def create_complex():
    val = struct.Complex()
    val.index = 1000
    val._molecules = [struct.Molecule(), create_molecule(), struct.Molecule(), create_molecule()]
    val.boxed = True
    val.visible = False
    val.computing = False
    val.set_current_frame(0)
    val.name = "COMPLEX_NAME"
    val._remarks = dict([("key1", "val1"), ("key2","val2"),("key3", "val3"), ("key4","val4")])
    val.position = Vector3(1,2,3)
    val.rotation = Quaternion(1,2,3,4)
    return val
def random_quaternion():
    #double x,y,z, u,v,w, s
    x = rand_float(-1, 1)
    y = rand_float(-1, 1)
    z = x * x + y * y
    while (z > 1):
        x = rand_float(-1, 1)
        y = rand_float(-1, 1)
        z = x * x + y * y
    u = rand_float(-1, 1)
    v = rand_float(-1, 1)
    w = u * u + v * v
    while (w > 1):
        u = rand_float(-1, 1)
        v = rand_float(-1, 1)
        w = u * u + v * v
    s = math.sqrt((1 - z) / w)
    return Quaternion(x, y, s * u, s * v)
Beispiel #5
0
 def __init__(self):
     super(_Complex, self).__init__()
     #Molecular
     self._name = "complex"
     self._index_tag = 0
     self._split_tag = ""
     self._remarks = {}
     #Rendering
     self._boxed = False
     self._locked = False
     self._visible = True
     self._computing = False
     self._current_frame = 0
     self._selected = False  #selected on live
     self._surface_dirty = False
     self._surface_refresh_rate = -1.0  # Not used yet, future auto surface refresh
     self._box_label = ""
     #Transform
     self._position = Vector3(0, 0, 0)
     self._rotation = Quaternion(0, 0, 0, 0)
     self._molecules = []
     self._parent = None
Beispiel #6
0
def create_workspace():
    workspace = struct.Workspace()
    workspace.complexes = [struct.Complex(), create_complex(), struct.Complex(), create_complex()]
    workspace.position = Vector3(1,2,3)
    workspace.rotation = Quaternion(1,2,3,4)
    return workspace
Beispiel #7
0
 def __init__(self):
     self._position = Vector3()
     self._rotation = Quaternion()
     self._scale = Vector3(0.02,0.02,0.02)
     self._complexes = []