def flatten(self, ind):
'''
Transform the set of points so that the subset of markers given as argument is
as close as flat (wrt z-axis) as possible.
Parameters
----------
ind : list of bools
Lists of marker indices that should be all in the same subspace
'''
# Transform references to indices if needed
ind = [self.key2ind(s) for s in ind]
# center point cloud around the group of indices
centroid = self.X[:,ind].mean(axis=1, keepdims=True)
X_centered = self.X - centroid
# The rotation is given by left matrix of SVD
U,S,V = la.svd(X_centered[:,ind], full_matrices=False)
self.X = np.dot(U.T, X_centered) + centroid
评论列表
文章目录