POV-Ray : Newsgroups : povray.newusers : Plotting points on a sphere? : Re: Plotting points on a sphere? Server Time
31 Jul 2024 04:20:17 EDT (-0400)
  Re: Plotting points on a sphere?  
From: Gleb
Date: 2 Jan 2003 09:04:48
Message: <3e144700@news.povray.org>
"Jessie K. Blair" <lor### [at] aolcom> wrote in message
news:3e13cfc6@news.povray.org...
> I have a sphere shaped object that I wish to place many smaller spheres
> around.  I want the smaller spheres to be plotted on the points of
> intersection of the wireframe that a sphere would consist of, allowing the
> smaller spheres to be placed in a spherical shape around the first sphere
> object.
>
> Any one know how this might be accomplished?
>
/*
If you know coordinates of your points
(or at least know how to calculate them),
you can e.g. put them in array and
build your frame object.
Below is working example:
*/
//----------------8<----------------
#declare SphereObjectCentre=<0,0,0>;
#declare SphereObjectR=1;
#declare PointR=0.05;

#declare SphereObjectColor=<.1,1.3,1.6>;
#declare PointColor=<0.8,1.5,0.2>;

#declare Point=array[18]{
  <0.39,0.83,-0.41>
  <-0.94,0.13,0.32>
  <-0.65,0.74,-0.18>
  <0.75,-0.65,0.12>
  <0.74,-0.5,0.44>
  <0.46,-0.02,-0.89>
  <-0.28,0.51,0.81>
  <0.32,0.35,0.88>
  <-0.69,-0.6,0.41>
  <-0.85,-0.16,-0.5>
  <-0.44,-0.62,-0.65>
  <-0.48,0.49,-0.73>
  <-0.12,0.33,-0.94>
  <-0.17,-0.97,-0.17>
  <-0.61,-0.13,-0.78>
  <-0.04,-0.58,-0.81>
  <0.45,0.87,0.2>
  <0.92,0,0.39>
};

#declare nPonts=dimension_size(Point,1);

#declare SphereObject=sphere{
  SphereObjectCentre,
  SphereObjectR
  pigment{color rgb PointColor}
}

#declare PontsObject=union{
  #declare i=0;
  #while (i<nPonts)
    sphere{Point[i],PointR
      pigment{color rgb SphereObjectColor}
    }
    #declare i=i+1;
  #end
}

camera {
  location <-2,2,-2> look_at SphereObjectCentre
  right x*image_width/image_height
  up y
}

background { color rgb <1,1,1>}

light_source {
  0*x                  // light's position (translated below)
  color rgb <1,1,1>    // light's color
  translate <-20, 40, -20>
}

#object{SphereObject}
#object{PontsObject}

//----------------8<----------------


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.