|
 |
I try to calculate a mesh2 with math functions. I can't get the code to run. It
stops at the bracket } of the vertex_vectors statement (after the #debug
statement). Probably I do a beginners error. Can you help me?
Here the code:
//
// Meash2test
//
//
#version 3.7;
#include "colors.inc" // The include files contain
#include "stones.inc" // pre-defined scene elements
background { color Cyan }
light_source { <2, 4, -3> color White}
#declare r = 7;
#declare phi = -1.5;
camera {
location <r*cos(phi), 1, r*sin(phi)>
look_at <0, 1, 2>
}
#declare n = 3;
#declare m = 3;
#declare vec = n * m;
#declare f = 2 * (n - 1) * (m - 1);
#declare r = 0.2;
#declare phi = 3.14 / 10;
mesh2 {
vertex_vectors {
vec
#declare i = 0;
#declare j = 0;
#while(i<n)
#while(j<m)
#declare x1 = pow(i*r,5) * cos(5 * j * phi) - i * r * cos(j * phi);
#declare y1 = pow(i * r,5) * sin(5 * j * phi) - i * r * sin(j * phi);
#declare z1 = i*r + j*phi;
,<x1,y1,z1>
#declare j = j + 1;
#end
#declare i = i + 1;
#end
#debug concat("i=",str(i,0,0), " j=",str(j,0,0))
}
face_indices {
f
#declare i = 1;
#declare j = 0;
#while(i < n)
#while(j < m)
#declare k = i * n + j;
#declare k1 = k - m;
#declare k2 = k - m + 1;
#declare k3 = k + 1;
,<k,k1,k2>, <k, k2, k3>
#declare j = j + 1;
#end
#declare i = i + 1;
#end
}
pigment {rgb 1}
}
Post a reply to this message
|
 |