pycg.isometry
Classes
Isometry
The Isometry class represents an isometry transformation, which consists of a rotation represented by a quaternion and a translation represented by a 3-dimensional vector. The class provides various methods for creating, manipulating, and operating on isometry transformations.
Constructor
Isometry(q=None, t=None): Creates a newIsometryobject with the given rotation quaternionq(default is the identity quaternion) and translation vectort(default is the zero vector).
Properties
rotation: Returns anIsometryobject with only the rotation part of the transformation.matrix: Returns the transformation matrix corresponding to the isometry.continuous_repr: Returns the continuous representation of the isometry as a 9-dimensional vector.full_repr: Returns the full representation of the isometry as a 12-dimensional vector.
Methods
from_matrix(mat, t_component=None, ortho=False): Creates anIsometryobject from a transformation matrixmat. Ift_componentis specified, it represents the translation component of the matrix. Iforthois set toTrue, the rotation matrix will be projected onto the orthogonal group.from_axis_angle(axis, degrees=None, radians=None, t=None): Creates anIsometryobject from an axis-angle representation. The rotation axis can be specified as a 3-dimensional vector or as a string ("X", "Y", "Z" or "+X", "+Y", "+Z", "-X", "-Y", "-Z").from_euler_angles(a1, a2, a3, format='XYZ', t=None): Creates anIsometryobject from Euler angles. The Euler angles can be specified in degrees or radians. Theformatparameter determines the rotation order.from_twist(xi): Creates anIsometryobject from a twist vector, which represents a spatial velocity in the Lie algebra of SE(3).from_so3_exp(phi): Creates anIsometryobject from a rotation vector in the Lie algebra of SO(3) using the exponential map.inv(): Returns the inverse of the isometry.to_gl_camera(): Returns a newIsometryobject that is adjusted for OpenGL camera coordinates.look_at(source, target, up=None): Creates anIsometryobject that represents the camera transformation from a source point to a target point, with an optional up vector.chordal_l2_mean(*isometries): Calculates the mean isometry from a list of isometries using the chordal L2 mean method.copy(iso): Creates a copy of the givenIsometryobject.adjoint_matrix(): Returns the adjoint matrix of the isometry.log(): Calculates the logarithm map of the isometry, which represents the twist vector in the Lie algebra of SE(3).tangent(prev_iso, next_iso): Calculates the tangent vector between two isometriesprev_isoandnext_isoat the current isometry.interpolate(source, target, alpha): Interpolates between two isometriessourceandtargetusing a parameteralphain the range [0, 1].
ScaledIsometry
The ScaledIsometry class represents a scaled isometry transformation, which is an isometry transformation with an additional scaling factor applied outside the transformation. The class provides similar functionality to the Isometry class, with support for scaling.
Constructor
ScaledIsometry(s=1.0, iso=None): Creates a newScaledIsometryobject with the given scaling factors(default is 1.0) and theIsometryobjectiso(default is the identity isometry).
Properties
t: Returns the translation vector of the underlyingIsometryobject.q: Returns the rotation quaternion of the underlyingIsometryobject.
Methods
from_matrix(mat, ortho=False): Creates aScaledIsometryobject from a transformation matrixmat. Iforthois set toTrue, the rotation matrix will be projected onto the orthogonal group.inv(): Returns the inverse of the scaled isometry.matrix: Returns the transformation matrix corresponding to the scaled isometry.__matmul__(other): Overloaded matrix multiplication operator (@) for operating on other isometries or transformations.