IMP  2.0.1
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-2013 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 
31 /** \brief Display a sphere.
32 */
34 /** \brief Display a cylinder.
35 */
38 /** \brief Display a ellipsoid.
39 */
40 IMP_DISPLAY_GEOMETRY_DECL(EllipsoidGeometry, EllipsoidGeometries,
42 /** \brief Display a point.
43 */
46 /** \brief Display a segment.
47 */
50 /** If CGAL is available, then any simple, planar polygon can be
51  used. Otherwise, the polygons should be simple, planar and convex.
52 */
55 /** \brief Display a triangule.
56 */
59 /** \brief Display a bounding box.
60 */
61 IMP_DISPLAY_GEOMETRY_DECOMPOSABLE_DECL(BoundingBoxGeometry,
62  BoundingBoxGeometries,
64 
65 /** \brief Display a reference frame.
66 */
67 IMP_DISPLAY_GEOMETRY_DECOMPOSABLE_DECL(ReferenceFrameGeometry,
68  ReferenceFrameGeometries,
70 
71 //! A text label for a ball in space
72 /** You can use the offset if the thing being labeled has a radius.
73  */
74 class IMPDISPLAYEXPORT LabelGeometry: public Geometry {
75  algebra::Sphere3D loc_;
76  std::string text_;
77  public:
79  std::string text);
81  std::string text);
82  std::string get_text() const {return text_;}
83  const algebra::Sphere3D& get_location() const {return loc_;}
85 };
86 
87 
88 
89 //! Display a surface mesh
90 /** Faces are delimited by -1s in the list of indices.
91 */
92 class IMPDISPLAYEXPORT SurfaceMeshGeometry: public Geometry {
93  const algebra::Vector3Ds vertices_;
94  const Ints faces_;
95 protected:
96  SurfaceMeshGeometry(const std::pair<algebra::Vector3Ds, Ints >&m,
97  std::string name="SurfaceMesh %1%");
98  public:
100  const Ints &faces);
101  const algebra::Vector3Ds& get_vertexes() const {return vertices_;}
102  const Ints& get_faces() const {return faces_;}
104 };
105 
106 
107 #ifdef IMP_DISPLAY_USE_IMP_CGAL
108 //! Display a plane as truncated to a bounding box
109 /** This requires CGAL.
110  */
111 class IMPDISPLAYEXPORT PlaneGeometry: public Geometry {
112  algebra::Plane3D plane_;
114  public:
115  PlaneGeometry(const algebra::Plane3D &loc,
116  const algebra::BoundingBox3D& box);
118 };
119 
120 
121 
122 //! Display an isosurface of a density map
123 /** This requires CGAL.
124  */
126  public:
127  template <int D,
128  class Storage,
129  class Value>
131  double iso):
132  SurfaceMeshGeometry(cgal::internal::get_iso_surface(grid, iso),
133  "IsosurfaceGeometry %1%"){}
134 #ifdef SWIG
135  IsosurfaceGeometry(const algebra::GridD<3,
137  &grid,
138  double iso);
139  IsosurfaceGeometry(const algebra::GridD<3,
141  double iso);
142 #endif
143 };
144 
145 
146 //! Display an isosurface of a density map
147 /** This requires CGAL.
148  */
149 class IMPDISPLAYEXPORT SkinSurfaceGeometry: public SurfaceMeshGeometry {
150  public:
152 };
153 
154 #endif
155 
156 
157 IMPDISPLAY_END_NAMESPACE
158 
159 #endif /* IMPDISPLAY_PRIMITIVE_GEOMETRIES_H */