|
|
"Bald Eagle" <cre### [at] netscapenet> wrote:
> The key with any of those would be that you'd have to define a base object
> (likely at the y-axis pole) and then _rotate_ that into position.
So, I took a look into doing just that and am getting some very odd results.
Converting the Cartesian into spherical coordinates and then rotating around z,
then -y, I DO get a sphere --- but it's shifted in the +x direction.
How that happens when I'm supposedly rotating around the origin...
And it seems "radius" dependent. The farther I locate my original test sphere
in the +x direction, the farther the whole spherical shell shifts.
And the radius of the spherical shell seems to be about half that resulting from
the original algorithm.
#declare SR = 0.05;
#declare Pentamers = 360*1.5;
#declare Trimers = 512;
#declare N = 1024*2;
#declare dlong = pi*(3-sqrt(5)); //~2.39996323
#declare dz = 2/N;
#declare long = 0;
#declare Z = 1 - dz/2;
#declare Spike = 1.5;
#declare COVID_19 = union {
#for (k, 0, N-1)
#local r = sqrt(1-Z*Z);
#local Loc = <cos(long)*r, sin(long)*r, Z>;
sphere {Loc SR texture {pigment {Yellow/4} finish {specular 0.1}} }
#local T = k/int(N/Trimers);
#if (T = int (T))
cone {Loc, 0, Loc*Spike, SR texture {pigment {Red} finish {specular 0.05}} }
sphere {Loc*Spike, SR texture {pigment {Red} finish {specular 0.05}} }
#local RZ = atan2( sin(long)*r, vlength (<cos(long)*r, 0, Z>) );
#local RY = atan2(Z, cos(long)*r);
sphere {<cos(long)*r*Spike*2, 0, 0> SR texture {pigment {Magenta} finish
{specular 0.05}}
rotate z*degrees(RZ)
rotate -y*degrees(RY)
}
#end
#local P = k/int(N/Pentamers);
#if (P = int (P))
sphere {Loc*1.05, SR texture {pigment {Green/4} normal {bumps 1 scale 0.005}
finish {specular 0.1}} }
#end
#local Z = Z - dz;
#local long = long + dlong;
#end
}
Post a reply to this message
|
|