# API Documentation¶

This is the detailed documentation of all public classes and functions. You can also search for specific modules, classes, or functions in the Index.

## `pytransform3d.rotations`¶

Rotations in three dimensions - SO(3).

### Input Validation Functions¶

 `check_matrix`(R[, tolerance, strict_check]) Input validation of a rotation matrix. `check_skew_symmetric_matrix`(V[, tolerance, …]) Input validation of a skew-symmetric matrix. Input validation of axis-angle representation. Input validation of compact axis-angle representation. `check_quaternion`(q[, unit]) Input validation of quaternion representation. `check_quaternions`(Q[, unit]) Input validation of quaternion representation. `check_rotor`(rotor) Input validation of rotor.

### Conversions to Rotation Matrix¶

See also Euler Angles for conversions from and to Euler angles that have been omitted here for the sake of brevity.

 `passive_matrix_from_angle`(basis, angle) Compute passive rotation matrix from rotation about basis vector. `active_matrix_from_angle`(basis, angle) Compute active rotation matrix from rotation about basis vector. Compute rotation matrix from two vectors. Compute rotation matrix from axis-angle. Compute rotation matrix from compact axis-angle. Compute rotation matrix from quaternion. `matrix_from_rotor`(rotor) Compute rotation matrix from rotor.

### Conversions to Axis-Angle¶

 `axis_angle_from_matrix`(R[, strict_check, check]) Compute axis-angle from rotation matrix. Compute axis-angle from quaternion. Compute axis-angle from compact axis-angle representation. Compute 3-dimensional axis-angle from a 4-dimensional one. Compute compact axis-angle from rotation matrix. Compute compact axis-angle from quaternion (logarithmic map).

### Conversions to Quaternion¶

 `quaternion_from_matrix`(R[, strict_check]) Compute quaternion from rotation matrix. Compute quaternion from axis-angle. Compute quaternion from compact axis-angle (exponential map). Converts from w, x, y, z to x, y, z, w convention. Converts from x, y, z, w to w, x, y, z convention.

### Conversions to Rotor¶

 `rotor_from_two_directions`(v_from, v_to) Construct the rotor that rotates one vector to another. `rotor_from_plane_angle`(B, angle) Compute rotor from plane bivector and angle.

### Quaternion and Axis-Angle Operations¶

 Compute axis-angle representation from two direction vectors. `axis_angle_slerp`(start, end, t) Spherical linear interpolation. Concatenate two quaternions. `q_prod_vector`(q, v) Apply rotation represented by a quaternion to a vector. Conjugate of quaternion. `pick_closest_quaternion`(quaternion, …) Resolve quaternion ambiguity and pick the closest one to the target. `quaternion_slerp`(start, end, t[, shortest_path]) Spherical linear interpolation. `quaternion_dist`(q1, q2) Compute distance between two quaternions. `quaternion_diff`(q1, q2) Compute the rotation in angle-axis format that rotates q2 into q1. `quaternion_gradient`(Q[, dt]) Time-derivatives of a sequence of quaternions. `quaternion_integrate`(Qd[, q0, dt]) Integrate angular velocities to quaternions.

### Rotors¶

 `wedge`(a, b) Outer product of two vectors (also exterior or wedge product). Convert bivector to normal vector of a plane. Geometric product of two vectors. `concatenate_rotors`(rotor1, rotor2) Concatenate rotors. `rotor_reverse`(rotor) Invert rotor. `rotor_apply`(rotor, v) Compute rotation matrix from rotor. `rotor_slerp`(start, end, t[, shortest_path]) Spherical linear interpolation.

### Plotting¶

 `plot_basis`([ax, R, p, s, ax_s, strict_check]) Plot basis of a rotation matrix. `plot_axis_angle`([ax, a, p, s, ax_s]) Plot rotation axis and angle. `plot_bivector`([ax, a, b, ax_s]) Plot bivector from wedge product of two vectors a and b.

### Testing¶

 `assert_axis_angle_equal`(a1, a2, *args, **kwargs) Raise an assertion if two axis-angle are not approximately equal. `assert_compact_axis_angle_equal`(a1, a2, …) Raise an assertion if two axis-angle are not approximately equal. `assert_quaternion_equal`(q1, q2, *args, **kwargs) Raise an assertion if two quaternions are not approximately equal. `assert_rotation_matrix`(R, *args, **kwargs) Raise an assertion if a matrix is not a rotation matrix.

