Skip to content

Documentation / @ripl/core / getPadInnerRadius

Function: getPadInnerRadius() ​

getPadInnerRadius(padWidth, span): number

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

Returns the smallest radius at which a sector of span radians still faces its neighbors with edges a full padWidth apart — (padWidth / 2) / sin(min(span, π) / 2).

The straight edges a getPadAngleAtRadius inset produces are parallel lines offset padWidth / 2 from the radial centrelines, and parallel lines never meet: below this radius the inset needed to reach them exceeds half the span, the sector collapses onto its mid-angle, and the gap tapers away instead of holding its width. Flooring a sector's inner radius here is what lets a gap run all the way to the center of a shape that has no hole.

Returns 0 where no floor applies — a padWidth that is non-positive, NaN or infinite, a span that is non-positive or NaN, and a full turn or wider, which has no neighbor to clear.

Parameters ​

ParameterTypeDescription
padWidthnumberThe gap width, in logical pixels, held constant at every radius.
spannumberThe angular span of the sector, in radians.

Returns ​

number

The radius at which the sector's straight edges converge, or 0 where none does.