Bayeux  3.4.1
Core Foundation library for SuperNEMO
wall_solid.h
Go to the documentation of this file.
1 /* Author(s): Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date: 2015-07-16
4  * Last modified: 2015-07-16
5  *
6  * License: GPL3
7  *
8  * Description:
9  *
10  * A 3D solid representing a vertical wall with arbitrary height
11  * and composed of several segments of arbitrary thickness
12  *
13  */
14 
15 #ifndef GEOMTOOLS_WALL_SOLID_H
16 #define GEOMTOOLS_WALL_SOLID_H 1
17 
18 // Standard library:
19 #include <sstream>
20 #include <stdexcept>
21 
22 // Third party:
23 // - Bayeux/datatools:
25 
26 // This project:
27 #include <geomtools/i_shape_3d.h>
28 #include <geomtools/i_stackable.h>
30 #include <geomtools/placement.h>
32 
33 namespace datatools {
34  // Forward class declaration:
35  class properties;
36 }
37 
38 namespace geomtools {
39 
40  class tessellated_solid;
41 
43  class wall_solid : public i_shape_3d,
44  public i_stackable
45  {
46 
47  public:
48 
50  static const std::string & wall_solid_label();
51 
55  FACE_SIDE = 0x1,
56  FACE_BOTTOM = 0x2,
57  FACE_TOP = 0x4,
59  | FACE_BOTTOM
60  | FACE_TOP)
61  };
62 
63  virtual double get_xmin() const;
64 
65  virtual double get_xmax() const;
66 
67  virtual double get_ymin() const;
68 
69  virtual double get_ymax() const;
70 
71  virtual double get_zmin() const;
72 
73  virtual double get_zmax() const;
74 
76  double get_z() const;
77 
79  void set_z(double);
80 
82  const simple_polygon & get_base() const;
83 
86 
88  wall_solid();
89 
91  virtual ~wall_solid();
92 
94  virtual std::string get_shape_name() const;
95 
97  bool is_valid() const;
98 
100  virtual void initialize(const datatools::properties & setup_, const handle_dict_type * = 0);
101 
103  virtual void reset();
104 
107  placement & face_placement_) const;
108 
110  void compute_top_face(composite_surface & face_,
111  placement & face_placement_) const;
112 
114  void compute_side_face(composite_surface & face_) const;
115 
117  virtual unsigned int compute_faces(face_info_collection_type &) const;
118 
120  virtual double get_volume(uint32_t flags_ = 0) const;
121 
123  virtual double get_surface(uint32_t mask_ = FACE_ALL) const;
124 
126  virtual bool is_inside(const vector_3d &,
127  double skin_ = GEOMTOOLS_PROPER_TOLERANCE) const;
128 
130  virtual bool is_outside(const vector_3d &,
131  double skin_ = GEOMTOOLS_PROPER_TOLERANCE) const;
132 
134  virtual face_identifier on_surface(const vector_3d &,
135  const face_identifier & a_surface_mask = face_identifier::face_bits_any(),
136  double a_skin = GEOMTOOLS_PROPER_TOLERANCE) const;
137 
139  virtual vector_3d get_normal_on_surface (const vector_3d & position_,
140  const face_identifier & ) const;
141 
143  virtual bool find_intercept(const vector_3d & from_,
144  const vector_3d & direction_,
145  face_intercept_info & intercept_,
146  double skin_ = GEOMTOOLS_PROPER_TOLERANCE) const;
147 
149  virtual void tree_dump(std::ostream & out_ = std::clog,
150  const std::string & title_ = "",
151  const std::string & indent_ = "",
152  bool inherit_ = false) const;
153 
163  )
164  };
165 
167  virtual void generate_wires_self(wires_type & wires_,
168  uint32_t options_ = 0) const;
169 
172 
173  protected:
174 
176  virtual void _build_bounding_data();
177 
179  void _set_defaults();
180 
181  private:
182 
183  double _z_;
184  simple_polygon _base_;
185 
186  // Working data (not used yet):
187  // bool _computed_; //!< Flag indicating that internal working data have been computed
188  // boost::logic::tribool _has_top_face_;
189  // boost::logic::tribool _has_bottom_face_;
190  // boost::logic::tribool _has_inner_face_;
191  // double _top_surface_;
192  // double _bottom_surface_;
193  // double _side_surface_;
194  // double _volume_;
195 
196  // Registration interface :
198 
199  };
200 
201 } // end of namespace geomtools
202 
203 #endif // GEOMTOOLS_WALL_SOLID_H
204 
205 /*
206 ** Local Variables: --
207 ** mode: c++ --
208 ** c-file-style: "gnu" --
209 ** tab-width: 2 --
210 ** End: --
211 */
virtual std::string get_shape_name() const
Return the identifier/name of the shape.
double get_z() const
Return the Z dimension.
Definition: wall_solid.h:54
simple_polygon & grab_base()
Return a mutable reference to the base.
Mother abstract class for all 3D solid shapes.
Definition: i_shape_3d.h:46
The abstract base class for all 2D shapes/surfaces.
Definition: composite_surface.h:26
Do not render the top face.
Definition: wall_solid.h:157
virtual bool is_inside(const vector_3d &, double skin_=GEOMTOOLS_PROPER_TOLERANCE) const
Check if a point is inside the frustrum.
Identifier of a face attached to a solid shape.
Definition: face_identifier.h:32
Tessellated solid made of facets.
Definition: tessellation.h:294
virtual bool find_intercept(const vector_3d &from_, const vector_3d &direction_, face_intercept_info &intercept_, double skin_=GEOMTOOLS_PROPER_TOLERANCE) const
Find the intercept point with a face of the frustrum.
faces_mask_type
Masks used for the faces of the cylinder.
Definition: wall_solid.h:53
wall_wires_rendering_option_type
3D rendering options
Definition: wall_solid.h:155
virtual vector_3d get_normal_on_surface(const vector_3d &position_, const face_identifier &) const
Compute the normal to the surface of the furstrum.
A simple polygon in the XY plane.
Definition: simple_polygon.h:38
void compute_side_face(composite_surface &face_) const
Compute the side bottom face and placement.
virtual void reset()
Reset/invalidate the solid.
const simple_polygon & get_base() const
Return a non mutable reference to the base.
Definition: wall_solid.h:56
virtual unsigned int compute_faces(face_info_collection_type &) const
Compute informations about the faces of this solid shape.
wall_solid()
Default constructor.
The face_intercept_info class hosts the parameters of.
Definition: face_intercept_info.h:31
#define GEOMTOOLS_PROPER_TOLERANCE
Definition: geomtools_config.h:26
Rendering options bit mask.
Definition: wall_solid.h:160
Abstract base stackable object.
Definition: i_stackable.h:32
Definition: wall_solid.h:58
virtual bool is_outside(const vector_3d &, double skin_=GEOMTOOLS_PROPER_TOLERANCE) const
Check if a point is outside the frustrum.
virtual double get_zmin() const
static const face_identifier & face_bits_any()
Return a singleton face identifier with any bit.
virtual double get_ymax() const
void convert_to_tessellated(tessellated_solid &) const
Convert the wall to a tessellated solid.
Do not render the bottom face.
Definition: wall_solid.h:156
std::map< std::string, object_entry > handle_dict_type
Dictionary of handle of 3D object entries.
Definition: i_object_3d.h:124
void compute_top_face(composite_surface &face_, placement &face_placement_) const
Compute the top face.
static const uint32_t FACE_BITS_NONE
No valid or known face bit.
Definition: face_identifier.h:45
virtual face_identifier on_surface(const vector_3d &, const face_identifier &a_surface_mask=face_identifier::face_bits_any(), double a_skin=GEOMTOOLS_PROPER_TOLERANCE) const
Return the surface bit a point belongs to.
Last defined bit.
Definition: wall_solid.h:159
virtual void generate_wires_self(wires_type &wires_, uint32_t options_=0) const
Generate a list of polylines representing the contour of the shape (for display clients)
virtual double get_xmin() const
The 3D shape model for a wall solid.
Definition: wall_solid.h:43
#define GEOMTOOLS_OBJECT_3D_REGISTRATION_INTERFACE(ModelClassName)
Definition: i_object_3d.h:260
virtual double get_surface(uint32_t mask_=FACE_ALL) const
Compute the surface.
static const std::string & wall_solid_label()
Return the wall shape label.
virtual double get_volume(uint32_t flags_=0) const
Compute the volume.
virtual double get_ymin() const
CLHEP::Hep3Vector vector_3d
Alias for the CLHEP 3D-vector class.
Definition: clhep.h:63
Definition: wall_solid.h:57
virtual void initialize(const datatools::properties &setup_, const handle_dict_type *=0)
Main initialization method from a container of configuration parameters.
Last defined bit.
Definition: i_wires_3d_rendering.h:62
The Bayeux/datatools library top-level namespace.
Definition: algo.h:13
virtual void tree_dump(std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
Smart print.
The placement for a geometry volume with its translation and rotation with respect to some mother ref...
Definition: placement.h:34
Do not render the side face.
Definition: wall_solid.h:158
virtual double get_xmax() const
bool is_valid() const
Check if the solid is valid.
std::list< polyline_type > wires_type
Alias for a list of 3D-polylines.
Definition: utils.h:61
virtual double get_zmax() const
void compute_bottom_face(composite_surface &face_, placement &face_placement_) const
Compute the bottom face.
void set_z(double)
Set the Z dimension.
Definition: wall_solid.h:55
void _set_defaults()
Set default attributes.
std::vector< face_info > face_info_collection_type
Type alias for a collection of face information objects.
Definition: face_info.h:168
virtual void _build_bounding_data()
Build bounding data.
virtual ~wall_solid()
Destructor.
Top-level namespace of the Bayeux/geomtools module library.
Definition: electromagnetic_field_manager.h:39
A dictionary of arbitrary properties.
Definition: properties.h:125