SplineObject.py 文件源码

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

项目:Splipy 作者: sintefmath 项目源码 文件源码
def insert_knot(self, knot, direction=0):
        """  Insert a new knot into the spline.

        :param int direction: The direction to insert in
        :param knot: The new knot(s) to insert
        :type knot: float or [float]
        :raises ValueError: For invalid direction
        :return: self
        """
        shape  = self.controlpoints.shape

        # for single-value input, wrap it into a list
        knot = ensure_listlike(knot)

        direction = check_direction(direction, self.pardim)

        C = np.matrix(np.identity(shape[direction]))
        for k in knot:
            C = self.bases[direction].insert_knot(k) * C
        self.controlpoints = np.tensordot(C, self.controlpoints, axes=(1, direction))
        self.controlpoints = self.controlpoints.transpose(transpose_fix(self.pardim, direction))

        return self
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号