IMP  2.0.0
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-2013 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  private:
43  Sphere3D sph_;
44  Plane3D crossing_plane_;
45 };
46 
49  {
50  return get_bounding_box(g.get_sphere());
51  });
52 
53 
54 IMPALGEBRA_END_NAMESPACE
55 
56 #endif /* IMPALGEBRA_SPHERE_PATCH_3D_H */