IMP logo
IMP Reference Guide  develop.d97d4ead1f,2024/11/21
The Integrative Modeling Platform
Reflection3D.h
Go to the documentation of this file.
1 /**
2  * \file IMP/algebra/Reflection3D.h \brief Reflect about a plane in 3D.
3  *
4  * Copyright 2007-2022 IMP Inventors. All rights reserved.
5  *
6  */
7 
8 #ifndef IMPALGEBRA_REFLECTION_3D_H
9 #define IMPALGEBRA_REFLECTION_3D_H
10 
11 #include <IMP/algebra/algebra_config.h>
12 #include "Plane3D.h"
13 #include "GeometricPrimitiveD.h"
14 #include <cereal/access.hpp>
15 
16 IMPALGEBRA_BEGIN_NAMESPACE
17 
18 //! Reflect about a plane in 3D
19 class Reflection3D : public GeometricPrimitiveD<3> {
20  Plane3D pl_;
21 
22  friend class cereal::access;
23 
24  template<class Archive> void serialize(Archive &ar) {
25  ar(pl_);
26  }
27 
28  public:
29  Reflection3D() {}
30  Reflection3D(Plane3D pl) : pl_(pl) {}
31 
32  Vector3D get_reflected(const Vector3D &v) const {
33  Vector3D p = pl_.get_projected(v);
34  return v + 2 * (p - v);
35  }
36  IMP_SHOWABLE_INLINE(Transformation3D, { out << pl_; });
37 };
38 
40 
41 IMPALGEBRA_END_NAMESPACE
42 
43 #endif /* IMPALGEBRA_REFLECTION_3D_H */
Base class for geometric types.
Simple 3D transformation class.
#define IMP_SHOWABLE_INLINE(Name, how_to_show)
Declare the methods needed by an object that can be printed.
Vector3D get_reflected(const Plane3D &pln, const Vector3D &p)
Return the point reflected about the plane.
Definition: Plane3D.h:76
A more IMP-like version of the std::vector.
Definition: Vector.h:50
#define IMP_VALUES(Name, PluralName)
Define the type for storing sets of values.
Definition: value_macros.h:23
Base class for geometric types.
Reflect about a plane in 3D.
Definition: Reflection3D.h:19
Simple 3D plane class.
VectorD< 3 > Vector3D
Definition: VectorD.h:408
Represent a plane in 3D.
Definition: Plane3D.h:21