gearbox.mathutils
Small geometry and trigonometry helpers shared across the package.
Unless a name says otherwise, angles passed to or returned by public functions are in degrees,
which is the convention used by gear standards and by the user-facing models.
-
involute(angle)[source]
Return the involute function inv(alpha) = tan(alpha) - alpha.
- Parameters:
angle (float) – Pressure angle in degrees.
- Returns:
The involute function value (dimensionless, i.e. an angle in radians).
- Return type:
float
-
inverse_involute(value, tolerance=0.0)[source]
Return the angle whose involute function equals value.
Solved by bisection on [0, pi/2], down to machine precision unless a looser tolerance is
requested.
- Parameters:
-
- Returns:
The pressure angle in degrees.
- Return type:
float
-
sign(number)[source]
Return -1, 0 or 1 according to the sign of number.
- Return type:
int
-
cartesian_to_polar(x, y)[source]
Convert a Cartesian vector to polar coordinates.
- Parameters:
-
- Returns:
[radius, angle] with the angle in radians, measured from the x axis.
The angle of the null vector is arbitrarily 0.
- Return type:
list[float]
-
polar_to_cartesian(radius, angle)[source]
Convert polar coordinates to a Cartesian vector.
- Parameters:
-
- Returns:
[x, y].
- Return type:
list[float]
-
rotate(coords, angle, center=(0, 0))[source]
Rotate points counter-clockwise around center.
- Parameters:
-
- Returns:
The rotated points as [x, y] lists.
- Return type:
list[list[float]]