### Utility Functions¶

 Normalize vector. Normalize rotation matrix. Normalize angle to (-pi, pi]. Normalize axis-angle representation. Normalize compact axis-angle representation. Compute perpendicular vector to two other vectors. `angle_between_vectors`(a, b[, fast]) Compute angle between two vectors. Orthogonal projection of vector a on vector b. `plane_basis_from_normal`(plane_normal) Compute two basis vectors of a plane from the plane’s normal vector. `random_vector`([random_state, n]) Generate an nd vector with normally distributed components. `random_axis_angle`([random_state]) Generate random axis-angle. `random_compact_axis_angle`([random_state]) Generate random compact axis-angle. `random_quaternion`([random_state]) Generate random quaternion. Generate the cross-product matrix of a vector.

### Deprecated Functions¶

 `matrix_from`([R, a, q, e_xyz, e_zyx]) Compute rotation matrix from another representation. `matrix_from_angle`(basis, angle) Compute passive rotation matrix from rotation about basis vector. Compute passive rotation matrix from intrinsic xyz Tait-Bryan angles. Compute passive rotation matrix from intrinsic zyx Tait-Bryan angles. `euler_xyz_from_matrix`(R[, strict_check]) Compute xyz Euler angles from passive rotation matrix. `euler_zyx_from_matrix`(R[, strict_check]) Compute zyx Euler angles from passive rotation matrix. `assert_euler_xyz_equal`(e_xyz1, e_xyz2, …) Raise an assertion if two xyz Euler angles are not approximately equal. `assert_euler_zyx_equal`(e_zyx1, e_zyx2, …) Raise an assertion if two zyx Euler angles are not approximately equal.

## `pytransform3d.transformations`¶

Transformations in three dimensions - SE(3).

### Utility Functions¶

 `random_transform`([random_state]) Generate random transform. `random_screw_axis`([random_state]) Generate random screw axis. Normalize exponential coordinates of transformation.

### Input Validation Functions¶

 `check_transform`(A2B[, strict_check]) Input validation of transform. Input validation for position and orientation quaternion. `check_screw_parameters`(q, s_axis, h) Input validation of screw parameters. `check_screw_axis`(screw_axis) Input validation of screw axis. Input validation for exponential coordinates of transformation. `check_screw_matrix`(screw_matrix[, …]) Input validation for screw matrix. `check_transform_log`(transform_log[, …]) Input validation for logarithm of transformation. `check_dual_quaternion`(dq[, unit]) Input validation of dual quaternion representation.

### Conversions to Transformation Matrix¶

 `transform_from`(R, p[, strict_check]) Make transformation from rotation matrix and translation. `translate_transform`(A2B, p[, strict_check, …]) Sets the translation of a transform. `rotate_transform`(A2B, R[, strict_check, check]) Sets the rotation of a transform. Compute transformation matrix from position and quaternion. Compute transformation matrix from exponential coordinates. `transform_from_transform_log`(transform_log) Compute transformation from matrix logarithm of transformation. Compute transformation matrix from dual quaternion.

### Conversions to Position and Quaternion¶

 `pq_from_transform`(A2B[, strict_check]) Compute position and quaternion from transformation matrix. Compute position and quaternion from dual quaternion.

### Conversions to Screw Parameters¶

 `screw_parameters_from_screw_axis`(screw_axis) Compute screw parameters from screw axis. Compute screw parameters from dual quaternion.

### Conversions to Screw Axis¶

 `screw_axis_from_screw_parameters`(q, s_axis, h) Compute screw axis representation from screw parameters. Compute screw axis and theta from exponential coordinates. `screw_axis_from_screw_matrix`(screw_matrix) Compute screw axis from screw matrix.

### Conversions to Exponential Coordinates¶

 Compute exponential coordinates from transformation matrix. Compute exponential coordinates from screw axis and theta. Compute exponential coordinates from logarithm of transformation.

### Conversions to Screw Matrix¶

 `screw_matrix_from_screw_axis`(screw_axis) Compute screw matrix from screw axis. `screw_matrix_from_transform_log`(transform_log) Compute screw matrix from logarithm of transformation.

### Conversions to Matrix Logarithm¶

 Compute matrix logarithm of transformation from exponential coordinates. Compute matrix logarithm of transformation from screw matrix and theta. `transform_log_from_transform`(A2B[, strict_check]) Compute matrix logarithm of transformation from transformation.

### Conversions to Dual Quaternions¶

 Compute dual quaternion from transformation matrix. Compute dual quaternion from position and quaternion. Compute dual quaternion from screw parameters.

