8 #ifndef IMPALGEBRA_ROTATION_2D_H
9 #define IMPALGEBRA_ROTATION_2D_H
11 #include <IMP/algebra/algebra_config.h>
19 IMPALGEBRA_BEGIN_NAMESPACE
21 #if !defined(IMP_DOXYGEN) && !defined(SWIG)
23 Rotation2D
compose(
const Rotation2D &a,
const Rotation2D &b);
36 Rotation2D() : angle_(std::numeric_limits<double>::quiet_NaN()) {};
47 "Attempting to use uninitialized rotation");
48 return get_rotated(o[0], o[1]);
54 "Attempting to use uninitialized rotation");
55 return Vector2D(c_ * x - s_ * y, s_ * x + c_ * y);
61 "Attempting to use uninitialized rotation");
92 return Rotation2D(2 *
PI * ((
double)rand() / ((
double)RAND_MAX + 1)));
113 IMPALGEBRA_END_NAMESPACE
Rotation2D get_inverse() const
Returns the matrix for the inverse rotation.
Stores a 2D rotation matrix.
Rotation2D compose(const Rotation2D &a, const Rotation2D &b)
compose two rotations a and b
static const double PI
the constant pi
#define IMP_VALUES(Name, PluralName)
Define the type for storing sets of values.
#define IMP_SHOWABLE_INLINE(Name, how_to_show)
Declare the methods needed by an object that can be printed.
Functions to deal with very common math operations.
Rotation2D get_identity_rotation_2d()
Builds an identity rotation in 2D.
#define IMP_INTERNAL_CHECK(expr, message)
An assertion to check for internal errors in IMP. An IMP::ErrorException will be thrown.
Vector2D get_rotated(const Vector2D &o) const
rotates a 2D point
Rotation2D get_rotation_to_x_axis(const Vector2D &v)
Various useful constants.
double get_angle() const
gets the angle
void set_angle(double angle)
sets the angle for the rotation
bool isnan(const T &a)
Return true if a number is NaN.
Rotation2D(double angle)
Builds the matrix for the given angle.
Vector2D get_rotated(const double x, const double y) const
rotates a 2D point
Rotation2D get_random_rotation_2d()
Builds an identity rotation in 2D.