@graphty/layout / positions / rescaleInPlace
Function: rescaleInPlace()
rescaleInPlace<
T>(positions,dim,scale?,center?):T
Defined in: positions.ts:125
rescaleLayout over a flat array, in place: centre the positions on their mean, scale the farthest to scale and move them to center. A NaN component is skipped by the mean and the distance and stays NaN; when every position coincides, each non-NaN component becomes the centre's. Scratch is f64.
Type Parameters
T
T extends F32 | F64
Parameters
positions
T
dim-stride positions, rewritten in place
dim
number
components per row
scale?
number = 1
the distance of the farthest position from the centre after rescaling
center?
ArrayLike<number>
the target centre (missing components are 0)
Returns
T
positions