From: David S. <dsc...@vy...> - 2001-07-25 22:39:16
|
I wrote: > I thought about this (in fact, I did it once). It might not > be a bad idea. I should add this: a "mesh" object like Ari described would be useful for much more than height fields. For example, a surface of revolution or extrusion is also a mesh: ################## from visual import * def mesh(pos): "Stand-in for mesh object (wireframe rendering)" pos = array(pos) for i in range(pos.shape[0]): curve(pos=pos[i]) for j in range(pos.shape[1]): curve(pos=pos[:,j]) def surface_of_revolution(length, radius): circle = arange(0, 2*pi+0.2, 0.2) count = len(radius) pos = [ [ vector(i*length/count, radius[i]*cos(theta), radius[i]*sin(theta)) for theta in circle ] for i in range(count) ] return mesh(pos) def extrusion( points, displacement ): pos = [ (point, point+displacement) for point in points ] return mesh(pos) surface_of_revolution( 10, [5,1,1,1,1,2,3,4,5] ) extrusion( [ vector(0,0,0), vector(1,0,0), vector(0,1,0), vector(0,0,0) ], vector(0,0,1) ) ################### mesh would be accessible to more people than faces. It wouldn't, however, be as general for people who want to play with new primitives or *especially* model import. Dave |