|
|
"Jessie K. Blair" <lor### [at] aolcom> wrote in message
news:3e14d010@news.povray.org...
> I do not know the coordinates, or how to calculate them. Can you tell me
> how to calculate them as well?
/*
Check this one:
a sphere grid consists of 8 identical parts.
Just one may be enough, however,
but it may be also convenient to have all eight.
*/
//----------------8<----------------
#local SphereObjectCentre=<0,0,0>;
#local SphereObjectR=1;
#local N=8;
#local PointR=1/N;
#local SphereObjectColor=<.1,1.3,1.6>;
#local PointColor=<0.8,1.5,0.2>;
#local nPonts=N*(N+1)/2;
#local Point=array[8][nPonts];
#local Alpha=pi/2;
#local dAlpha=Alpha/(N-1);
#local CurrentPoint=<0,SphereObjectR,0>;
#local Point[0][0]=CurrentPoint;
#local Alpha=Alpha-dAlpha;
#local k=0;
#local i=1;
#while (i<N)
#local Beta=0;
#local dBeta=pi/2/i;
#local j=0;
#while (j<i+1)
#local k=k+1;
#local CurrentPoint=
SphereObjectR*<cos(Alpha)*sin(Beta),
sin(Alpha),
cos(Alpha)*cos(Beta)>;
#local Point[0][k]=CurrentPoint;
#local Beta=Beta+dBeta;
#local j=j+1;
#end
#local Alpha=Alpha-dAlpha;
#local i=i+1;
#end
// Here we have a 1/8 part of sphere surface
#local k=0;
#while (k<nPonts) // Filling next parts
#local Point[1][k]=<Point[0][k].z,Point[0][k].y,-Point[0][k].x>;
#local Point[2][k]=<-Point[0][k].x,Point[0][k].y,-Point[0][k].z>;
#local Point[3][k]=<-Point[0][k].z,Point[0][k].y,Point[0][k].x>;
#local Point[4][k]=<Point[0][k].x,-Point[0][k].y,Point[0][k].z>;
#local Point[5][k]=<Point[1][k].x,-Point[1][k].y,Point[1][k].z>;
#local Point[6][k]=<Point[2][k].x,-Point[2][k].y,Point[2][k].z>;
#local Point[7][k]=<Point[3][k].x,-Point[3][k].y,Point[3][k].z>;
#local k=k+1;
#end
#local SphereObject=sphere{
SphereObjectCentre,
SphereObjectR
pigment{color rgb PointColor}
}
#local PontsObject=union{
// North Pole
sphere{Point[0][0],PointR
pigment{color rgb SphereObjectColor}
}
// South Pole
sphere{Point[4][0],PointR
pigment{color rgb SphereObjectColor}
}
#local k=0;
#while (k<8)
#local m=1;
#local i=1;
#while (i<N)
#local j=0;
#while (j< ((k<4)?(i+1):i))
//Prevent of forming the Equator twice
sphere{Point[k][m+j],PointR
pigment{color rgb SphereObjectColor}
}
#local j=j+1;
#end
#local m=m+j;
#local i=i+1;
#end
#local k=k+1;
#end
}
camera {
location <-2,2,-2>*1.2 look_at SphereObjectCentre
right x*image_width/image_height
up y
}
background { color rgb <1,1,1>}
light_source {
0*x
color rgb <1,1,1>
translate <-20, 40, -20>
}
#object{SphereObject}
#object{PontsObject}
//----------------8<----------------
Post a reply to this message
|
|