coords.Coords.to_coordsys#
- Coords.to_coordsys(cs)#
Express the coordinates in another coordinate system.
Parameters#
- cs
CoordSys Target Cartesian coordinate system in which to express the current coordinates.
Returns#
- Coords
New Coords object representing the same points, but with coordinates expressed in coordinate system
cs.
See Also#
from_coordsys(): perform the inverse transformation
Examples#
>>> X = Coords([[0.0, 0.0, 0.0],[1.0, 0.0, 0.0]]) >>> print(X) [[0. 0. 0.] [1. 0. 0.]] >>> from hellotriangle.coordsys import CoordSys >>> CS = CoordSys(oab=[[0.5, 0.5, 0.0], [1.0, 0.5, 0.0], [0.5, 1.0, 0.0]]) >>> print(CS) CoordSys: trl=[0.5 0.5 0. ]; rot=[[1. 0. 0.] [0. 1. 0.] [0. 0. 1.]] >>> print(X.to_coordsys(CS)) [[-0.5 -0.5 0. ] [ 0.5 -0.5 0. ]]
Let’s now create a new coordinate system that is translated and rotated with respect to the original coordinate system:
>>> CS = CoordSys(oab=[[0.5,0.,0.],[1.,0.5,0.],[0.,1.,0.]]) >>> print(CS) CoordSys: trl=[0.5 0. 0. ]; rot=[[ 0.7071 0.7071 0. ] [-0.7071 0.7071 0. ] [ 0. -0. 1. ]] >>> print(X.to_coordsys(CS)) [[-0.3536 0.3536 0. ] [ 0.3536 -0.3536 0. ]] >>> print(X.to_coordsys(CS).from_coordsys(CS)) [[ 0. 0. 0.] [ 1. -0. 0.]]
- cs