Skip to content

Constants and Functions

Jeff Hayes edited this page May 13, 2025 · 5 revisions

Table of Contents

Constants

pi : 3.14159 ratio between diameter and circumference of a circle
rad : 57.29578 degrees in a radian for conversions
clearance : 0.2 arbitrary value for space to leave between mating gears

Functions

rad_to_deg( radians )

convert an Angle in Radians to Degrees using formula:\ (Angle in Radians) × 180°/π = Angle in Degrees\ where 1 Radian = 180/π Degrees = 57.296 Degrees\ was called grad(angle).

deg_to_rad( degrees )

convert an Angle in Degrees to Radians using formula:

>Angle in Degrees × π/180° = Angle in Radians\

 rho x π/180° = / 180°/π\
 QED degrees/57.29578 --> radians

was called radian( angle )

polar_to_cartesian(\[radius,angle\])

Convert a 2 dimensional position in polar coordinates into Cartesian coordinates.

  • The input vector must have form \[radius,angle\] were the angles are in degrees.
  • It returns a vector of form \[X,Y\]

ev(r,rho)

Adjust polar coords given by r (radius?) and rho to by a rotation ? or a translation ? >return a vector \[x,y\] ? >where x will be radius/cosine(rho) >and y = rad_to_deg(tan(rho) - deg_to_rad(rho)) > i.e. polar_to_cartesian( ev(rb,rho_ra) )

sphere_ev(theta0,theta)

The two angles, theta0 and theta, are used to calculate a mystery value. === sphere_to_cartesian(XYZCoords) convert a 3 dimensional position in polar coordinates into Cartesian coordinates.\ >where XYZCoords is a vector of form [radius,angle,angle] with the angles in degrees >it returns a vector \[X,Y,Z\]

is_even(number)

returns 1 when the given number is even and 0 when odd providing a value that, when multiplied by the modulus of a gear, either preserves it, or zeros it in the calculation.

spiral(a, r0, phi)

Function to calculate a scalar value using a*phi + r0.

Clone this wiki locally