9#ifndef IMPALGEBRA_TRANSFORMATION_3D_H
10#define IMPALGEBRA_TRANSFORMATION_3D_H
12#include <IMP/algebra/algebra_config.h>
18#include <cereal/access.hpp>
20IMPALGEBRA_BEGIN_NAMESPACE
22#if !defined(IMP_DOXYGEN) && !defined(SWIG)
23class Transformation3D;
24Transformation3D
compose(
const Transformation3D &a,
const Transformation3D &b);
27typedef std::pair<Vector4D, Vector3D> Transformation3DAdjoint;
28typedef std::pair<Vector3D, Transformation3DAdjoint> TransformedVector3DAdjoint;
29typedef std::pair<Transformation3DAdjoint, Transformation3DAdjoint>
30 ComposeTransformation3DAdjoint;
37class IMPALGEBRAEXPORT Transformation3D :
public GeometricPrimitiveD<3> {
39 IMP_CXX11_DEFAULT_COPY_CONSTRUCTOR(Transformation3D);
44 : trans_(t), rot_(r) {}
51 return rot_.get_rotated(o) + trans_;
61 Vector3D *Dv, Transformation3DAdjoint *DT)
const;
69 TransformedVector3DAdjoint
76 Transformation3D
operator*(
const Transformation3D &tr)
const {
89 Transformation3D
operator/(
const Transformation3D &b)
const {
90 Transformation3D ret =
compose(*
this, b.get_inverse());
106 out <<
" || " << trans_;
108 Transformation3D get_inverse()
const;
115 return rot_.get_is_valid();
122 friend class cereal::access;
124 template<
class Archive>
void serialize(Archive &ar) {
157 "composing an invalid transformation");
159 a.get_transformed(b.get_translation()));
169 const Transformation3DAdjoint &DTC,
170 Transformation3DAdjoint *DTA, Transformation3DAdjoint *DTB);
177IMPALGEBRAEXPORT ComposeTransformation3DAdjoint
179 const Transformation3DAdjoint &DTC);
201 double max_translation = 5.,
202 double max_angle_in_rad = 0.26);
208 for (
unsigned int i = 0; i < 2; ++i) {
209 for (
unsigned int j = 0; j < 2; ++j) {
210 for (
unsigned int k = 0; k < 2; ++k) {
212 bb.get_corner(k)[2]);
213 nbb += tr.get_transformed(v);
221 const Transformation3D &tr) {
222 return Line3D(tr.get_rotation().get_rotated(l.
get_direction()),
226IMPALGEBRA_END_NAMESPACE
A bounding box in D dimensions.
Base class for geometric types.
Simple implementation of lines in 3D.
Simple 3D rotation class.
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
An axis-aligned bounding box.
Simple implementation of lines in 3D.
Vector3D get_point_on_line() const
Get the point on the line closest to the origin.
const Vector3D & get_direction() const
Get the unit vector in the direction of the line.
Transformation3D get_random_local_transformation(Vector3D origin, double max_translation=5., double max_angle_in_rad=0.26)
Get a local transformation.
Rotation2D compose(const Rotation2D &a, const Rotation2D &b)
Compose two rotations a and b.
Transformation3D get_identity_transformation_3d()
Return a transformation that does not do anything.
Transformation3D get_transformation_3d(const Transformation2D &t2d)
Build a 3D transformation from a 2D one.
Rotation3D get_identity_rotation_3d()
Return a rotation that does not do anything.
Transformation2D get_rotation_about_point(const Vector2D &point, const Rotation2D &rotation)
Generate a Transformation2D object from a rotation around a point.
void compose_adjoint(const Rotation3D &A, const Rotation3D &B, Vector4D DC, Rotation3DAdjoint *DA, Rotation3DAdjoint *DB)
Get adjoint of inputs to compose from adjoint of output.
IMP::Vector< Transformation3D > Transformation3Ds
#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.