### Apply Transformations¶

 `concat`(A2B, B2C[, strict_check, check]) Concatenate transformations. `invert_transform`(A2B[, strict_check, check]) Invert transform. `transform`(A2B, PA[, strict_check]) Transform point or list of points or directions. Convert 3D vector to position. Convert 3D vectors to positions. Convert 3D vector to direction. Convert 3D vectors to directions. `scale_transform`(A2B[, s_xr, s_yr, s_zr, …]) Scale a transform from A to reference frame B. `adjoint_from_transform`(A2B[, strict_check, …]) Compute adjoint representation of a transformation matrix.

### Dual Quaternion Operations¶

 Conjugate of dual quaternion. Quaternion conjugate of dual quaternion. `concatenate_dual_quaternions`(dq1, dq2) Concatenate dual quaternions. `dq_prod_vector`(dq, v) Apply transform represented by a dual quaternion to a vector. Compute power of unit dual quaternion with respect to scalar. `dual_quaternion_sclerp`(start, end, t) Screw linear interpolation (ScLERP) for dual quaternions.

### Plotting¶

 `plot_transform`([ax, A2B, s, ax_s, name, …]) Plot transform. `plot_screw`([ax, q, s_axis, h, theta, A2B, …]) Plot transformation about and along screw axis.

### Testing¶

 `assert_transform`(A2B, *args, **kwargs) Raise an assertion if the transform is not a homogeneous matrix. `assert_unit_dual_quaternion`(dq, *args, **kwargs) Raise an assertion if the dual quaternion does not have unit norm. `assert_unit_dual_quaternion_equal`(dq1, dq2, …) Raise an assertion if unit dual quaternions are not approximately equal. `assert_screw_parameters_equal`(q1, s_axis1, …) Raise an assertion if two sets of screw parameters are not similar.

## `pytransform3d.batch_rotations`¶

Batch operations on rotations in three dimensions - SO(3).

Conversions from this module operate on batches of orientations or rotations and can be orders of magnitude faster than a loop of individual conversions.

All functions operate on nd arrays, where the last dimension (vectors) or the last two dimensions (matrices) contain individual rotations.

 `norm_vectors`(V[, out]) Normalize vectors. Compute angle between two vectors. `active_matrices_from_angles`(basis, angles[, out]) Compute active rotation matrices from rotation about basis vectors. Compute active rotation matrices from intrinsic Euler angles. Compute active rotation matrices from extrinsic Euler angles. `matrices_from_compact_axis_angles`([A, axes, …]) Compute rotation matrices from compact axis-angle representations. `axis_angles_from_matrices`(Rs[, traces, out]) Compute compact axis-angle representations from rotation matrices. Generate the cross-product matrices of vectors. Compute rotation matrices from quaternions. `quaternions_from_matrices`(Rs[, out]) Compute quaternions from rotation matrices. `quaternion_slerp_batch`(start, end, t[, …]) Spherical linear interpolation for a batch of steps. Conjugate of quaternions. `batch_concatenate_quaternions`(Q1, Q2[, out]) Concatenate two batches of quaternions. `batch_quaternion_wxyz_from_xyzw`(Q_xyzw[, out]) Converts from x, y, z, w to w, x, y, z convention. `batch_quaternion_xyzw_from_wxyz`(Q_wxyz[, out]) Converts from w, x, y, z to x, y, z, w convention. Smooth quaternion trajectory.

## `pytransform3d.trajectories`¶

Trajectories in three dimensions - SE(3).

Conversions from this module operate on batches of poses or transformations and can be 400 to 1000 times faster than a loop of individual conversions.

 Invert transforms. `concat_one_to_many`(A2B, B2Cs) Concatenate transformation A2B with multiple transformations B2C. `concat_many_to_one`(A2Bs, B2C) Concatenate multiple transformations A2B with transformation B2C. `transforms_from_pqs`(P[, normalize_quaternions]) Get sequence of homogeneous matrices from positions and quaternions. Get sequence of positions and quaternions from homogeneous matrices. Compute exponential coordinates from transformations. Compute transformations from exponential coordinates. Get dual quaternions from positions and quaternions. Get positions and quaternions from dual quaternions. Conjugate of dual quaternions. `batch_concatenate_dual_quaternions`(dqs1, dqs2) Concatenate dual quaternions. `batch_dq_prod_vector`(dqs, V) Apply transforms represented by a dual quaternions to vectors. `plot_trajectory`([ax, P, …]) Plot pose trajectory. Switch to the other representation of the same transformation.

## `pytransform3d.coordinates`¶

