IMP logo
IMP Reference Guide  2.9.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-2018 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 //! A sphere patch is defined as all points above the plane and on the sphere.
18 class IMPALGEBRAEXPORT SpherePatch3D : public GeometricPrimitiveD<3> {
19  public:
20  SpherePatch3D() {}
21  //! Constructor
22  /**
23  \param[in] sph the sphere to cut a patch from
24  \param[in] crossing_plane the plane that crosses the sphere
25  */
26  SpherePatch3D(const Sphere3D &sph, const Plane3D &crossing_plane);
27  //! Return true if the point is contained in the patch
28  /** Note that the point must be on the sphere (this is not necessarily
29  checked).
30  */
31  bool get_contains(const Vector3D &p) const;
32  Plane3D get_plane() const { return crossing_plane_; }
33  Sphere3D get_sphere() const { return Sphere3D(sph_); }
35  sph_.show(out);
36  crossing_plane_.show(out);
37  });
38  //! Get a point which is on the boundary of the patch
39  Vector3D get_boundary_point() const;
40 
41  private:
42  Sphere3D sph_;
43  Plane3D crossing_plane_;
44 };
45 
48  , { return get_bounding_box(g.get_sphere()); });
49 
50 IMPALGEBRA_END_NAMESPACE
51 
52 #endif /* IMPALGEBRA_SPHERE_PATCH_3D_H */
Base class for geometric types.
SphereD< 3 > Sphere3D
Typedef for Python.
Definition: SphereD.h:88
#define IMP_SHOWABLE_INLINE(Name, how_to_show)
Declare the methods needed by an object that can be printed.
#define IMP_AREA_GEOMETRY_METHODS(Name, name, area, bounding_box)
Implement the needed namespace methods for a geometry type.
Base class for geometric types.
#define IMP_UNUSED(variable)
BoundingBoxD< 3 > get_bounding_box(const Cone3D &g)
Definition: Cone3D.h:64
A sphere patch is defined as all points above the plane and on the sphere.
Definition: SpherePatch3D.h:18
Simple 3D plane class.
VectorD< 3 > Vector3D
Definition: VectorD.h:395
#define IMP_NOT_IMPLEMENTED
Use this to mark that the method is not implemented yet.
Definition: check_macros.h:81
Represent a plane in 3D.
Definition: Plane3D.h:20
Simple 3D sphere class.