IMP logo
IMP Reference Guide  develop.d97d4ead1f,2024/11/21
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-2022 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 #include <cereal/access.hpp>
15 
16 IMPALGEBRA_BEGIN_NAMESPACE
17 
18 //! A sphere patch is defined as all points above the plane and on the sphere.
19 class IMPALGEBRAEXPORT SpherePatch3D : public GeometricPrimitiveD<3> {
20  public:
21  SpherePatch3D() {}
22  //! Constructor
23  /**
24  \param[in] sph the sphere to cut a patch from
25  \param[in] crossing_plane the plane that crosses the sphere
26  */
27  SpherePatch3D(const Sphere3D &sph, const Plane3D &crossing_plane);
28  //! Return true if the point is contained in the patch
29  /** Note that the point must be on the sphere (this is not necessarily
30  checked).
31  */
32  bool get_contains(const Vector3D &p) const;
33  Plane3D get_plane() const { return crossing_plane_; }
34  Sphere3D get_sphere() const { return Sphere3D(sph_); }
36  sph_.show(out);
37  crossing_plane_.show(out);
38  });
39  //! Get a point which is on the boundary of the patch
40  Vector3D get_boundary_point() const;
41 
42  private:
43  Sphere3D sph_;
44  Plane3D crossing_plane_;
45 
46  friend class cereal::access;
47 
48  template<class Archive> void serialize(Archive &ar) {
49  ar(sph_, crossing_plane_);
50  }
51 };
52 
55  , { return get_bounding_box(g.get_sphere()); });
56 
57 IMPALGEBRA_END_NAMESPACE
58 
59 #endif /* IMPALGEBRA_SPHERE_PATCH_3D_H */
Base class for geometric types.
SphereD< 3 > Sphere3D
Typedef for Python.
Definition: SphereD.h:104
#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:71
A sphere patch is defined as all points above the plane and on the sphere.
Definition: SpherePatch3D.h:19
Simple 3D plane class.
VectorD< 3 > Vector3D
Definition: VectorD.h:408
#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:21
Simple 3D sphere class.