POV-Ray : Newsgroups : povray.newusers : Beginners code doesn't run : Beginners code doesn't run Server Time 1 Oct 2023 18:40:39 EDT (-0400)
 Beginners code doesn't run
 From: Markus Date: 1 Sep 2016 15:55:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.57c88751cc9c34c2412d2b10%40news.povray.org",
"dateCreated": "2016-09-01T19:55:00+00:00",
"datePublished": "2016-09-01T19:55:00+00:00",
"author": {
"@type": "Person",
"name": "Markus"
}
}
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}
}
```