Thread: vertex list
View Single Post
  #3  
Old 07-01-2009, 07:17 AM
jaclyn.bill jaclyn.bill is offline
Member
 
Join Date: Oct 2007
Posts: 42
Hi,

I'm sorry but I'm still having problems with this and can't understand why it won't read my array. It is giving the error "TypeError: x must be a float" if I try to convert x to a float (which I thought it already was) I get the error "TypeError: only length-1 arrays can be converted to Python scalars
".

Code:
length = 200
viz.startlayer(viz.LINE_STRIP)
viz.vertexcolor(1,1,1)
viz.linewidth(5)
roadarray = 0.0*np.zeros((length,3))
x = np.linspace(-np.pi, np.pi, length)
z = np.sin(x)
roadarray[:length,0]= x
roadarray[:length,1]= 0
roadarray[:length,2]= z
viz.vertex(roadarray[:length,0],roadarray[:length,1],roadarray[:length,2])
lines = viz.endlayer()
I'd be grateful for any advice on this, I'm not a python expert!

Best, j
Reply With Quote