|
|
On Tue, 20 Jul 1999 19:17:21 GMT, dar### [at] engusfedu (xsqr) wrote:
>Are there any utilities (programs, .inc's, plugins) for automating the
>creation of gears?
>
>Also, how could I create an object (specifically gears) using involute
>curves. I can see creating a curved surface, but what about a solid?
>Is there a way of using polar coordinates in POV-Ray?
I've wanted an excuse to do some gears, so here is my re-invention of the gear wheel.
It's different to Mr Schimmler's gear.inc file in as much as it's based more on
British/US
practice which uses Diametral Pitch rather than Modul.
It's also in macro form and may be a bit easier to understand.
BTW as POV has a pretty full range of trig functions, as well as rotations,
translations,
scaling, shearing, and a full matrix transformation it's easy to from polar to
cartesian.
//---------------------------------------------------------------------------
// Persistence of Vision Ray Tracer Scene Description File
// Involute Gear Example
// Date: 21 July 1999
// Auth: D.G.Wilkinson
//
#version 3.1;
#include "colors.inc"
global_settings
{
assumed_gamma 1.0
}
camera
{
location <25/8, 0, -4.0>
direction 1.5*z
right 4/3*x
look_at <25/8 0, 0.0>
}
sky_sphere
{
pigment
{
gradient y
color_map { [0.0 color blue 0.6] [1.0 color rgb 1] }
}
}
light_source
{
<-30, 30, -30>
color rgb 1
}
// The gear macro. DP is the Diametral Pitch
#macro Gear(NumTeeth,DP,FaceWidth)
#declare PitchRad = NumTeeth/(2*DP); // this can be accessed outside the macro
#local BaseRad = PitchRad*cos(radians(20)); // from which the involute is generated
#local AngulPitch = 2*pi/NumTeeth; // in radians
#declare PitchAngle = degrees(AngulPitch); // needed outside the macro
#local InvPoint = array[22] // array for points on the involute curve
#local Inv20=tan(radians(20))-radians(20); // assumes a pressure angle of 20 degrees
#local Incr=2/(DP*10); // 10 increments on the involute
#local R1=PitchRad-1/DP; // the radius at which the co-ords are calculated
#local Counter = 1;
#while (Counter<10.5)
#local Psi = acos(BaseRad/R1);
#local T1 = BaseRad*tan(Psi);
#local Inv = T1/BaseRad-Psi; // the involute function as used in gear design
#local InvPoint[Counter] = <R1*sin(Inv),R1*cos(Inv)>; // left flank
#local InvPoint[21-Counter] = <R1*sin(-Inv+2*Inv20+AngulPitch/2), // right
flank
R1*cos(-Inv+2*Inv20+AngulPitch/2)>;
#local Counter = Counter + 1;
#local R1 = R1 + Incr;
#end
#local InvPoint[0] = <0,PitchRad-1.26/DP>; // points on the root (off the involute)
#local InvPoint[21] = <(PitchRad-1.26/DP)*sin(2*Inv20+AngulPitch/2),
(PitchRad-1.26/DP)*cos(2*Inv20+AngulPitch/2)>;
#local Count=0;
#local Tooth = // the whole tooth and nothing but the tooth
prism { -FaceWidth,0, 23
#while (Count < 21.5)
InvPoint[Count]
#local Count=Count+1;
#end
InvPoint[0] // repeat the first point to close the prism
}
union{ // this is the gear with a tooth centred on the +y axis
#local N1 = 0;
#while (N1<NumTeeth) // place the teeth
object {Tooth rotate -x*90 rotate z*N1*360/NumTeeth }
#local N1=N1+1;
#end
cylinder { <0,0,FaceWidth>,<0,0,0>,PitchRad-1.25/DP } // add the disc
rotate <0,0,degrees(Inv20+AngulPitch/4)> // rotate it so a tooth is centered
}
#end
#declare N1=25; // number of teeth in the gear
#declare N2=15; // number of teeth in the pinion
#declare DP=4; // Diametral Pitch
#declare Centres=(N1+N2)/(2*DP);
// the gears are rotated so that they will correctly mesh.
// animated using the clock variable
object { Gear(N2,DP,1) rotate <0,0,(clock*PitchAngle)+90-PitchAngle/2>
translate <Centres,0,0> pigment
{Red}}
object { Gear(N1,DP,1.1) rotate <0,0,-(clock*PitchAngle)-90> pigment {White}}
//--------------- End of program --------------------------
David
------------
dav### [at] cwcomnet
http://www.hamiltonite.mcmail.com
------------
Post a reply to this message
|
|