coords.Coords.resized#

Coords.resized(size=1.0, tol=1e-05)#

Return a copy of the Coords object scaled to a target size.

Parameters#

sizefloat or array-like of 3 floats, optional

Desired size(s) along the global axes. If a single value is provided, the scaling is uniformly so that all directions reach this size. If three values are provided, each axis is scaled independently to the corresponding size.

tolfloat, optional

Directions for which the Coords has a size smaller than tol times the maximum size are not rescaled.

Returns#

Coords

A scaled copy of the Coords object.

Notes#

This method computes the current size of the Coords in each global direction using sizes(), and applies a scaling factor to reach the specified size(s).

Examples#

>>> X = Coords([[0., 0., 0.], [0., 2., 3.]])
>>> print(X.resized(1.0).sizes())
[0. 1. 1.]
>>> print(X.resized([2., 4., 6.]).sizes())
[0. 4. 6.]