scitbx::math::r3_rotation Namespace Reference

Algorithms for R3 (i.e. 3-dimensional space) rotation matrices. More...


Classes

struct  axis_and_angle_from_matrix
 Numerically robust computation of rotation axis and angle. More...

Functions

template<typename FloatType>
mat3< FloatType > axis_and_angle_as_matrix (vec3< FloatType > const &axis, FloatType angle, bool deg=false, FloatType const &min_axis_length=1.e-15)
 Conversion of axis and angle to a rotation matrix.
template<typename FloatType>
af::tiny< FloatType, 4 > quaternion_product (af::tiny< FloatType, 4 > const &a, af::tiny< FloatType, 4 > const &b)
 Quaternion product.
template<typename FloatType>
af::tiny< FloatType, 4 > normalized_axis_and_angle_rad_as_unit_quaternion (const FloatType *axis, FloatType const &angle)
 Conversion without validation of inputs.
template<typename FloatType>
af::tiny< FloatType, 4 > axis_and_angle_as_unit_quaternion (vec3< FloatType > const &axis, FloatType angle, bool deg=false, FloatType const &min_axis_length=1.e-15)
 Conversion with validation of inputs.
template<typename FloatType>
mat3< FloatType > vector_to_vector (vec3< FloatType > const &given_unit_vector, vec3< FloatType > const &target_unit_vector, FloatType const &sin_angle_is_zero_threshold=1.e-10)
 Returns rotation matrix mapping given_unit_vector onto target_unit_vector.
template<typename FloatType>
mat3< FloatType > vector_to_001 (vec3< FloatType > const &given_unit_vector, FloatType const &sin_angle_is_zero_threshold=1.e-10)
 Returns rotation matrix mapping given_unit_vector onto (0,0,1).
template<typename FloatType>
mat3< FloatType > vector_to_010 (vec3< FloatType > const &given_unit_vector, FloatType const &sin_angle_is_zero_threshold=1.e-10)
 Returns rotation matrix mapping given_unit_vector onto (0,1,0).
template<typename FloatType>
mat3< FloatType > vector_to_100 (vec3< FloatType > const &given_unit_vector, FloatType const &sin_angle_is_zero_threshold=1.e-10)
 Returns rotation matrix mapping given_unit_vector onto (1,0,0).
template<typename FloatType>
mat3< FloatType > unit_quaternion_as_matrix (FloatType const &q0, FloatType const &q1, FloatType const &q2, FloatType const &q3)
 Unit quaternion (a.k.a. Euler parameters) as matrix.
template<typename FloatType>
mat3< FloatType > unit_quaternion_as_matrix (af::tiny< FloatType, 4 > const &q)
template<typename FloatType>
af::tiny< FloatType, 4 > matrix_as_unit_quaternion (mat3< FloatType > const &r)
 Matrix as unit quaternion (a.k.a. Euler parameters).
template<typename FloatType>
scitbx::mat3< FloatType > random_matrix_arvo_1992 (FloatType const &x0, FloatType const &x1, FloatType const &x2)
 Uniformly distributed random 3D rotation matrix using Arvo's method.


Detailed Description

Algorithms for R3 (i.e. 3-dimensional space) rotation matrices.

Function Documentation

mat3<FloatType> scitbx::math::r3_rotation::axis_and_angle_as_matrix ( vec3< FloatType > const &  axis,
FloatType  angle,
bool  deg = false,
FloatType const &  min_axis_length = 1.e-15 
) [inline]

Conversion of axis and angle to a rotation matrix.

http://skal.planet-d.net/demo/matrixfaq.htm

References SCITBX_ASSERT.

Referenced by axis_and_angle_from_matrix::as_matrix().

af::tiny<FloatType, 4> scitbx::math::r3_rotation::matrix_as_unit_quaternion ( mat3< FloatType > const &  r  )  [inline]

Matrix as unit quaternion (a.k.a. Euler parameters).

The matrix elements must satisfy the orthogonality condition r.transpose()*r = identity but this is not thoroughly checked.

Based on work by: Shepperd (1978), J. Guidance and Control, 1, 223-224. Sam Buss, http://math.ucsd.edu/~sbuss/MathCG Robert Hanson, jmol/Jmol/src/org/jmol/util/Quaternion.java

Also implemented in Python: scitbx/matrix/__init__.py

scitbx::mat3<FloatType> scitbx::math::r3_rotation::random_matrix_arvo_1992 ( FloatType const &  x0,
FloatType const &  x1,
FloatType const &  x2 
) [inline]

Uniformly distributed random 3D rotation matrix using Arvo's method.

"Fast Random Rotation Matrices", by James Arvo. In Graphics Gems III, 1992. http://www.ics.uci.edu/~arvo/papers/RotationMat.ps http://www.ics.uci.edu/~arvo/code/rotate.c (2011-06-22)

Referenced by mersenne_twister::random_double_r3_rotation_matrix_arvo_1992().

mat3<FloatType> scitbx::math::r3_rotation::unit_quaternion_as_matrix ( FloatType const &  q0,
FloatType const &  q1,
FloatType const &  q2,
FloatType const &  q3 
) [inline]

Unit quaternion (a.k.a. Euler parameters) as matrix.

The unit quaternion elements must satisfy the normalization condition q0**2+q1**2+q2**2+q3**3 = 1 but this is not checked.

Also implemented in Python: scitbx/matrix/__init__.py

Referenced by mersenne_twister::random_double_r3_rotation_matrix().

mat3<FloatType> scitbx::math::r3_rotation::vector_to_001 ( vec3< FloatType > const &  given_unit_vector,
FloatType const &  sin_angle_is_zero_threshold = 1.e-10 
) [inline]

Returns rotation matrix mapping given_unit_vector onto (0,0,1).

It is not checked if the input vector is a unit vector. The result is meaningless if this is not true.

The implementation is a simplification of vector_to_vector().

mat3<FloatType> scitbx::math::r3_rotation::vector_to_010 ( vec3< FloatType > const &  given_unit_vector,
FloatType const &  sin_angle_is_zero_threshold = 1.e-10 
) [inline]

Returns rotation matrix mapping given_unit_vector onto (0,1,0).

It is not checked if the input vector is a unit vector. The result is meaningless if this is not true.

The implementation is a simplification of vector_to_vector().

mat3<FloatType> scitbx::math::r3_rotation::vector_to_100 ( vec3< FloatType > const &  given_unit_vector,
FloatType const &  sin_angle_is_zero_threshold = 1.e-10 
) [inline]

Returns rotation matrix mapping given_unit_vector onto (1,0,0).

It is not checked if the input vector is a unit vector. The result is meaningless if this is not true.

The implementation is a simplification of vector_to_vector().

mat3<FloatType> scitbx::math::r3_rotation::vector_to_vector ( vec3< FloatType > const &  given_unit_vector,
vec3< FloatType > const &  target_unit_vector,
FloatType const &  sin_angle_is_zero_threshold = 1.e-10 
) [inline]

Returns rotation matrix mapping given_unit_vector onto target_unit_vector.

It is not checked if the input vectors are unit vectors. The result is meaningless if this is not true.

See also: axis_and_angle_as_matrix()

References vec3::cross(), vec3::length(), and vec3::ortho().


Generated on Thu Jun 19 15:35:08 2014 for cctbx by  doxygen 1.5.6