Conversions between coordinate systems to represent positions.

 Convert cylindrical coordinates to Cartesian coordinates. Convert spherical coordinates to Cartesian coordinates. Convert Cartesian coordinates to cylindrical coordinates. Convert spherical coordinates to cylindrical coordinates. Convert Cartesian coordinates to spherical coordinates. Convert cylindrical coordinates to spherical coordinates.

## `pytransform3d.transform_manager`¶

Manage complex chains of transformations.

 `TransformManager`([strict_check, check]) Manage transformations between frames.

## `pytransform3d.editor`¶

Modify transformations visually.

 `TransformEditor`(transform_manager, base_frame) GUI to edit transformations.

## `pytransform3d.urdf`¶

 `UrdfTransformManager`([strict_check, check]) Transformation manager that can load URDF files. Link from URDF file. Joint from URDF file. `Geometry`(frame, mesh_path, package_dir, color) Geometrical object. `Box`(frame, mesh_path, package_dir, color) Geometrical object: box. `Sphere`(frame, mesh_path, package_dir, color) Geometrical object: sphere. `Cylinder`(frame, mesh_path, package_dir, color) Geometrical object: cylinder. `Mesh`(frame, mesh_path, package_dir, color) Geometrical object: mesh.
 `parse_urdf`(urdf_xml[, mesh_path, …]) Parse information from URDF file. Initializes transform manager from previously parsed URDF data.

## `pytransform3d.camera`¶

Transformations related to cameras.

 `make_world_grid`([n_lines, …]) Generate grid in world coordinate frame. `make_world_line`(p1, p2, n_points) Generate line in world coordinate frame. `cam2sensor`(P_cam, focal_length[, kappa]) Project points from 3D camera coordinate system to sensor plane. `sensor2img`(P_sensor, sensor_size, image_size) Project points from 2D sensor plane to image coordinate system. `world2image`(P_world, cam2world, sensor_size, …) Project points from 3D world coordinate system to 2D image. `plot_camera`([ax, M, cam2world, …]) Plot camera in world coordinates.

## `pytransform3d.plot_utils`¶

Utilities for plotting.

 `make_3d_axis`(ax_s[, pos, unit, n_ticks]) Generate new 3D axis. `remove_frame`(ax[, left, bottom, right, top]) Remove axis and scale bbox. `plot_vector`([ax, start, direction, s, …]) Plot Vector. `plot_length_variable`([ax, start, end, name, …]) Plot length with text at its center. `plot_box`([ax, size, A2B, ax_s, wireframe, …]) Plot box. `plot_sphere`([ax, radius, p, ax_s, …]) Plot sphere. `plot_cylinder`([ax, length, radius, …]) Plot cylinder. `plot_mesh`([ax, filename, A2B, s, ax_s, …]) Plot mesh. `plot_ellipsoid`([ax, radii, A2B, ax_s, …]) Plot ellipsoid. `plot_capsule`([ax, A2B, height, radius, …]) Plot capsule. `plot_cone`([ax, height, radius, A2B, ax_s, …]) Plot cone.
 `Arrow3D`(xs, ys, zs, *args, **kwargs) A Matplotlib patch that represents an arrow in 3D. `Frame`(A2B[, label, s]) A Matplotlib artist that displays a frame represented by its basis. `LabeledFrame`(A2B[, label, s]) Displays a frame represented by its basis with axis labels. `Trajectory`(H[, show_direction, n_frames, s]) A Matplotlib artist that displays a trajectory.

## `pytransform3d.visualizer`¶

Optional 3D renderer based on Open3D’s visualizer.

 `figure`([window_name, width, height, …]) Create a new figure.
 `Figure`([window_name, width, height, …]) The top level container for all the plot elements. Abstract base class for objects that can be rendered. `Line3D`(P[, c]) A line. `PointCollection3D`(P[, s, c]) Collection of points. `Vector3D`([start, direction, c]) A vector. `Frame`(A2B[, label, s]) Coordinate frame. `Trajectory`(H[, n_frames, s, c]) Trajectory of poses. `Sphere`([radius, A2B, resolution, c]) Sphere. `Box`([size, A2B, c]) Box. `Cylinder`([length, radius, A2B, resolution, …]) Cylinder. `Mesh`(filename[, A2B, s, c]) Mesh. `Ellipsoid`(radii[, A2B, resolution, c]) Ellipsoid. `Capsule`([height, radius, A2B, resolution, c]) Capsule. `Cone`([height, radius, A2B, resolution, c]) Cone. `Plane`([normal, d, point_in_plane, s, c]) Plane. `Graph`(tm, frame[, show_frames, …]) Graph of connected frames. `Camera`(M[, cam2world, …]) Camera.