POV-Ray : Newsgroups : povray.newusers : Plotting points on a sphere? Server Time
27 Nov 2024 10:49:38 EST (-0500)
  Plotting points on a sphere? (Message 1 to 10 of 10)  
From: Jessie K  Blair
Subject: Plotting points on a sphere?
Date: 2 Jan 2003 00:36:06
Message: <3e13cfc6@news.povray.org>
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?


Post a reply to this message

From: Gleb
Subject: Re: Plotting points on a sphere?
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

From: Christopher James Huff
Subject: Re: Plotting points on a sphere?
Date: 2 Jan 2003 09:09:29
Message: <cjameshuff-C37430.09052002012003@netplex.aussie.org>
In article <3e13cfc6@news.povray.org>,
 "Jessie K. Blair" <lor### [at] aolcom> wrote:

> 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.

You need to be a bit more specific...there are many ways to tessellate a 
sphere. You place them with spherical coordinates, at the crossings of 
latitude/longitude lines. You could place them at the vertices of a 
polyhedron generated by recursively splitting the triangles of a regular 
tetrahedron or octahedron. You could place them in grids on the faces of 
a sphere that is then projected to the surface of the sphere. And 
probably some others I haven't thought of yet.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

From: Jessie K  Blair
Subject: Re: Plotting points on a sphere?
Date: 2 Jan 2003 18:47:59
Message: <3e14cfaf@news.povray.org>
Knowledge of any of those methods would be nice.  Be for simplicity's sake,
the crossings of the lat/long lines is just what I was looking for.

"Christopher James Huff" <cja### [at] earthlinknet> wrote in message
news:cja### [at] netplexaussieorg...
> In article <3e13cfc6@news.povray.org>,
>  "Jessie K. Blair" <lor### [at] aolcom> wrote:
>
> > 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.
>
> You need to be a bit more specific...there are many ways to tessellate a
> sphere. You place them with spherical coordinates, at the crossings of
> latitude/longitude lines. You could place them at the vertices of a
> polyhedron generated by recursively splitting the triangles of a regular
> tetrahedron or octahedron. You could place them in grids on the faces of
> a sphere that is then projected to the surface of the sphere. And
> probably some others I haven't thought of yet.
>
> --
> Christopher James Huff <cja### [at] earthlinknet>
> http://home.earthlink.net/~cjameshuff/
> POV-Ray TAG: chr### [at] tagpovrayorg
> http://tag.povray.org/


Post a reply to this message

From: Jessie K  Blair
Subject: Re: Plotting points on a sphere?
Date: 2 Jan 2003 18:49:36
Message: <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?

"Gleb" <gk### [at] freelocuscom> wrote in message news: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

From: Gleb
Subject: Re: Plotting points on a sphere?
Date: 3 Jan 2003 04:14:32
Message: <3e155478@news.povray.org>
"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

From: Christopher James Huff
Subject: Re: Plotting points on a sphere?
Date: 3 Jan 2003 16:13:24
Message: <cjameshuff-F1A653.16092003012003@netplex.aussie.org>
In article <3e14cfaf@news.povray.org>,
 "Jessie K. Blair" <lor### [at] aolcom> wrote:

> Knowledge of any of those methods would be nice.  Be for simplicity's sake,
> the crossings of the lat/long lines is just what I was looking for.

Well, getting a single point is easy:
vrotate(-z*Radius, < Lat, Long, 0>) + Center

So, use 2 nested loops to loop through the desired points:

#declare LatLines = 12;
#declare LongLines = 24;

#declare Lat = 0;
#while(Lat < LatLines)
    #declare Long = 0;
    #while(Long < LongLines)
        sphere {vrotate(-z*Radius, < 180*Lat/LatLines - 90, 
360*Long/LongLines, 0>) + Center, 0.1}
or
        sphere {-z*Radius, 0.1
            rotate < 180*Lat/LatLines - 90, 360*Long/LongLines, 0>
            translate Center
        }
        #declare Long = Long + 1;
    #end
    #declare Lat = Lat + 1;
#end

This isn't anywhere close to an even distribution though, if that is 
what you want.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: Plotting points on a sphere?
Date: 4 Jan 2003 00:55:10
Message: <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

From: Jessie K  Blair
Subject: Re: Plotting points on a sphere?
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

From: Tor Olav Kristensen
Subject: Re: Plotting points on a sphere?
Date: 24 Sep 2004 20:39:42
Message: <4154be4e@news.povray.org>
Jessie K. Blair wrote:
> 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

Hi Jessie.

Welcome back and happy poving !

P.S.: I believe that the math most people need for
their POV-Ray scenes can be learned in college.

-- 
Tor Olav
http://subcube.net
http://subcube.com


Post a reply to this message

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