POV-Ray : Newsgroups : povray.newusers : new guy here needs help : Re: new guy here needs help Server Time
30 Jul 2024 20:27:02 EDT (-0400)
  Re: new guy here needs help  
From:
Date: 19 Aug 2003 15:02:51
Message: <3f42745b$1@news.povray.org>
/*
Hi Matt,

I've tried to render your scene and have found some errors (and have some
comments that don't refer to an error):

- In the line containing
  #while (y_coord_outer=2.5 >= -2.5)
  the "=2.5" is nonsense (copy-and-paste error?).

- In the line (near the end) containing
  #declare currnet_point=0;
  the name of the variable should be current_point.

- In this line:
  #while (current_point <= ending_point)
  the "<=" should be replaced by "<" because current_point starts at 0
  which is the same (angle) as 360.

- Your formula for the endpoints of the cylinder doesn't put them onto
  the inner and outer sphere; instead of circ_large_diam in these
  formulas use
  sqrt(circ_large_diam*circ_large_diam-y_coord_outer*y_coord_outer)
  and instead of circ_small_diam use
  sqrt(circ_small_diam*circ_small_diam-y_coord_inner*y_coord_inner)
  (and don't change circ_large_diam and circ_small_diam!)

- Using variable names without uppercase letters is a bit risky because
  such names might collide with (current or future) keywords. (The POV-
  team has promised never to use uppercase letters in keywords.)

- In the cylinder formulas, the variable circ_large_diam is used like a
  radius, not a diameter. If it's meant as diameter, then all the
  cylinders with y_coord_outer=2.5 will be identical (same with -2.5).

- The ???_point variables were self-explanatory if renamed to ???_angle.

- cumulating non-integer values in #while loops might give a wrong
  result due to rounding errors -- it's better to use an integer counter
  like this:
  #declare Number=36;
  #declare Counter=0;
  #while (Counter<Number)
    #declare Angle=360*Counter/Number;
    // use this Angle here
    #declare Counter=Counter+1;
    #end//while Counter

What about the following scene? (Simply copy this *whole* post to POV-
Ray and render!)

   Sputnik

*/

camera { location <0, 5, -10> look_at 0 }

light_source { <-5,5,-5> color rgb <2,2,2> }

#declare OuterRadius=5;
#declare InnerRadius=3;
#declare MaxHeight=2.5;
#declare CylRadius=0.10;
#declare NumberOfHeights=21;
#declare NumberOfAngles=36;

#declare Fraction=InnerRadius/OuterRadius;

#declare HeightCount=0;
#while (HeightCount<NumberOfHeights)

  // HeightCount=0...NumberOfHeights-1 -> Height=MaxHeight...-MaxHeight
  #declare Height=MaxHeight-2*MaxHeight*HeightCount/(NumberOfHeights-1);

  #declare AngleCount=0;
  #while (AngleCount<NumberOfAngles)

    #declare Radius=sqrt(OuterRadius*OuterRadius-Height*Height);
    #declare OuterPoint=<Radius, Height, 0>; // Angle ignored for the moment
    cylinder { OuterPoint, OuterPoint*Fraction, CylRadius
      texture {
        pigment { color rgbf <.2,.2,.6,.5> }
        finish { ambient .4 diffuse .6 }
        }
      rotate AngleCount/NumberOfAngles*360*y // let POV do the trigonometry!
      }//cylinder

    #declare AngleCount=AngleCount+1;
    #end//while AngleCount

  #declare HeightCount=HeightCount+1;
  #end//while HeightCount


Post a reply to this message

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