POV-Ray : Newsgroups : povray.newusers : Plotting points on a sphere? : Re: Plotting points on a sphere? Server Time
31 Jul 2024 04:18:06 EDT (-0400)
  Re: Plotting points on a sphere?  
From: Jessie K  Blair
Date: 23 Sep 2004 11:22:35
Message: <4152ea3b@news.povray.org>
Err... Sorry it took so long to reply to this thread...  When I started it I 
was in Afghanistan and kept getting moved all over the place.  Just recently 
found my way back to the newsgroup (though I've been home for almost a 
year).

I just wanted to say thank you to everyone who tried to help me out here. 
I'm gonna toy with all of your ideas, but I also found another of my own...

I'm now in college and after a refresher on some geometry, I realize I could 
have gotten the points I wanted using (Circumference = pi * diameter).  Then 
I could just add some distance on the x-, y-, and z-scales for my smaller 
spheres.

BTW, I have no idea what I was trying to make at the time, but this is all 
still very useful for any future applications.

Thank you again,
~Jessie

"Tor Olav Kristensen" <tor### [at] hotmailcom> wrote in message 
news:web.3e16760df926e896b417814a0@news.povray.org...
> Jessie K. Blair wrote:
>>To better explain what I'm looking for, I'll give you what I am trying to
>>do.
>>
>>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.
>>
>>*coughs* I know that is a bit confusing, so if you need an example drawing
>>or something, lemme know.
>>
>>Any one know how this might be accomplished?
>
>
> Jessie, I see that others have provided
> several suggestions on how to solve your
> problem.
>
> So you maybe you don't need yet another
> suggestion.
>
> But anyway, the code below is my suggestion.
>
> Feel free to ask if there is anything that
> you want me to explain.
>
>
> Tor Olav
>
>
> // ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
> // Copyright 2002 by Tor Olav Kristensen
> // Email: t o r _ o l a v _ k [ a t ] h o t m a i l . c o m
> // http://home.no/t-o-k
> // ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
>
> #version 3.5;
>
> #include "colors.inc"
>
> // ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
>
> #macro WireFrameSphere(NrLongitudes, NrLatitudes, Rmaj, Rmin)
>
>  #local dLongitude = 360/NrLongitudes;
>  #local dLatitude = 180/NrLatitudes;
>
>  #local Cnt = 0;
>  #while (Cnt < NrLongitudes)
>    #local Longitude = Cnt*dLongitude;
>    difference {
>      torus { Rmaj, Rmin }
>      plane { -z, 0 }
>      rotate -90*z
>      rotate Longitude*y
>    }
>    #local Cnt = Cnt + 1;
>  #end // while
>
>  #local Cnt = 1;
>  #while (Cnt < NrLatitudes)
>    #local Latitude = radians(Cnt*dLatitude - 90);
>    torus {
>      Rmaj*cos(Latitude), Rmin
>      translate Rmaj*sin(Latitude)*y
>    }
>    #local Cnt = Cnt + 1;
>  #end // while
>
> #end // macro WireFrameSphere
>
>
> #macro SpheresOnSphere(NrLongitudes, NrLatitudes, Rmaj, Rmin)
>
>  #local dLongitude = 360/NrLongitudes;
>  #local dLatitude = 180/NrLatitudes;
>
>  sphere { -Rmaj*y, Rmin }
>  #local Cnt1 = 0;
>  #while (Cnt1 < NrLongitudes)
>    #local Longitude = Cnt1*dLongitude;
>    #local Cnt2 = 1;
>    #while (Cnt2 < NrLatitudes)
>      #local Latitude = Cnt2*dLatitude - 90;
>      #local pSph = Rmaj*vrotate(-z, <Latitude, Longitude, 0>);
>      sphere { pSph, Rmin }
>      #local Cnt2 = Cnt2 + 1;
>    #end // while
>    #local Cnt1 = Cnt1 + 1;
>  #end // while
>  sphere {  Rmaj*y, Rmin }
>
> #end // macro SpheresOnSphere
>
> // ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
>
> #declare Rglobe = 20;
> #declare Rwireframe = 0.08;
> #declare Rspheres = Rwireframe*2;
>
> // Number of longitude intervals
> #declare Longitudes = 36; // Also try 5
>
> // Number of latitude intervals
> #declare Latitudes = 18; // Also try 2
>
> union {
>  WireFrameSphere(Longitudes, Latitudes, Rglobe, Rwireframe)
>  pigment { color White*1.5 }
> }
>
> union {
>  SpheresOnSphere(Longitudes, Latitudes, Rglobe, Rspheres)
>  pigment { color Red + White }
> }
>
> /*
> sphere {
>  <0, 0, 0>, Rglobe
>  pigment { Grey }
> }
> */
>
> // ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
>
> light_source {
>  <1, 2, -2>*50
>  color White
>  shadowless
> }
>
> background { color Blue/2 }
>
> camera {
>  location <2, 4, -3>*10
>  look_at 0*y
> }
>
> // ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
>
>


Post a reply to this message

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