coords.Coords.shear#
- Coords.shear(dir=0, dir1=1, skew=1.0, inplace=False)#
Return a copy skewed in the direction of a global axis.
This translates points in the direction of a global axis, over a distance dependent on the coordinates along another axis.
Parameters#
- dir: int (0,1,2)
Global axis in which direction the points are translated.
- dir1: int (0,1,2)
Global axis whose coordinates determine the length of the translation.
- skew: float
Multiplication factor to the coordinates dir1 defining the translation distance.
- inplace: bool, optional
If True, the coordinates are translated in-place.
Notes#
This replaces the coordinate
dirwith(dir + skew * dir1). If dir and dir1 are different, rectangular shapes in the plane (dir,dir1) are thus skewed along the direction dir into parallellogram shapes. If dir and dir1 are the same direction, the effect is that of scaling in the dir direction.Examples#
>>> X = Coords([[0.0, 0.0],[1.0, 0.0],[1.0, 1.0],[0.0, 1.0]]) >>> print(X.shear(dir=0, dir1=1, skew=0.5)) [[0. 0. 0. ] [1. 0. 0. ] [1.5 1. 0. ] [0.5 1. 0. ]]