POV-Ray : Newsgroups : povray.general : Math Stuff Help Needed - Please : Math Stuff Help Needed - Please Server Time
12 Aug 2024 11:16:42 EDT (-0400)
  Math Stuff Help Needed - Please  
From: Ken
Date: 14 Feb 1999 19:43:06
Message: <36C76D48.9C9FA81A@pacbell.net>
Greetings Math Wizards !


  Below are two versions of pov script both currently producing exactly
the same object, a semi-hemisphere or half dome if you wish. The first
is out of a scene I have been working on and it suited my needs for the
one scene. After establishing a a procedure I thought it would be nice
if I could parameterize the script so it is self adjusting. By this I
mean I would like to be able to provide the 3 dimensions of a box and
the desired radius for the dome and the script takes care of the rest
as far as number of objects, rotation angles, etc. It would also be nice
to have a choice between half dome, half sphere, and full sphere versions
but I am not going to push my luck at this point.
  Anyway I started working on the improved version and got so tangled up
I stopped and said enough. I'm at the stage where if someone will help
finish it I would appreciate it greatly. I just can't seem to get everything
working together in unison for the desired output. I have commented the
major operating points of the script and it shouldn't be too difficult
to follow. The feeble attempts I made at getting it to work have been
eliminated so as not to confuse the issue. Only the identifiers have been
left in place as a guide. I can see a definite candidate for a macro here
but would rather the help you provide stays within the current format.
I need to learn how to convert stuff like this to macros myself and this
will be my first case study. 

Thanks !

P.S. If you indent the script I won't cry too much ;^ {


  camera{location<0,20,-65>look_at 20*y}

  light_source{<  0,500,-900>rgb 1}
  light_source{<  0,  5,-100>rgb 1}

  // original working code

  #declare HalfDome_1 = 
  union {
  #declare aa = 0;
  #while  (aa < 90)
  #declare bb = 0;
  #while  (bb < 45)

  box{-.5,.5
  scale     <.05, 1.50, 1.50>         // Box scale
  translate <-40, 0.00,    0>         // Translate from origin
  rotate    <0.0, 0.00,-2*bb>         // rotate for first verticle section of dome
  scale     <1.0, 1.00,1.6+pi/90*-bb> // Scale each box smaller as it goes up
  rotate    <0.0, 2*aa, 0.00>         // rotate scaled section horizontily to form
dome
  translate <0.0, 0.75, 0.00> }       // Translate bottom edge to y*0

  #declare bb = bb+1;
  #end
  #declare aa = aa+1;
  #end }

  // New code that works but needs help - lots of
                  
  #declare HalfDome_2 =
  union {  
  #declare Xscale    = 0.05;         // Box scale
  #declare Yscale    = 1.50;         // Box scale
  #declare Zscale    = 1.50;         // Box scale
  #declare Rad       = 40.0;         // Dome radius
  #declare Trnslt    = <-Rad, 0, 0>; // Translate from origin
  #declare HSegNum   = 180/2;        // Number of horizontal segments
  #declare VSegNum   = HSegNum/2;    // Number of verticle   segments
  #declare aa        = 0;   
  #while  (aa        < HSegNum)
  #declare bb        = 0;
  #while  (bb        < VSegNum)
  #declare Rotate1   = <0,0,-2*bb>;  // rotate value for one verticle section of dome
  #declare RotScale  = <1,1,Yscale+.1+pi/HSegNum*-bb>; // Rotation scaler
  #declare Rotate2   = <0,2*aa, 0>;  // rotate values horizontal sections of dome

  box{-.5,.5
  scale     <Xscale,Yscale,Zscale>  // Scale of Box
  translate Trnslt                  // Translate from origin
  rotate    Rotate1                 // rotate to create first verticle slice of dome
  scale     RotScale                // Scale each box smaller as it goes up
  rotate    Rotate2                 // Rotate scaled verticle section to create dome
  translate <0,Yscale*.5,0>}        // Translate bottom edge to y*0

  #declare  bb = bb+1;
  #end
  #declare  aa = aa+1;
  #end }


  #declare Tex = texture{pigment{rgb 1} finish{ambient .4 diffuse .2}}

  object{HalfDome_1 rotate 180*y texture{Tex}}

  //object{HalfDome_2 rotate 0*y texture{Tex}} 


-- 
Ken Tyler

mailto://tylereng@pacbell.net


Post a reply to this message

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