Please, help

Hi, i need your help. I had not really worked with osl, and I need to draw a Vogel Spiral.I found different variations on a python, but not on a osl. if you can show how to do it, or send on the right path, I will be very grateful!

http://www.dcs.gla.ac.uk/~jhw/spirals/vogel_labeled.png - this is an example, how i see it.

r = sqrt(i)
theta = i * ((2 * pi)/phi*phi),

where phi (the golden ratio) is given by:

phi = (1 + sqrt(5)) / 2.

The result of this arrangement is to align the Fibonacci numbers along the eastern axis (although the first few are slightly off axis).

Here I found written on Python
http://blog.marmakoide.org/?p=1

<<import math

n = 256

golden_angle = math.pi * (3 - math.sqrt(5))

points = []
for i in xrange(n):
theta = i * golden_angle
r = math.sqrt(i) / math.sqrt(n)
points.append((r * math.cos(theta), r * math.sin(theta)))>>

But I don’t know how it can be transferred to OSL.

For OSL you need to turn that into a parametric formula (something like f(x, y)=Color).

What you have there is f(w)=[x, y], for w in range(n). So you need to invert that, which is not easy, and the result it’s computational expensive.
Also, you need a shape. A point doesn’t have dimensions, so even if you lucky that the render will peek that exactly point for sampling, It will soon be gone next to the other sampled points.

My sugestion is to use that python to plot an image texture instead of using OSL.

Great efforts were needed to write this to me:

float circle(float x, float y, float R)
{
float s = (xx)+(yy);
if (s>(R*R))
return 1;
else
return 0;
}

shader pattern(
float CircleR = 1,
float r = 1,
float fi = 1,
color Col = color(0.8, 0.0, 0.0),
float s = 0 [[int lockgeom = 0]],
float t = 0 [[int lockgeom = 0]],
color Background = color (0.2, 0.2, 0.2),
output color outColor = color(0.0, 1.0, 0.0),
{

float dek_x = rcos(radians(fi));
float dek_y = r
sin(radians(fi));

float krug = circle((s-dek_x-0.5), (t-dek_y-0.5), CircleR);

outColor = krug;

}

To start, I want to make small circles draw on the trajectory of a large circle, but how do I implement this in cycle? So I can adjust the number of circles and steps?

I understand what needs to be done somethings like this:
for (int i = 0; i<=360; i = i+10)
but what i need to do with i?

thanks