|
![](/i/fill.gif) |
stevenvh wrote:
> In my code I want to generate a series of prisms dynamically, where both the
> number of points and their coordinates are read from a file. I have no idea how
> to do this, so any hints be greatly appreciated.
> Regards,
> Steven
You could have an include file which contains an array:
#declare pn = pi*2/6;
#declare points=
array[7]{
<sin(pn*0),cos(pn*0)>,
<sin(pn*1),cos(pn*1)>,
<sin(pn*2),cos(pn*2)>,
<sin(pn*3),cos(pn*3)>,
<sin(pn*4),cos(pn*4)>,
<sin(pn*5),cos(pn*5)>,
<sin(pn*0),cos(pn*0)>
}
Then you can #include the file into your scene and write something like
this:
prism{
-.5,.5,dimension_size(points,1)
#declare V=0;
#while(V<dimension_size(points,1))
points[V]
#declare V=V+1;
#end
pigment{rgb 1}
}
You'll probably want to generate the include file automatically. You
should check into #fopen, #write and #fclose (3.2.2.3 File I/O
Directives). You shouldn't have to #read a file to accomplish your goal.
I hope this helps.
Sam
Post a reply to this message
|
![](/i/fill.gif) |