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 <boost/serialization/access.hpp>
19 #include <boost/serialization/split_member.hpp>
23 IMPALGEBRA_BEGIN_NAMESPACE
25 #if !defined(IMP_DOXYGEN) && !defined(SWIG)
27 Rotation2D
compose(
const Rotation2D &a,
const Rotation2D &b);
40 Rotation2D() : angle_(std::numeric_limits<double>::quiet_NaN()) {};
51 "Attempting to use uninitialized rotation");
52 return get_rotated(o[0], o[1]);
58 "Attempting to use uninitialized rotation");
59 return Vector2D(c_ * x - s_ * y, s_ * x + c_ * y);
65 "Attempting to use uninitialized rotation");
91 friend class boost::serialization::access;
93 template<
class Archive>
void save(Archive &ar,
const unsigned int)
const {
97 template<
class Archive>
void load(Archive &ar,
const unsigned int) {
103 BOOST_SERIALIZATION_SPLIT_MEMBER()
134 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.