POV-Ray : Newsgroups : povray.general : Sphere with longitudes and latitudes? : Re: Sphere with longitudes and latitudes? Server Time
31 Jul 2024 10:27:12 EDT (-0400)
  Re: Sphere with longitudes and latitudes?  
From: Mike Williams
Date: 11 Nov 2007 22:46:24
Message: <v7AYRBAIu8NHFwId@econym.demon.co.uk>
Wasn't it Hadmut Danisch who 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

Here's one where the lines are constant width. It's significantly
slower.


#declare Longs =10;     // number of longitude lines : should be > 3
#declare Lats = 10;     // number of latitude lines  : must be even
 
#declare LongW = Longs/200;                    

#include "functions.inc"

sphere {0,1
  texture{
    pigment {function {f_ph(x,y,z)*(Longs-1)/2}
      colour_map{[LongW rgb 1][LongW rgb 0]}
    }      
  }
  #declare th=0;
  #while (th<180)
    texture {
      pigment {function {abs(x)}
        colour_map{[0.01 rgb 1][0.01 rgbt 1]}
        scale 1.02
        rotate y*th
      }
    }      
    #declare th = th+(360/Lats);
  #end 
}



Watch out for that  "scale 1.02"  If you don't have it, you sometimes
get some white circles at the edges.

The "function {abs(x)}" looks slightly better than "gradient x". If you
use "gradient x" then the gap next to the line at 180 degrees looks
slightly different from all the others. I'm not sure why.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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