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>
22 IMPALGEBRA_BEGIN_NAMESPACE
24 #if !defined(IMP_DOXYGEN) && !defined(SWIG)
26 Rotation2D
compose(
const Rotation2D &a,
const Rotation2D &b);
39 Rotation2D() : angle_(std::numeric_limits<double>::quiet_NaN()) {};
50 "Attempting to use uninitialized rotation");
51 return get_rotated(o[0], o[1]);
57 "Attempting to use uninitialized rotation");
58 return Vector2D(c_ * x - s_ * y, s_ * x + c_ * y);
64 "Attempting to use uninitialized rotation");
89 friend class cereal::access;
91 template<
class Archive>
void save(Archive &ar)
const {
95 template<
class Archive>
void load(Archive &ar) {
129 IMPALGEBRA_END_NAMESPACE
Rotation2D get_inverse() const
Return the matrix for the inverse rotation.
Base class for geometric types.
#define IMP_SHOWABLE_INLINE(Name, how_to_show)
Declare the methods needed by an object that can be printed.
Represent a rotation in 2D space.
Rotation2D compose(const Rotation2D &a, const Rotation2D &b)
Compose two rotations a and b.
static const double PI
the constant pi
A more IMP-like version of the std::vector.
#define IMP_INTERNAL_CHECK(expr, message)
An assertion to check for internal errors in IMP. An IMP::ErrorException will be thrown.
#define IMP_VALUES(Name, PluralName)
Define the type for storing sets of values.
Base class for geometric types.
Functions to deal with very common math operations.
Rotation2D get_identity_rotation_2d()
Build an identity rotation in 2D.
Vector2D get_rotated(const Vector2D &o) const
Rotate a 2D point.
Rotation2D get_rotation_to_x_axis(const Vector2D &v)
Various useful constants.
bool isnan(const T &a)
Return true if a number is NaN.
double get_angle() const
Get the angle.
void set_angle(double angle)
Set the angle for the rotation.
Random number generators used by IMP.
Rotation2D(double angle)
Build the matrix for the given angle.
RandomNumberGenerator random_number_generator
A shared non-GPU random number generator.
Vector2D get_rotated(const double x, const double y) const
Rotate a 2D point.
Rotation2D get_random_rotation_2d()
Build an identity rotation in 2D.