IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
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-2026 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"
14#include <cereal/access.hpp>
15
16IMPALGEBRA_BEGIN_NAMESPACE
17
18//! A sphere patch is defined as all points above the plane and on the sphere.
19class 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_); }
35 IMP_SHOWABLE_INLINE(SpherePatch3D, {
36 sph_.show(out);
37 crossing_plane_.show(out);
38 });
39 //! Get a point which is on the boundary of the patch
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
53IMP_AREA_GEOMETRY_METHODS(SpherePatch3D, sphere_patch_3d, IMP_UNUSED(g);
55 , { return get_bounding_box(g.get_sphere()); });
56
57IMPALGEBRA_END_NAMESPACE
58
59#endif /* IMPALGEBRA_SPHERE_PATCH_3D_H */
Base class for geometric types.
Simple 3D plane class.
Simple 3D sphere class.
#define IMP_NOT_IMPLEMENTED
Use this to mark that the method is not implemented yet.
Represent a plane in 3D.
Definition Plane3D.h:21
Vector3D get_boundary_point() const
Get a point which is on the boundary of the patch.
bool get_contains(const Vector3D &p) const
Return true if the point is contained in the patch.
SpherePatch3D(const Sphere3D &sph, const Plane3D &crossing_plane)
Constructor.
#define IMP_AREA_GEOMETRY_METHODS(Name, name, area, bounding_box)
Implement the needed namespace methods for a geometry type.
SphereD< 3 > Sphere3D
Typedef for Python.
Definition SphereD.h:103
VectorD< 3 > Vector3D
Definition VectorD.h:407
#define IMP_SHOWABLE_INLINE(Name, how_to_show)
Declare the methods needed by an object that can be printed.
#define IMP_UNUSED(variable)