POV-Ray : Newsgroups : povray.programming : Problem with macros and translate function :/ Server Time19 Sep 2024 21:28:12 EDT (-0400)
 Problem with macros and translate function :/ (Message 1 to 1 of 1)
 From: aysays Subject: Problem with macros and translate function :/ Date: 23 Aug 2023 08:05:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.64e5f4c7d9dedc30941194678c4c5f32%40news.povray.org",
"headline": "Problem with macros and translate function :\/",
"dateCreated": "2023-08-23T12:05:00+00:00",
"datePublished": "2023-08-23T12:05:00+00:00",
"author": {
"@type": "Person",
"name": "aysays"
}
}
Hello I'm new to Pov-Ray and am trying to write a broccoli fractal code however
I'm having problems with the translate function. If I understood it correctly,
translate only accepts numerical values. I tried writing a macro but that didn't
work either. How am I supposed to write a recursive function that utilizes
translate? :/ Here is my code:

#include "colors.inc"

global_settings {
ambient_light rgb <1, 1, 1>
assumed_gamma 1.0
}

camera {
location <0, 0, -25>
look_at <0, 0, 0>
}

light_source {
<-100, -100, -100>
color rgb <1, 1, 1>
}

#declare phi = (1 + sqrt(5))/2;
#declare ang = 360 * (1 - 1/phi);

#macro trans()
translate< sqrt(i)* cos(i * ang),
sqrt(i) * sin(i * ang),
10-sqrt(pow(sqrt(i)* cos(i * ang),2) + pow(sqrt(i) * sin(i *
ang),2))>
#end

#macro frac(n)
#if(n > 0)
cone {
<0, 10, 0>, 10
<0, 0, 0>, 0
texture {
pigment { Green }
finish { ambient 0.2 }
}

#declare i = 1;
#while (i <= 100)
//#declare theta = i * ang;
//#declare r = sqrt(i);
//#declare a = r * cos(theta);
//#declare b = r * sin(theta);

trans()

scale 0.15
}
frac(n - 1)

#declare i = i + 1;
#end
#end
#end

frac(3);