index 30500e3ab28582457e20b6a1bac1e18612d7e021..c9bbde8f2093191df4168c9c346d0f334caea7a5 100644 (file)
/*
* Copyright (C) Johan Engelen 2007 <j.b.c.engelen@utwente.nl>
+ * Copyright 2006 Michael G. Sloan <mgsloan@gmail.com>
+ * Copyright 2006 Aaron Spike <aaron@ekips.org>
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
double pitch_diameter() {return (_number_of_teeth * _module) / M_PI;}
double pitch_radius() {return pitch_diameter() / 2.0;}
void pitch_radius(double R) {_module = (2 * M_PI * R) / _number_of_teeth;}
-
+
// base circle serves as the basis for the involute toothe profile
double base_diameter() {return pitch_diameter() * cos(_pressure_angle);}
double base_radius() {return base_diameter() / 2.0;}
-
+
// diametrical pitch
double diametrical_pitch() {return _number_of_teeth / pitch_diameter();}
-
+
// height of the tooth above the pitch circle
double addendum() {return 1.0 / diametrical_pitch();}
// depth of the tooth below the pitch circle
double dedendum() {return addendum() + _clearance;}
-
+
// root circle specifies the bottom of the fillet between teeth
double root_radius() {return pitch_radius() - dedendum();}
double root_diameter() {return root_radius() * 2.0;}
-
+
// outer circle is the outside diameter of the gear
double outer_radius() {return pitch_radius() + addendum();}
double outer_diameter() {return outer_radius() * 2.0;}
-
+
// angle covered by the tooth on the pitch circle
double tooth_thickness_angle() {return M_PI / _number_of_teeth;}
-
+
Geom::Point centre() {return _centre;}
void centre(Geom::Point c) {_centre = c;}
-
+
double angle() {return _angle;}
void angle(double a) {_angle = a;}
-
+
int number_of_teeth() {return _number_of_teeth;}
-
+
Geom::Path path();
Gear spawn(Geom::Point p);
-
+
Gear(int n, double m, double phi) {
_number_of_teeth = n;
_module = m;
D2<SBasis> B;
D2<SBasis> I;
Linear bo = Linear(start,stop);
-
+
B[0] = cos(bo,2);
B[1] = sin(bo,2);
-
+
I = B - Linear(0,1) * derivative(B);
I = I*base_radius() + _centre;
return I;
D2<SBasis> _arc(double start, double stop, double R) {
D2<SBasis> B;
Linear bo = Linear(start,stop);
-
+
B[0] = cos(bo,2);
B[1] = sin(bo,2);
-
+
B = B*R + _centre;
return B;
}
Geom::Path Gear::path() {
Geom::Path pb;
-
+
// angle covered by a full tooth and fillet
double tooth_rotation = 2.0 * tooth_thickness_angle();
// angle covered by an involute
double root_advance = (tooth_rotation - tip_advance) - (2.0 * involute_advance);
// begin drawing the involute at t if the root circle is larger than the base circle
double involute_t = involute_swath_angle(root_radius())/involute_swath_angle(outer_radius());
-
+
//rewind angle to start drawing from the leading edge of the tooth
double first_tooth_angle = _angle - ((0.5 * tip_advance) + involute_advance);
-
+
Geom::Point prev;
for (int i=0; i < _number_of_teeth; i++)
{
prev = leading_end;
pb.appendNew<LineSegment>(leading_end);
}
-
+
D2<SBasis> root = _arc(cursor, cursor+root_advance, root_radius());
makeContinuous(root, prev);
pb.append(SBasisCurve(root));
cursor += root_advance;
prev = root.at1();
-
+
if (base_radius() > root_radius()) {
Geom::Point trailing_start = root.at1();
Geom::Point trailing_end = (base_radius() * unit_vector(trailing_start - _centre)) + _centre;
prev = trailing_end;
}
}
-
+
return pb;
}
LPEGears::LPEGears(LivePathEffectObject *lpeobject) :
Effect(lpeobject),
- teeth(_("Teeth"), _("The number of teeth"), "teeth", &wr, this, 10),
- phi(_("Phi"), _("???"), "phi", &wr, this, 5)
+ teeth(_("Teeth:"), _("The number of teeth"), "teeth", &wr, this, 10),
+ phi(_("Phi:"), _("Tooth pressure angle (typically 20-25 deg). The ratio of teeth not in contact."), "phi", &wr, this, 5)
{
+ /* Tooth pressure angle: The angle between the tooth profile and a perpendicular to the pitch
+ * circle, usually at the point where the pitch circle meets the tooth profile. Standard angles
+ * are 20 and 25 degrees. The pressure angle affects the force that tends to separate mating
+ * gears. A high pressure angle means that higher ratio of teeth not in contact. However, this
+ * allows the teeth to have higher capacity and also allows fewer teeth without undercutting.
+ */
+
+ teeth.param_make_integer();
+ teeth.param_set_range(3, 1e10);
registerParameter( dynamic_cast<Parameter *>(&teeth) );
registerParameter( dynamic_cast<Parameter *>(&phi) );
-
- straight_original_path = true;
}
LPEGears::~LPEGears()
}
std::vector<Geom::Path>
-LPEGears::doEffect (std::vector<Geom::Path> & path_in)
+LPEGears::doEffect_path (std::vector<Geom::Path> const & path_in)
{
std::vector<Geom::Path> path_out;
Geom::Path gearpath = path_in[0];
return path_out;
}
-
} // namespace LivePathEffect
} /* namespace Inkscape */