8#ifndef IMPALGEBRA_ROTATION_2D_H
9#define IMPALGEBRA_ROTATION_2D_H
11#include <IMP/algebra/algebra_config.h>
17#include <boost/random/uniform_01.hpp>
18#include <cereal/access.hpp>
22IMPALGEBRA_BEGIN_NAMESPACE
24#if !defined(IMP_DOXYGEN) && !defined(SWIG)
26Rotation2D
compose(
const Rotation2D &a,
const Rotation2D &b);
37class Rotation2D :
public GeometricPrimitiveD<2> {
39 Rotation2D() : angle_(std::numeric_limits<double>::quiet_NaN()) {};
50 "Attempting to use uninitialized rotation");
57 "Attempting to use uninitialized rotation");
58 return Vector2D(c_ * x - s_ * y, s_ * x + c_ * y);
64 "Attempting to use uninitialized rotation");
65 return Rotation2D(-angle_);
89 friend class cereal::access;
91 template<
class Archive>
void save(Archive &ar)
const {
95 template<
class Archive>
void load(Archive &ar) {
122 double new_angle = a.get_angle() + b.get_angle();
129IMPALGEBRA_END_NAMESPACE
Base class for geometric types.
Various useful constants.
Functions to deal with very common math operations.
#define IMP_INTERNAL_CHECK(expr, message)
An assertion to check for internal errors in IMP. An IMP::ErrorException will be thrown.
Represent a rotation in 2D space.
double get_angle() const
Get the angle.
Vector2D get_rotated(const Vector2D &o) const
Rotate a 2D point.
Rotation2D(double angle)
Build the matrix for the given angle.
Rotation2D get_inverse() const
Return the matrix for the inverse rotation.
void set_angle(double angle)
Set the angle for the rotation.
Vector2D get_rotated(const double x, const double y) const
Rotate a 2D point.
Rotation2D get_identity_rotation_2d()
Build an identity rotation in 2D.
Rotation2D get_rotation_to_x_axis(const Vector2D &v)
Rotation2D compose(const Rotation2D &a, const Rotation2D &b)
Compose two rotations a and b.
Rotation2D get_random_rotation_2d()
Build an identity rotation in 2D.
IMP::Vector< Rotation2D > Rotation2Ds
bool isnan(const T &a)
Return true if a number is NaN.
RandomNumberGenerator random_number_generator
A shared non-GPU random number generator.
Random number generators used by IMP.
#define IMP_SHOWABLE_INLINE(Name, how_to_show)
Declare the methods needed by an object that can be printed.
#define IMP_VALUES(Name, PluralName)
Define the type for storing sets of values.