POV-Ray : Newsgroups : povray.general : Graininess : Re: Graininess Server Time
31 Jul 2024 08:28:24 EDT (-0400)
  Re: Graininess  
From: Trevor G Quayle
Date: 14 Jan 2008 21:40:01
Message: <web.478c1c3722fbe8cf2ae8612c0@news.povray.org>
"SharkD" <nomail@nomail> wrote:
> "Trevor G Quayle" <Tin### [at] hotmailcom> wrote:
> > You are still having the same problem with your cones, or rather similar.  You
> > are now working from 0 to 180 degrees, with the angle being the angle from the
> > north pole.  The cone has a defined height of 2*SphereGrid_radius*y, but the
> > radius of the cone is 2*SphereGrid_radius*abs(tand(SphereGrid_value)).  When
> > angle=90, tan(90)=undefined, giving you a problematic cone, which happens to be
> > the equator gridline.  If you want to continue the way you have it, have an
> > additional #if statement for SphereGrid_value=90 which differences a box
> > instead.
> >
> > -tgq
>
> OK, that fixed it. Thank you! Also, is there a way I can use the #switch
> statement instead of branching #if and #else statements? I don't mind using
> #ifelse statements (which POV-Ray doesn't have), but I hate using branching
> where it's not necessary.

You could try:

#declare LATRANGE=select(90-SphereGrid_value,1,2,3);

#switch (LATRANGE)
  #case(1) //Do this for angle < 90
  #break
  #case(2) //Do this for angle = 90
  #break
  #case(3)  /Do this for angle > 90
  #break
#end


There may be other more elegant ways...
-tgq


Post a reply to this message

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