|
|
Timothy R. Cook schrieb:
> Ok, I have a program in BASIC that I'm using to generate
> random numbers for a sphere_sweep, that looks like:
>
> randomize timer
> for n=1 to 23
> theta%=(rnd*36)*20
> r = rnd*0.24
> x = r*COS(theta%)
> y = r*SIN(theta%)
> z = (rnd*0.5)+1.25
> ? USING "X = +#.##### Y = +#.##### Z = +#.#####";x,y,z
> next n
I don't know BASIC very well, so maybe I changed the formulas a bit. But
this is a fast hack for a macro:
#macro makeASphereSweep(numberOfPoints, splineType, startSeedValue)
sphere_sweep
{
#switch (splineType)
#case (1)
linear_spline
#break
#case (2)
b_spline
#break
#case (3)
cubic_spline
#break
#else
linear_spline
#end
numberOfPoints, // No. of spheres
#declare random = seed(startSeedValue);
#declare n = 0;
#while (n < numberOfPoints)
#declare theta = (rand(random) * 36) * 20;
#declare r = rand(random) * 0.24;
#declare x_val = r * cos(theta);
#declare y_val = r * sin(theta);
#declare z_val = (rand(random) * 0.5) + 1.25;
#if (n < numberOfPoints - 1)
<x_val, y_val, z_val>, r,
#else
<x_val, y_val, z_val>, r
#end
#declare n = n + 1;
#end
pigment
{
color rgb 1
}
}
#end
And then call your macro with:
makeASphereSweep(50, 1, 123)
Hope that helps a bit...
So long,
Bonsai
--
<--------------------------->
___ __ __ _ ___ ___ _
| _ ) \ \( ) _) _ )( )
| _ \() |\ \ |\ \/ _ \| |
|___/__/_)\__)___)/ \_)_)
www.b0n541.net
<--------------------------->
Post a reply to this message
|
|