Bayeux  3.4.1
Core Foundation library for SuperNEMO
bounding_data.h
Go to the documentation of this file.
1 /* \file geomtools/bounding_data.h
2  * Author(s): Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date: 2014-11-16
4  * Last modified: 2014-11-16
5  *
6  * License:
7  *
8  * Description:
9  *
10  * Bounding data information for 3D shaped datas
11  *
12  * History:
13  *
14  */
15 
16 #ifndef GEOMTOOLS_BOUNDING_DATA_H
17 #define GEOMTOOLS_BOUNDING_DATA_H 1
18 
19 // Standard library:
20 #include <vector>
21 
22 // Third party:
23 // - Bayeux/datatools:
24 #include <datatools/i_tree_dump.h>
25 
26 // This project:
27 #include <geomtools/utils.h>
29 
30 namespace datatools {
31  class properties;
32 }
33 
34 namespace geomtools {
35 
36  // Forward declaration:
37  class box;
38  class placement;
39 
41  class bounding_data :
42  public i_wires_3d_rendering,
44  {
45  public:
46 
48  enum bb_type {
49  BD_INVALID = 0,
50  BD_BOX = 1,
52  };
53 
55  bool is_valid(bool verbose_ = false) const;
56 
58  bounding_data();
59 
61  virtual ~bounding_data();
62 
64  void make_box(double xmin_, double xmax_,
65  double ymin_, double ymax_,
66  double zmin_, double zmax_);
67 
69  void make_cylinder(double rmax_, double zmin_, double zmax_);
70 
72  void reset();
73 
75  bool is_box() const;
76 
78  bool is_cylinder() const;
79 
81  double get_xmin() const;
82 
84  double get_xmax() const;
85 
87  double get_ymin() const;
88 
90  double get_ymax() const;
91 
93  double get_zmin() const;
94 
96  double get_zmax() const;
97 
99  double get_rmax() const;
100 
102  double get_min_dimension() const;
103 
105  void compute_bounding_box(box & bb_, placement & p_, double safe_skin_ = 0.0) const;
106 
108  void compute_bounding_box_vertexes(std::vector<vector_3d> &, double safe_skin_ = 0.0) const;
109 
111  void compute_bounding_box_face_centers(std::vector<vector_3d> &, double safe_skin_ = 0.0) const;
112 
114  void make_box_from_points(const std::vector<vector_3d> & points_);
115 
117  void build_stackable(stackable_data & stackable_info_) const;
118 
120  virtual void tree_dump(std::ostream & a_out = std::clog,
121  const std::string & a_title = "",
122  const std::string & a_indent = "",
123  bool a_inherit = false) const;
124 
126  void parse_bounding_data(const datatools::properties & config_);
127 
129  void generate_wires_self(wires_type & wires_, uint32_t options_ = 0) const;
130 
131  private:
132 
133  bb_type _type_;
134  double _xmin_;
135  double _xmax_;
136  double _ymin_;
137  double _ymax_;
138  double _zmin_;
139  double _zmax_;
140  double _rmax_;
141 
142  };
143 
144 } // end of namespace geomtools
145 
146 #endif // GEOMTOOLS_BOUNDING_DATA_H
147 
148 /*
149 ** Local Variables: --
150 ** mode: c++ --
151 ** c-file-style: "gnu" --
152 ** tab-width: 2 --
153 ** End: --
154 */
bool is_valid(bool verbose_=false) const
Check validity.
double get_xmax() const
Return the maximum X.
double get_ymax() const
Return the maximum Y.
void generate_wires_self(wires_type &wires_, uint32_t options_=0) const
Generate wires associated to the bounding volume.
Invalid type.
Definition: bounding_data.h:49
An interface with utilities for printable objects.
Definition: i_tree_dump.h:36
The 3D shape model for a box.
Definition: box.h:44
virtual ~bounding_data()
Destructor.
double get_ymin() const
Return the minimum Y.
double get_xmin() const
Return the minimum X.
double get_rmax() const
Return the maximum R.
bool is_cylinder() const
Check cylinder type.
bool is_box() const
Check box type.
void build_stackable(stackable_data &stackable_info_) const
Build a stackable daat object.
void make_cylinder(double rmax_, double zmin_, double zmax_)
Make a bounding cylinder.
virtual void tree_dump(std::ostream &a_out=std::clog, const std::string &a_title="", const std::string &a_indent="", bool a_inherit=false) const
Smart print.
Bounding box.
Definition: bounding_data.h:50
double get_min_dimension() const
Return the minimum dimension.
double get_zmax() const
Return the maximum Z.
void compute_bounding_box_face_centers(std::vector< vector_3d > &, double safe_skin_=0.0) const
Compute the face centers of the bounding box in the solid reference frame.
void compute_bounding_box_vertexes(std::vector< vector_3d > &, double safe_skin_=0.0) const
Compute the vertexes (corners) of the bounding box in the solid reference frame.
double get_zmin() const
Return the minimum Z.
void compute_bounding_box(box &bb_, placement &p_, double safe_skin_=0.0) const
Compute a bounding box and its placement in the solid reference frame.
brief Abstract interface for objects that can describe themselves as a collection of polylines for 3D...
Definition: i_wires_3d_rendering.h:39
void make_box_from_points(const std::vector< vector_3d > &points_)
Build a bounding data from a collection of points.
bounding_data()
Default constructor.
Bounding volume data for i_shape_3d derived solid shapes.
Definition: bounding_data.h:41
The Bayeux/datatools library top-level namespace.
Definition: algo.h:13
The placement for a geometry volume with its translation and rotation with respect to some mother ref...
Definition: placement.h:34
Bounding cylinder.
Definition: bounding_data.h:51
Data for stacking along X, Y and/or Z axis.
Definition: i_stackable.h:161
std::list< polyline_type > wires_type
Alias for a list of 3D-polylines.
Definition: utils.h:61
void make_box(double xmin_, double xmax_, double ymin_, double ymax_, double zmin_, double zmax_)
Make a bounding box.
bb_type
Bounding data type.
Definition: bounding_data.h:48
void parse_bounding_data(const datatools::properties &config_)
Parse enforced bounding data from a properties container.
Top-level namespace of the Bayeux/geomtools module library.
Definition: electromagnetic_field_manager.h:39
A dictionary of arbitrary properties.
Definition: properties.h:125