coords.Coords.roll_axes#

Coords.roll_axes(n=1)#

Roll the coordinate axes over the given amount.

Parameters#

n: int

Number of positions to roll the axes. With the default (1), the old axes (0,1,2) become the new axes (2,0,1).

Returns#

Coords

A Coords where the coordinate axes of the points have been rolled over n positions.

Notes#

X.roll_axes(1) can also be obtained by X.copy_axes((0,1,2),(2,0,1)). It is also equivalent with a rotation over -120 degrees around the trisectrice of the first quadrant.

Examples#

>>> X = Coords([[0.0, 0.0],[1.0, 0.0],[1.0, 1.0],[0.0, 1.0]])
>>> X
Coords([[0., 0., 0.],
        [1., 0., 0.],
        [1., 1., 0.],
        [0., 1., 0.]])
>>> X.roll_axes(1)
Coords([[0., 0., 0.],
        [0., 1., 0.],
        [0., 1., 1.],
        [0., 0., 1.]])
>>> X.rotate(120,axis=[1.,1.,1.])
Coords([[ 0.,  0.,  0.],
        [-0.,  1., -0.],
        [-0.,  1.,  1.],
        [-0., -0.,  1.]])