当前位置: 首页>>代码示例>>Python>>正文


Python Vector.asTuple方法代码示例

本文整理汇总了Python中Vector.asTuple方法的典型用法代码示例。如果您正苦于以下问题:Python Vector.asTuple方法的具体用法?Python Vector.asTuple怎么用?Python Vector.asTuple使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Vector的用法示例。


在下文中一共展示了Vector.asTuple方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: oscillateCurve

# 需要导入模块: import Vector [as 别名]
# 或者: from Vector import asTuple [as 别名]
def oscillateCurve( curve, start=0.0, end=1.0, freq=1.0, ease=0.5, strength=1.0 ):
    """ Oscillates a given curve by moving each vertex in an alternating
        direction based on the normal.  This process takes place over the
        range defined by "start" and "end" as percentages of arc length.
        Oscillation eases to full strength as determined by the "ease" and
        "strength" arguments. """
    if(ease > (end-start)*0.5):
        ease = (end-start)*0.5
    if(start < end):
        CVs = mc.getAttr( curve+".cv[*]" )
        newCVs = findCVsInRange(curve, start, end)
        for (I,U,L) in newCVs:
            interp = (L-start)/(end-start)
            osc = sin(freq*interp)
            scale = pulse(start+ease, end, ease, L)  # ease must be between 0 and 0.5
## Don't use Maya's normalized normal -- it flip flops with curvature so it's not good for oscillating offset
#            normal = Vector(mc.pointOnCurve(curve, parameter=cv[1], normalizedNormal=True))
#            if(normal.mag() == 0.0):
#                print "Getting normal from up x tangent"
            normal = Vector(0,1,0)**Vector(mc.pointOnCurve(curve, parameter=U, tangent=True))
            normal = normal.norm()
            pos = Vector(CVs[I])
            pos = pos+normal*scale*strength*osc
            CVs[I] = pos.asTuple()

    for i,cv in enumerate(CVs):
        mc.setAttr(curve+".cv[%d]"%i, cv[0], cv[1], cv[2])

    return curve
开发者ID:jeisenma,项目名称:traceSelectionInMaya,代码行数:31,代码来源:curveUtil.py

示例2: noiseCurve

# 需要导入模块: import Vector [as 别名]
# 或者: from Vector import asTuple [as 别名]
def noiseCurve( curve, start=0.0, end=1.0, freq=1.0, ease=0.5, strength=1.0 ):
    """ Adds noise to a given curve by moving each vertex with Perlin
        noise based on the normal.  This process takes place over the
        range defined by "start" and "end" as percentages of arc length.
        Noise eases to full strength as determined by the "ease" and
        "strength" arguments. """
    if(ease > (end-start)*0.5):         # ease must be between 0 and 0.5
        ease = (end-start)*0.5
    if(start < end):
        CVs = mc.getAttr( curve+".cv[*]" )
        newCVs = findCVsInRange(curve, start, end)
        for (I,U,L) in newCVs:
            interp = (L-start)/(end-start)
            noiz = noise(freq*interp)
            scale = pulse(start+ease, end, ease, L)  
            normal = Vector(0,1,0)**Vector(mc.pointOnCurve(curve, parameter=U, tangent=True))
            normal = normal.norm()
            pos = Vector(CVs[I])
            pos = pos+normal*scale*strength*noiz
            CVs[I] = pos.asTuple()
    for i,cv in enumerate(CVs):
        print(curve+".cv[%d]"%cv[0], cv[0], cv[1], cv[2])
        mc.setAttr(curve+".cv[%d]"%i, cv[0], cv[1], cv[2])
开发者ID:jeisenma,项目名称:traceSelectionInMaya,代码行数:25,代码来源:curveUtil.py


注:本文中的Vector.asTuple方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。