POV-Ray : Newsgroups : povray.binaries.scene-files : Geo_flower Server Time
2 Sep 2024 08:16:44 EDT (-0400)
  Geo_flower (Message 1 to 1 of 1)  
From: F Audet
Subject: Geo_flower
Date: 26 Oct 2001 13:21:41
Message: <3BD99AC1.22F5E10F@sympatico.ca>
// Persistence of Vision Ray Tracer Scene Description File
// File: Geo_stuff.pov
// Vers: 3.1
// Desc: to build a #macro aimed to construct smooth gear_like shapes.
// Date: october,  23-24,  2001
// Auth: Pilot Alex
//

#include "colors.inc"

global_settings {
  assumed_gamma 1.95
}

#macro Geo_flower (
    rad_whole_thing, // define the radius of the whole shape
    step_num,        // ...how many pos_neg curved segments inside a 360

    // it allows a range of possibilities from 2 to "any logical
number"!
    line_thickness,  //
   // smoother,        // it should be kept between 0 and 70
!!!!!!!!!!!!!
   // I removed this keyword, so that its part of the code,
   // cause it is not working properly //
   //////////////////////////////////////////////////////////
    circonf          // does the shape do a complete 360, or only a 270,
etc...
    surface )        // texture

#local steps      = step_num;
#local rot_sampl  = 360/(steps*2);
#local x1         = rad_whole_thing;
#local y1         = 0;
#local x2         = x1*cos(radians(rot_sampl));
#local y2         = x1*sin(radians(rot_sampl));
#local tor_rad    = (sqrt(pow(x1-x2, 2)+pow(y1-y2, 2)))/2; //it gives
the rad...

#declare part_tobe_duplicated =
union {
  difference {
    torus { tor_rad, line_thickness translate x1*x
    }
    difference { plane { +x, 0 } plane { +z, 0 }
      rotate < 0, -rot_sampl/2, 0 >
      translate x1*x
    }
    difference { plane { +x, 0 } plane { -z, 0 }
      rotate < 0, +rot_sampl/2, 0 >
      translate x1*x
    }
  }
  difference {
    torus { tor_rad, line_thickness translate x1*x
      rotate -rot_sampl*y
    }
    plane { -x, 0
      rotate < 0, (-rot_sampl/2), 0 >
      translate x1*x
    }
    plane { -x, 0
      rotate -(rot_sampl/2)*y
      translate x1*x
      rotate -rot_sampl*y
    }
  }
  texture { surface }
}

#declare final_obj = union {
#local counter = 0;
#while ( counter < circonf )
  object { part_tobe_duplicated
    rotate < 0, -counter, 0 >
  }
  #local counter = counter+(360/steps);
#end
}
object { final_obj
  rotate -90*x
}
#end

#declare  surf_testing =
texture { pigment { Gray90 } finish { ambient 0.2 brilliance 1.5
specular 0.75 }}

object { Geo_flower ( 5,  3,  0.3,  360, surf_testing )
  translate < 0, 0, 0 >
}

//////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////

// #macro allowing to move a camera around any xyz vector...
// The xx,  yy,  and  zz are the vector components of the new center
point....
// The "back" keyword is the distance of the cam from the
center_point...
// ...rot_adjust allow to be more specific with the reel focus area....
#macro flying_cam ( lens, xx, yy, zz,  back, x_rot, y_rot, xrot_adjust,
yrot_adjust, y_trans )
  #declare cam_2001 =
  camera { location < 0, 0, -1 > look_at 0.000 angle lens
    rotate xrot_adjust*x rotate yrot_adjust*y
  }
  camera { cam_2001
    translate <0,y_trans,-back>
    rotate <x_rot, y_rot, 0>
    translate < xx, yy, zz >
  }
#end

flying_cam ( 30, 0, 0, 0, 40, -15, -30, 0, 0, 0 )

light_source { < 200, 200, -400 >, White*1.15 }

/////////////////////////////////////////////////////////////////////
///////////  E N D   O F   T H I S   C O D E  ///////////////////////
/////////////////////////////////////////////////////////////////////


Post a reply to this message

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