surfaces_manifold.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:lddmm-ot 作者: jeanfeydy 项目源码 文件源码
def to_varifold(self, q) :
        # Compute edges's vertices
        a = q[self.connectivity[:,0]]
        b = q[self.connectivity[:,1]]
        c = q[self.connectivity[:,2]]
        # A surface is represented as a sum of dirac, one for each triangle
        x  = .33333333 * (a + b + c)                 # Mean

        # Cross product
        ab = (b-a).dimshuffle(0, 1, 'x')
        ac = (c-a).dimshuffle(0, 'x', 1)

        t = (ab * ac).reshape((self.connectivity.shape[0], 9))
        cp = t.dot( np.array( [
                    [0., 0.,  0.,  0., 0., 1., 0., -1., 0.],
                    [0., 0., -1.,  0., 0., 0., 1.,  0., 0.],
                    [0., 1.,  0., -1., 0., 0., 0.,  0., 0.]
                    ]
                ).T)

        mu = T.sqrt( (cp**2).sum(1) )  # Length
        u  = ( cp / mu.dimshuffle(0,'x'))    # Normal direction
        mu = T.cast(.5*mu,  dtype=config.floatX)
        u  = T.cast(u,   dtype=config.floatX)
        return (x, mu, u)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号