IMP logo
IMP Reference Guide  2.6.1
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-2016 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 
15 IMPALGEBRA_BEGIN_NAMESPACE
16 
17 //! Reflect about a plane in 3D
18 /**
19 */
20 class Reflection3D : public GeometricPrimitiveD<3> {
21  Plane3D pl_;
22 
23  public:
24  Reflection3D() {}
25  Reflection3D(Plane3D pl) : pl_(pl) {}
26 
27  Vector3D get_reflected(const Vector3D &v) const {
28  Vector3D p = pl_.get_projected(v);
29  return v + 2 * (p - v);
30  }
31  IMP_SHOWABLE_INLINE(Transformation3D, { out << pl_; });
32 };
33 
35 
36 IMPALGEBRA_END_NAMESPACE
37 
38 #endif /* IMPALGEBRA_REFLECTION_3D_H */
Basic types used by IMP.
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:68
#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:20
Simple 3D plane class.
VectorD< 3 > Vector3D
Definition: VectorD.h:395
Represent a plane in 3D.
Definition: Plane3D.h:20