RiCurves("linear",COUNT,"nonperiodic","P",points,"constantwidth",curveWidth
RI_NULL)
・・・
TypeError: 'int' object is not iterable
原因はCOUNTはいらないということでしょうか。スクリプト書き直したら、できました。ありがとうございます。
#/* curves2.py - create a set of curves */
import random, math
import cgkit.cri
from cgkit.cgtypes import *
# Load the RenderMan API.
# Replace the library name with whatever renderer you want to use.
ri = cgkit.cri.loadRI("3delight")
cgkit.cri.importRINames(ri, globals())
COUNT = 1000
def jitter(scale):
val=random.random()*1000
return (val/500-1)*scale
points=[]
pappend=points.append
nverts=[]
red=(1,0,0)
curveWidth=0.3
fov=30
#/*Generate Curve Postions*/
for i in range(COUNT):
tx=(math.sin(i*0.3)*i*50)/COUNT+jitter(5)
ty=(math.cos(i*0.3)*i*50)/COUNT+jitter(5)
pappend(0)
pappend(0)
pappend(50)
pappend(0.1*tx)
pappend(0.1*ty)
pappend(25)
pappend(0.4*tx)
pappend(0.4*ty)
pappend(0)
pappend(tx)
pappend(ty)
pappend(-25)
nverts.append(4)
RiBegin(RI_NULL)
RiDisplay ("curves2.tiff","framebuffer","rgb",RI_NULL)
RiProjection ("perspective","fov",fov,RI_NULL)
RiWorldBegin()
RiTranslate(0,0,200)
RiColor(red)
RiRotate(45,1,0,0)
RiCurves("linear",nverts,"nonperiodic","P",points,"constantwidth",curveWidth,RI_NULL)
RiWorldEnd()
RiEnd()
- -
- -