IMP logo
IMP Reference Guide  develop.5651aa123e,2024/07/20
The Integrative Modeling Platform
Rotation3D.h File Reference

Simple 3D rotation class. More...

#include <IMP/algebra/algebra_config.h>
#include "Vector3D.h"
#include "utility.h"
#include "constants.h"
#include "GeometricPrimitiveD.h"
#include <cereal/access.hpp>
#include <Eigen/Dense>
#include <IMP/log.h>
#include <cmath>
#include <iostream>
#include <algorithm>
+ Include dependency graph for Rotation3D.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


class  IMP::algebra::FixedXYZ
 A simple class for returning XYZ Euler angles. More...
class  IMP::algebra::Rotation3D
 3D rotation class. More...


 Base functionality and abstract base classes for representation, scoring and sampling.
 General purpose algebraic and geometric methods that are expected to be used by a wide variety of IMP modules.


typedef std::pair< Vector3D,
double > 
typedef std::pair
< Rotation3DAdjoint,
Rotation3DAdjoint > 
typedef std::pair< Vector3D,
Rotation3DAdjoint > 
typedef Vector4D IMP::algebra::Rotation3DAdjoint
typedef IMP::Vector< Rotation3D > IMP::algebra::Rotation3Ds


Rotation3D IMP::algebra::compose (const Rotation3D &a, const Rotation3D &b)
void IMP::algebra::compose_adjoint (const Rotation3D &A, const Rotation3D &B, Vector4D DC, Rotation3DAdjoint *DA, Rotation3DAdjoint *DB)
 Get adjoint of inputs to compose from adjoint of output. More...
ComposeRotation3DAdjoint IMP::algebra::compose_adjoint (const Rotation3D &A, const Rotation3D &B, const Rotation3DAdjoint &DC)
 Get adjoint of inputs to compose from adjoint of output. More...
std::pair< Vector3D, double > IMP::algebra::get_axis_and_angle (const Rotation3D &rot)
 Decompose a Rotation3D object into a rotation around an axis. More...
double IMP::algebra::get_distance (const Rotation3D &r0, const Rotation3D &r1)
 Return a distance between the two rotations. More...
Rotation3D IMP::algebra::get_identity_rotation_3d ()
 Return a rotation that does not do anything. More...
Rotation3D IMP::algebra::get_interpolated (const Rotation3D &a, const Rotation3D &b, double f)
 Interpolate between two rotations. More...
Eigen::MatrixXd IMP::algebra::get_jacobian_of_composed_wrt_first (const Rotation3D &q, const Rotation3D &p, bool wrt_unnorm=false)
 Get gradient of quaternion product with respect to first quaternion. More...
Eigen::MatrixXd IMP::algebra::get_jacobian_of_composed_wrt_second (const Rotation3D &q, const Rotation3D &p, bool wrt_unnorm=false)
 Get Jacobian of quaternion product with respect to second quaternion. More...
Rotation3D IMP::algebra::get_random_rotation_3d ()
 Pick a rotation at random from all possible rotations. More...
Rotation3D IMP::algebra::get_random_rotation_3d (const Rotation3D &center, double distance)
 Pick a rotation at random near the provided one. More...
Rotation3D IMP::algebra::get_rotation_about_axis (const Vector3D &axis, double angle)
 Generate a Rotation3D object from a rotation around an axis. More...
Rotation3D IMP::algebra::get_rotation_about_normalized_axis (const Vector3D &axis_norm, double angle)
Rotation3D IMP::algebra::get_rotation_from_matrix (double m00, double m01, double m02, double m10, double m11, double m12, double m20, double m21, double m22)
 Generate a Rotation3D object from a rotation matrix. More...
Rotation3D IMP::algebra::get_rotation_from_matrix (Eigen::Matrix3d m)
 Generate a Rotation3D object from a rotation matrix. More...
Rotation3D IMP::algebra::get_rotation_from_vector4d (const VectorD< 4 > &v)
 Compute a rotation from an unnormalized quaternion. More...
Rotation3D IMP::algebra::get_rotation_from_x_y_axes (const Vector3D &x, const Vector3D &y)
Rotation3D IMP::algebra::get_rotation_taking_first_to_second (const Vector3D &v1, const Vector3D &v2)
 Create a rotation from the first vector to the second one. More...
Rotation3Ds IMP::algebra::get_uniform_cover_rotations_3d (unsigned int num_points)
 Cover the space of rotations evenly. More...
algebra::Rotation3Ds IMP::algebra::get_uniformly_sampled_rotations (double delta)
 Generates a nondegenerate set of Euler angles with a delta resolution. More...

Euler Angles

There are many conventions for how to define Euler angles, based on choices of which of the x,y,z axis to use in what order and whether the rotation axis is in the body frame (and hence affected by previous rotations) or in in a fixed frame. See for a general description.

  • All Euler angles are specified in radians.
  • Only x-y-z order is currently supported.
  • To convert Euler angles in a different order, one can compose a Rotation3D from three rotations using get_rotation_about_axis function.
typedef IMP::Vector< FixedXYZ > IMP::algebra::FixedXYZs
Rotation3D IMP::algebra::get_rotation_from_fixed_xyz (double xr, double yr, double zr)
 Initialize a rotation in x-y-z order from three angles. More...
Rotation3D IMP::algebra::get_rotation_from_fixed_zxz (double phi, double theta, double psi)
 Initialize a rotation from Euler angles. More...
Rotation3D IMP::algebra::get_rotation_from_fixed_zyz (double Rot, double Tilt, double Psi)
 Generate a rotation object from Euler Angles. More...
FixedXYZ IMP::algebra::get_fixed_xyz_from_rotation (const Rotation3D &r)
 The inverse of rotation_from_fixed_xyz() More...

Detailed Description

Simple 3D rotation class.

Copyright 2007-2022 IMP Inventors. All rights reserved.

Definition in file Rotation3D.h.