IMP logo
IMP Reference Guide  2.10.0
The Integrative Modeling Platform
primitive_geometries.h
Go to the documentation of this file.
1 /**
2  * \file IMP/display/primitive_geometries.h
3  * \brief Implement geometry for the basic shapes from IMP.algebra.
4  *
5  * Copyright 2007-2018 IMP Inventors. All rights reserved.
6  */
7 
8 #ifndef IMPDISPLAY_PRIMITIVE_GEOMETRIES_H
9 #define IMPDISPLAY_PRIMITIVE_GEOMETRIES_H
10 
11 #include <IMP/display/display_config.h>
12 #include "declare_Geometry.h"
13 #include "geometry_macros.h"
14 #include <IMP/algebra/Vector3D.h>
15 #include <IMP/algebra/Sphere3D.h>
16 #include <IMP/algebra/Segment3D.h>
17 #include <IMP/algebra/Cylinder3D.h>
20 #include <IMP/algebra/Plane3D.h>
22 #include <IMP/algebra/Triangle3D.h>
24 #ifdef IMP_DISPLAY_USE_IMP_CGAL
25 #include <IMP/cgal/internal/polyhedrons.h>
26 #endif
27 
28 IMPDISPLAY_BEGIN_NAMESPACE
29 
30 /** \brief Display a sphere.
31 */
33 /** \brief Display a cylinder.
34 */
37 /** \brief Display a ellipsoid.
38 */
39 IMP_DISPLAY_GEOMETRY_DECL(EllipsoidGeometry, EllipsoidGeometries,
41 /** \brief Display a point.
42 */
44 /** \brief Display a segment.
45 */
48 /** If CGAL is available, then any simple, planar polygon can be
49  used. Otherwise, the polygons should be simple, planar and convex.
50 */
53 /** \brief Display a triangle.
54 */
57 /** \brief Display a bounding box.
58 */
59 IMP_DISPLAY_GEOMETRY_DECOMPOSABLE_DECL(
61 
62 /** \brief Display a reference frame.
63 */
64 IMP_DISPLAY_GEOMETRY_DECOMPOSABLE_DECL(ReferenceFrameGeometry,
65  ReferenceFrameGeometries,
67 
68 //! A text label for a ball in space
69 /** You can use the offset if the thing being labeled has a radius.
70  */
71 class IMPDISPLAYEXPORT LabelGeometry : public Geometry {
72  algebra::Sphere3D loc_;
73  std::string text_;
74 
75  public:
76  LabelGeometry(const algebra::Sphere3D &loc, std::string text);
77  LabelGeometry(const algebra::Vector3D &loc, std::string text);
78  std::string get_text() const { return text_; }
79  const algebra::Sphere3D &get_location() const { return loc_; }
82 };
83 
84 //! Display a surface mesh
85 /** Faces are delimited by -1s in the list of indices.
86 */
87 class IMPDISPLAYEXPORT SurfaceMeshGeometry : public Geometry {
88  const algebra::Vector3Ds vertices_;
89  const Ints faces_;
90 
91  protected:
92  SurfaceMeshGeometry(const std::pair<algebra::Vector3Ds, Ints> &m,
93  std::string name = "SurfaceMesh %1%");
94 
95  public:
96  SurfaceMeshGeometry(const algebra::Vector3Ds &vertices, const Ints &faces);
97  const algebra::Vector3Ds &get_vertexes() const { return vertices_; }
98  const Ints &get_faces() const { return faces_; }
101 };
102 
103 #ifdef IMP_DISPLAY_USE_IMP_CGAL
104 //! Display a plane as truncated to a bounding box
105 /** This requires CGAL.
106  */
107 class IMPDISPLAYEXPORT PlaneGeometry : public Geometry {
108  algebra::Plane3D plane_;
110 
111  public:
112  PlaneGeometry(const algebra::Plane3D &loc, const algebra::BoundingBox3D &box);
115 };
116 
117 //! Display an isosurface of a density map
118 /** This requires CGAL.
119  */
121  public:
122  template <int D, class Storage, class Value>
124  : SurfaceMeshGeometry(cgal::internal::get_iso_surface(grid, iso),
125  "IsosurfaceGeometry %1%") {}
126 #ifdef SWIG
127  IsosurfaceGeometry(
129  grid,
130  double iso);
131  IsosurfaceGeometry(const algebra::GridD<
132  3, algebra::DenseGridStorageD<3, float>, float> &grid,
133  double iso);
134 #endif
135 };
136 
137 //! Display an isosurface of a density map
138 /** This requires CGAL.
139  */
140 class IMPDISPLAYEXPORT SkinSurfaceGeometry : public SurfaceMeshGeometry {
141  public:
143 };
144 
145 #endif
146 
147 IMPDISPLAY_END_NAMESPACE
148 
149 #endif /* IMPDISPLAY_PRIMITIVE_GEOMETRIES_H */
#define IMP_DISPLAY_GEOMETRY_DECL(Name, Names, Type)
Define a geometric object using an IMP::algebra one.
Represent an ellipsoid in 3D.
Definition: Ellipsoid3D.h:22
Represent a cylinder in 3D.
The base class for geometry.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
A voxel grid in d-dimensional space.
Definition: GridD.h:79
macros for display classes
Represent a cylinder in 3D.
Definition: Cylinder3D.h:26
Represent a triangle in 3D.
Definition: Triangle3D.h:23
Implement geometry for the basic shapes from IMP.algebra.
Simple 3D ellipsoid class.
A reference frame in 3D.
Simple implementation of segments in 3D.
A bounding box in D dimensions.
Represent a triangle in 3D.
Simple implementation of segments in 3D.
Definition: Segment3D.h:24
Simple 3D plane class.
virtual Geometries get_components() const
Return a set of geometry composing this one.
Display a plane as truncated to a bounding box.
VectorD< 3 > Vector3D
Definition: VectorD.h:395
Simple 3D vector class.
All grids that are in the Python API should be defined here.
A reference frame in 3D.
Display an isosurface of a density map.
Represent a plane in 3D.
Definition: Plane3D.h:20
Simple 3D sphere class.
Display an isosurface of a density map.
#define IMP_OVERRIDE
Cause a compile error if this method does not override a parent method.
A text label for a ball in space.