def do(self): cache = context.application.cache for node in cache.nodes: child_translations = [] translated_children = [] for child in node.children: if isinstance(child, GLTransformationMixin) and isinstance(child.transformation, Translation): if child.get_fixed(): translated_children = [] break translated_children.append(child) child_translations.append(child.transformation) if len(translated_children) > 0: translation = Translation(calculate_center(child_translations)) CenterAlignBase.do(self, node, translated_children, translation)
def do(self): cache = context.application.cache for node in cache.nodes: child_translations = [] translated_children = [] for child in node.children: if isinstance(child, GLTransformationMixin) and isinstance( child.transformation, Translation): if child.get_fixed(): translated_children = [] break translated_children.append(child) child_translations.append(child.transformation) if len(translated_children) > 0: translation = Translation(calculate_center(child_translations)) CenterAlignBase.do(self, node, translated_children, translation)
def analyze_selection(): # A) calling ancestor if not CenterAlignBase.analyze_selection(): return False # B) validating cache = context.application.cache for node in cache.nodes: if not isinstance(node, ContainerMixin): return False # C) passed all tests: return True
def do(self): cache = context.application.cache for node in cache.nodes: translated_children = [] for child in node.children: if isinstance(child, GLTransformationMixin) and isinstance(child.transformation, Translation): if child.get_fixed(): translated_children = [] break translated_children.append(child) if len(translated_children) == 0: continue mass, com = compute_center_of_mass(iter_particles(node)) if mass == 0.0: continue CenterAlignBase.do(self, node, translated_children, Translation(com))
def analyze_selection(): # A) calling ancestor if not CenterAlignBase.analyze_selection(): return False # B) validating cache = context.application.cache node = cache.node if not isinstance(node, GLTransformationMixin): return False if not isinstance(node.transformation, Rotation): return False if cache.some_neighbors_fixed: return False # C) passed all tests: return True
def do(self): cache = context.application.cache for node in cache.nodes: translated_children = [] for child in node.children: if isinstance(child, GLTransformationMixin) and isinstance( child.transformation, Translation): if child.get_fixed(): translated_children = [] break translated_children.append(child) if len(translated_children) == 0: continue mass, com = compute_center_of_mass(iter_particles(node)) if mass == 0.0: continue CenterAlignBase.do(self, node, translated_children, Translation(com))
def do(self): cache = context.application.cache for node in cache.nodes: transformation = Complete() translated_children = [] for child in node.children: if isinstance(child, GLTransformationMixin) and isinstance(child.transformation, Translation): if child.get_fixed(): translated_children = [] break translated_children.append(child) if len(translated_children) == 0: continue mass, com = compute_center_of_mass(yield_particles(node)) if mass == 0.0: continue transformation.t = com tensor = compute_inertia_tensor(yield_particles(node), com) transformation.r = default_rotation_matrix(tensor) CenterAlignBase.do(self, node, translated_children, transformation)
def do(self): cache = context.application.cache rotation = Rotation() rotation.r = copy.deepcopy(cache.node.transformation.r) CenterAlignBase.do(self, cache.parent, cache.transformed_neighbors, rotation)
def do(self): cache = context.application.cache translation = Translation() translation.t = copy.deepcopy(cache.node.transformation.t) CenterAlignBase.do(self, cache.parent, cache.translated_neighbors, translation)
def do(self): cache = context.application.cache CenterAlignBase.do(self, cache.parent, cache.transformed_neighbors, cache.node.transformation)
def do(self): cache = context.application.cache rotation = Rotation(cache.node.transformation.r) CenterAlignBase.do(self, cache.parent, cache.transformed_neighbors, rotation)
def do(self): cache = context.application.cache translation = Translation(cache.node.transformation.t) CenterAlignBase.do(self, cache.parent, cache.translated_neighbors, translation)