strands.py 文件源码

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

项目:mayakit 作者: danbradham 项目源码 文件源码
def compute_knots(num_points, degree, array_typ=list):
    '''Compute knots for the given number of points

    :param num_points: number of points along curve
    :param degree: degree of curve
    :param array_typ: Type of array to return
    '''

    num_knots = num_points + degree - 1
    knots = array_typ()
    for i in xrange(degree):
        knots.append(0)
    for i in xrange(num_knots - degree * 2):
        knots.append(i + 1)
    for j in xrange(degree):
        knots.append(i + 2)  # exploit leaked reference
    return knots
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号