POV-Ray : Newsgroups : povray.general : Sphere with longitudes and latitudes? : Re: Sphere with longitudes and latitudes? Server Time
31 Jul 2024 10:22:14 EDT (-0400)
  Re: Sphere with longitudes and latitudes?  
From: Trevor G Quayle
Date: 11 Nov 2007 21:30:01
Message: <web.4737b997a8d0eaa2ae8612c0@news.povray.org>
Hadmut Danisch <had### [at] danischde> wrote:
> Mike Williams wrote:
>
> >  texture {
> >   pigment {radial frequency 30
> >     colour_map{[0.1 rgb 1][0.1 rgbt <0,0,0,1>]}
> >   }
>
>
> Just a little detail problem:
>
> while this does what I am looking for in principle, there's one
> problem: The line is not of constant width. The closer it gets to the
> poles, the smaller it gets, like a slice of cake. Becomes highly visible
> when the frequence gets lower, e.g. frequency 4
>
> regards
> Hadmut


Try this code, it combines a gradient with a spherical warp for the lat lines
with cylinder-based object pattern for the long lines.  The lat and long grid
line widths are constant and definable in width (along the arclength even).

Feel free to pick it apart and modify it as needed.

-tgq

//START
#declare LatDiv=8;    //Number of Latitude divisions, used for long too (degrees
= 90/LatDiv)
#declare GRDTHK=0.01;  //Line thickness for 1 unit radius sphere

#declare AA=GRDTHK*LatDiv/2/(pi*2/4);

#declare PLat=
pigment{
  gradient
  y
  colour_map{
    [AA rgb 0]
    [AA rgb 1]
    [1-AA rgb 1]
    [1-AA rgb 0]
  }
  frequency LatDiv*2

  warp {
    spherical
  }
}

#declare LONG=
union{
  #local i=0;#while(i<180)
    cylinder{-z*sin(GRDTHK/2),z*sin(GRDTHK/2),1.1 rotate y*i}
  #local i=i+90/LatDiv;#end
}

#declare PGrid=
pigment{
  object{
    LONG
    pigment{PLat}
    pigment{rgb 0}
  }
}

sphere{0,1
  pigment{PGrid}
  scale 340
}
//END


Post a reply to this message

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