HughPH.Box2D
Organised dotnet bindings for Box2D 3.1.0
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
Box2D.Gears Class Reference

Gear calculation functionality no included in Box2D. More...

Public Member Functions

ReadOnlySpan< ShapeCreateInvoluteGear (Body body, ShapeDef shapeDef, float pitchRadius, int teeth, float toothLength)
 Create the shapes that represent an approximate Involute Gear on the supplied Body, situated at the Body's origin.
 

Public Attributes

float pitchRadius
 Calculate the closest possible pitch radius, number of teeth and resulting gear ratio for a new gear based on the current gear pitch radius, number of teeth, and a gear ratio.
 

Detailed Description

Gear calculation functionality no included in Box2D.

Member Function Documentation

◆ CreateInvoluteGear()

ReadOnlySpan< Shape > Box2D.Gears.CreateInvoluteGear ( Body  body,
ShapeDef  shapeDef,
float  pitchRadius,
int  teeth,
float  toothLength 
)
inline

Create the shapes that represent an approximate Involute Gear on the supplied Body, situated at the Body's origin.

Parameters
bodyThe Body to attach the shapes to.
shapeDefThe ShapeDef to use for the shapes.
pitchRadiusThe pitch radius of the gear - that is, where the teeth engage.
teethThe number of teeth that the gear should have.
toothLengthThe length of the teeth - how far they stick out from the sprocket.
Returns
A list of shapes that were added to the Body.
Exceptions
ArgumentOutOfRangeException>If teeth is less than 3

Member Data Documentation

◆ pitchRadius

float Box2D.Gears.pitchRadius

Calculate the closest possible pitch radius, number of teeth and resulting gear ratio for a new gear based on the current gear pitch radius, number of teeth, and a gear ratio.

Calculate compatible gear metrics for a second gear with matching circular pitch, based on a desired gear ratio and known tooth length of the first gear. This version clamps the tooth length of the second gear to ensure meshing clearance.

Parameters
pitchRadiusThe pitch radius of the first gear.
teethThe number of teeth on the first gear.
ratioThe desired gear ratio. A ratio of 1 means the second gear is the same size as the first gear. A value below 1 means the second gear is smaller, and a value above 1 means the second gear is larger.
Returns
The pitch radius, number of teeth and actual gear ratio for the new gear.

This method is intended to help find a size of gear that will mesh with the first gear, adjusting the ratio if necessary.

Parameters
pitchRadiusThe pitch radius of the first gear.
teethThe number of teeth on the first gear.
toothLengthtooth length of the first gear.
ratioDesired gear ratio (second gear : first gear).
Returns
The second gear's pitch radius, number of teeth, safe tooth length, and the distance between the gear centres.

This method is intended to help find a size of gear and tooth length that will mesh with the first gear, without adjusting the ratio.


The documentation for this class was generated from the following file: