pynbody.transformation.Transformable#
- class pynbody.transformation.Transformable[source]#
Bases:
object
A mixin class for objects that can generate a Transformation object
Methods
offset_velocity
(offset)Shift the velocity by the given offset.
rotate
(matrix[, description])Rotates using a specified matrix.
rotate_x
(angle)Rotates about the current x-axis by 'angle' degrees.
rotate_y
(angle)Rotates about the current y-axis by 'angle' degrees.
rotate_z
(angle)Rotates about the current z-axis by 'angle' degrees.
transform
(matrix)Deprecated alias for
rotate()
.translate
(offset)Translate by the given offset.
- __init__(*args, **kwargs)#
- offset_velocity(offset)[source]#
Shift the velocity by the given offset.
Returns a
pynbody.transformation.GenericTranslation
object which can be used as a context manager to ensure that the translation is undone.For more information, see the
pynbody.transformation
documentation.
- rotate(matrix, description=None)[source]#
Rotates using a specified matrix.
Returns a
pynbody.transformation.GenericTranslation
object which can be used as a context manager to ensure that the translation is undone.For more information, see the
pynbody.transformation
documentation.- Parameters:
matrix (array_like) – The 3x3 orthogonal matrix to rotate by
description (str) – A description of the rotation to be returned from str() and repr()
- rotate_x(angle)[source]#
Rotates about the current x-axis by ‘angle’ degrees.
Returns a
pynbody.transformation.GenericTranslation
object which can be used as a context manager to ensure that the translation is undone.For more information, see the
pynbody.transformation
documentation.
- rotate_y(angle)[source]#
Rotates about the current y-axis by ‘angle’ degrees.
Returns a
pynbody.transformation.GenericTranslation
object which can be used as a context manager to ensure that the translation is undone.For more information, see the
pynbody.transformation
documentation.
- rotate_z(angle)[source]#
Rotates about the current z-axis by ‘angle’ degrees.
Returns a
pynbody.transformation.GenericTranslation
object which can be used as a context manager to ensure that the translation is undone.For more information, see the
pynbody.transformation
documentation.
- translate(offset)[source]#
Translate by the given offset.
Returns a
pynbody.transformation.GenericTranslation
object which can be used as a context manager to ensure that the translation is undone.For more information, see the
pynbody.transformation
documentation.