IMP logo
IMP Reference Guide  2.11.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-2019 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 class Reflection3D : public GeometricPrimitiveD<3> {
19  Plane3D pl_;
20 
21  public:
22  Reflection3D() {}
23  Reflection3D(Plane3D pl) : pl_(pl) {}
24 
25  Vector3D get_reflected(const Vector3D &v) const {
26  Vector3D p = pl_.get_projected(v);
27  return v + 2 * (p - v);
28  }
29  IMP_SHOWABLE_INLINE(Transformation3D, { out << pl_; });
30 };
31 
33 
34 IMPALGEBRA_END_NAMESPACE
35 
36 #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:68
A more IMP-like version of the std::vector.
Definition: Vector.h:39
#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:18
Simple 3D plane class.
VectorD< 3 > Vector3D
Definition: VectorD.h:395
Represent a plane in 3D.
Definition: Plane3D.h:20