IMP  2.2.1
The Integrative Modeling Platform
SpherePatch3D.h
Go to the documentation of this file.
1 /**
2  * \file IMP/algebra/SpherePatch3D.h \brief Simple 3D sphere patch class.
3  *
4  * Copyright 2007-2014 IMP Inventors. All rights reserved.
5  *
6  */
7 
8 #ifndef IMPALGEBRA_SPHERE_PATCH_3D_H
9 #define IMPALGEBRA_SPHERE_PATCH_3D_H
10 
11 #include "Sphere3D.h"
12 #include "Plane3D.h"
13 #include "GeometricPrimitiveD.h"
14 
15 IMPALGEBRA_BEGIN_NAMESPACE
16 
17 /**
18 A patch of a sphere is defined as all points above the plane and on the sphere.
19  */
20 class IMPALGEBRAEXPORT SpherePatch3D : public GeometricPrimitiveD<3> {
21  public:
22  SpherePatch3D() {}
23  //! Constructor
24  /**
25  /param[in] sph the sphere to cut a patch from
26  /param[in] crossing_plane the plane that crosses the sphere
27  */
28  SpherePatch3D(const Sphere3D &sph, const Plane3D &crossing_plane);
29  //! Return true if the point is contained in the patch
30  /** Note that the point must be on the sphere (this is not necessarily
31  checked).
32  */
33  bool get_contains(const Vector3D &p) const;
34  Plane3D get_plane() const { return crossing_plane_; }
35  Sphere3D get_sphere() const { return Sphere3D(sph_); }
37  sph_.show(out);
38  crossing_plane_.show(out);
39  });
40  //! Get a point which is on the boundary of the patch
41  Vector3D get_boundary_point() const;
42 
43  private:
44  Sphere3D sph_;
45  Plane3D crossing_plane_;
46 };
47 
50  , { return get_bounding_box(g.get_sphere()); });
51 
52 IMPALGEBRA_END_NAMESPACE
53 
54 #endif /* IMPALGEBRA_SPHERE_PATCH_3D_H */
Basic types used by IMP.
SphereD< 3 > Sphere3D
Definition: SphereD.h:89
#define IMP_NOT_IMPLEMENTED
Use this to make that the method is not implemented yet.
#define IMP_UNUSED(variable)
#define IMP_SHOWABLE_INLINE(Name, how_to_show)
Declare the methods needed by an object that can be printed.
BoundingBoxD< 3 > get_bounding_box(const SpherePatch3D &g)
Definition: SpherePatch3D.h:50
#define IMP_AREA_GEOMETRY_METHODS(Name, name, area, bounding_box)
implement the needed namespace methods for a geometry type
Simple 3D plane class.
VectorD< 3 > Vector3D
Definition: VectorD.h:395
Simple 3D sphere class.