Skip to content

Documentation / @ripl/core / getPadAngleAtRadius

Function: getPadAngleAtRadius() ​

getPadAngleAtRadius(padWidth, radius): number

Defined in: packages/core/src/math/geometry.ts:91

Returns the angular inset, in radians, that trims an arc at radius back from a gap of padWidth logical pixels centred on the boundary angle — asin(padWidth / (2 * radius)).

Applying it per radius (rather than insetting by a fixed angle) leaves the straight edge on a line offset padWidth / 2 from the radial centreline, so neighbouring segments face each other with parallel edges a constant padWidth apart instead of a wedge that widens outward.

Saturates at a quarter turn where the gap is at least as wide as the diameter — inside radius < padWidth / 2 nothing of the arc survives, and an infinite padWidth saturates like any other over-wide gap. Returns 0 for a padWidth that is non-positive or NaN, and for a radius that is negative or NaN.

Parameters ​

ParameterTypeDescription
padWidthnumberThe gap width, in logical pixels, held constant at every radius.
radiusnumberThe radius at which the inset is measured.

Returns ​

number

The angular inset to apply at each end of the arc, in radians.