def get_transformed_soup2(self, solution=None):
     """
     Get a transformed copy of soup2 based on the best alignment,
     so it will align with unchanged soup1.
     """
     if solution is None:
         if self.best is None:
             raise ValueError("must be called after finding solution")
         solution = self.best
     soup2x = self.soup2.copy()
     soup2x.transform(v3.translation(-solution.center2))
     soup2x.transform(v3.left_inverse(solution.rot_matrix))
     soup2x.transform(v3.translation(solution.center2))
     return soup2x
def center_vlist(vlist):
    """
    Center a list of v3 vectors and return (center, centered_vlist_copy)
    """
    center = v3.get_center(vlist)
    center_matrix = v3.translation(-center)
    return (center, [v3.transform(center_matrix, v) for v in vlist])