|
![](/i/fill.gif) |
// Persistence of Vision Ray Tracer Scene Description File
// File: Geo_Trigo.inc
// Vers: 3.1
// Desc: to build a #macro aimed to construct smooth gear_like shapes.
// Date: october, 24-27, 2001
// Auth: Pilot Alex
//
#include "colors.inc"
global_settings { assumed_gamma 1.95 }
//////////////////////////////////////
#macro Geo_Trigo (
rad_whole_thing, // define the radius of the whole shape
frekency, // ...how many waves inside a 360
line_thickness, //
smoother_pow, // keep it between about-10 and about+25.....
openning_angl, // a closed ring mean openning_angl = 360
surface ) // texture
// assume that xy is the xz coordinate of a basic torus...
#local waves_quantity = frekency;
#local rot_ini = (360/waves_quantity)/2;
#local x0 = rad_whole_thing;
#local y0 = 0;
#local x1 = x0*cos(radians(rot_ini));
#local y1 = x0*sin(radians(rot_ini));
#local prepare = (sqrt( pow(x0-x1, 2) + pow(y0-y1, 2)));
#local smoother =
((prepare/(prepare*10))*smoother_pow)*(x0/waves_quantity);
#local reel_x0 = x0 - smoother;
#local reel_y0 = y0;
#local reel_x1 = ((x0+smoother)*x1)/x0;
#local reel_y1 = ((x0+smoother)*y1)/x0;
#local segmt_rad = (sqrt( pow(reel_x0-reel_x1, 2) + pow(reel_y0-reel_y1,
2)))/2;
#local side_c = segmt_rad * 2;
#if ( reel_x1-reel_x0 > 0 )
#local side_b = reel_x1-reel_x0;
#else
#local side_b = reel_x0 - reel_x1;
#end
#if ( reel_x1-reel_x0 > 0 )
#local angl_A = degrees(acos(side_b/side_c));
#else
#local angl_A = 180-(degrees(acos(side_b/side_c)));
#end
#local angl_A_neg = 180 - angl_A;
#local angl_needed = ( 180-(rot_ini+angl_A_neg) )*2;
#local upper_cut = -angl_A + angl_needed;
#local upper_trans = < reel_x1, 0, reel_y1 >;
////////////////////////////////////////////////////////////
#declare wave_sampl =
union {
difference {
torus { segmt_rad, line_thickness translate reel_x0*x }
plane { +z, 0 }
plane { -z, 0 rotate -angl_A*y translate reel_x0*x }
}
difference {
torus { segmt_rad, line_thickness translate upper_trans
}
difference {
plane { +z, 0 rotate -angl_A*y translate reel_x0*x }
plane { -z, 0 rotate (-rot_ini-0.1)*y }
}
difference {
plane { -z, 0 rotate upper_cut*y translate upper_trans }
plane { +z, 0 rotate (-rot_ini+0.1)*y }
}
}
difference {
torus { segmt_rad, line_thickness translate reel_x0*x rotate
(-rot_ini*2)*y }
plane { -z, 0 rotate (-rot_ini*2)*y }
plane { +z, 0 rotate upper_cut*y translate upper_trans }
}
}
#declare final_obj = union {
#local counter = 0;
#while ( counter < openning_angl )
object { wave_sampl
rotate < 0, -counter, 0 >
}
#local counter = counter+(360/waves_quantity);
#end
}
object { final_obj
//rotate -90*x
texture { surface }
}
#end
///////////////////////////////////////////////////
///////////////////////////////////////////////////
///////////////////////////////////////////////////
///////////////////////////////////////////////////
///// E N D O F T H I S M A C R O //////
///////////////////////////////////////////////////
///////////////////////////////////////////////////
///////////////////////////////////////////////////
///////////////////////////////////////////////////
#declare surf_testing1 =
texture { pigment { Yellow } finish { specular 0.5 brilliance 3 metallic
} }
object { Geo_Trigo ( 8, 6, 0.5, +10, 360, surf_testing1 )
translate < 0, 0, 0 > no_shadow
}
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// #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 ( 45, 0, 0, 0, 30, 40, 0, 0, 0, 0 )
light_source { < +600, 600, -900 >, White*1.2 }
//light_source { < -400, +50, -100 >, Yellow*0.75 }
///////////////////////////////////////////////////
///////////////////////////////////////////////////
///////////////////////////////////////////////////
///////////////////////////////////////////////////
/////// E N D O F T H I S C O D E //////
///////////////////////////////////////////////////
///////////////////////////////////////////////////
///////////////////////////////////////////////////
///////////////////////////////////////////////////
Post a reply to this message
|
![](/i/fill.gif) |