|
![](/i/fill.gif) |
"Tor Olav Kristensen" wrote in message
>At 24. January 2002 I posted an image to povray.binaries.images.
>Below is the source for it.
Thanks. That is interesting.
>Note that when I rendered this image, a small defect appeared at the
>"south pole" of the sphere. I'm not sure what causes this.
I see. I've encountered the same problem in the carpet project.
That is due to 'mod' function. The first parameter of 'mod' function
should be positive in such cases.
So, the below macro will work as expected.
R. Suzuki
------------------------------
#macro SphereSpiralsFunction(Rmaj, Rmin, PhiFn, NrOfBands, GapRatio)
#local TwoPi = 2*pi;
#local DivAngle = TwoPi/NrOfBands;
#local GapAngle = DivAngle*GapRatio;
#local HalfGapAngle = GapAngle/2;
function {
select(
mod(
atan2(z, x) - PhiFn(x, y, z) +
select(atan2(z, x) - PhiFn(x, y, z), TwoPi, 0) +TwoPi,
DivAngle
) - GapAngle,
select(
mod(
atan2(z, x) - PhiFn(x, y, z) +
select(atan2(z, x) - PhiFn(x, y, z), TwoPi, 0) +TwoPi,
DivAngle
) - HalfGapAngle,
f_sphere(
x - Rmaj*f_r(x, 0, z)/(Nothing + f_r(x, y, z))*
cos(
atan2(z, x) -
mod(
atan2(z, x) - PhiFn(x, y, z) +
select(atan2(z, x) - PhiFn(x, y, z), TwoPi, 0) +TwoPi,
DivAngle
)
),
y - Rmaj*y/(Nothing + f_r(x, y, z)),
z - Rmaj*f_r(x, 0, z)/(Nothing + f_r(x, y, z))*
sin(
atan2(z, x) -
mod(
atan2(z, x) - PhiFn(x, y, z) +
select(atan2(z, x) - PhiFn(x, y, z), TwoPi, 0) +TwoPi,
DivAngle
)
),
Rmin
),
f_sphere(
x - Rmaj*f_r(x, 0, z)/(Nothing + f_r(x, y, z))*
cos(
atan2(z, x) -
mod(
atan2(z, x) - PhiFn(x, y, z) +
select(atan2(z, x) - PhiFn(x, y, z), TwoPi, 0) +TwoPi,
DivAngle
) + GapAngle
),
y - Rmaj*y/(Nothing + f_r(x, y, z)),
z - Rmaj*f_r(x, 0, z)/(Nothing + f_r(x, y, z))*
sin(
atan2(z, x) -
mod(
atan2(z, x) - PhiFn(x, y, z) +
select(atan2(z, x) - PhiFn(x, y, z), TwoPi, 0) +TwoPi,
DivAngle
) + GapAngle
),
Rmin
)
),
abs(f_sphere(x, y, z, Rmaj)) - Rmin
)
}
#end // macro SphereSpiralsFunction
Post a reply to this message
|
![](/i/fill.gif) |