Bayeux  3.4.1
Core Foundation library for SuperNEMO
right_polygonal_frustrum.h
Go to the documentation of this file.
1 /* Author(s) : Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date: 2015-03-15
4  * Last modified: 2015-03-21
5  *
6  * License:
7  *
8  * Description:
9  *
10  * Right polygonal frustrum
11  *
12  */
13 
14 #ifndef GEOMTOOLS_RIGHT_POLYGONAL_FRUSTRUM_H
15 #define GEOMTOOLS_RIGHT_POLYGONAL_FRUSTRUM_H 1
16 
17 // This project:
18 #include <geomtools/i_shape_3d.h>
19 #include <geomtools/i_stackable.h>
20 
21 namespace geomtools {
22 
23  // Class forward declarations:
24  class composite_surface;
25 
28  public i_stackable
29  {
30  public:
31 
40  | FACE_BOTTOM
41  | FACE_TOP
43  };
44 
50  };
51 
53  static const unsigned int MIN_NUMBER_OF_SIDES = 3;
54 
56  static const std::string & rpf_label();
57 
59  virtual std::string get_shape_name() const;
60 
62  bool is_valid() const;
63 
65  double get_xmin() const;
66 
68  double get_xmax() const;
69 
71  double get_ymin() const;
72 
74  double get_ymax() const;
75 
77  double get_zmin() const;
78 
80  double get_zmax() const;
81 
83  uint32_t get_n_sides() const;
84 
86  void set_n_sides(uint32_t);
87 
89  uint32_t get_sector_start() const;
90 
92  uint32_t get_sector_stop() const;
93 
95  double get_sector_angle() const;
96 
98  double get_start_angle(unsigned int sector_) const;
99 
101  void set_z(double);
102 
104  double get_z() const;
105 
107  bool has_top_face() const;
108 
110  bool has_bottom_face() const;
111 
113  bool has_inner_face() const;
114 
116  bool has_inner_bottom_radius() const;
117 
119  void set_inner_bottom_radius(double);
120 
122  double get_inner_bottom_radius() const;
123 
125  void set_outer_bottom_radius(double);
126 
128  double get_outer_bottom_radius() const;
129 
131  bool has_inner_top_radius() const;
132 
134  void set_inner_top_radius(double);
135 
137  double get_inner_top_radius() const;
138 
140  void set_outer_top_radius(double);
141 
143  double get_outer_top_radius() const;
144 
147 
149  right_polygonal_frustrum(unsigned int n_sides_,
150  double inner_bottom_radius_,
151  double outer_bottom_radius_,
152  double inner_top_radius_,
153  double outer_top_radius_,
154  double z_);
155 
157  virtual ~right_polygonal_frustrum();
158 
160  virtual void tree_dump (std::ostream & out_ = std::clog,
161  const std::string & title_ = "",
162  const std::string & indent_ = "",
163  bool inherit_ = false) const;
164 
166  void compute_inner_face(composite_surface & face_) const;
167 
169  void compute_outer_face(composite_surface & face_) const;
170 
172  void compute_top_face(composite_surface & top_face_, placement &) const;
173 
175  void compute_bottom_face(composite_surface & bottom_face_, placement &) const;
176 
178  virtual unsigned int compute_faces(face_info_collection_type &) const;
179 
181  double compute_outer_radius(double z_) const;
182 
184  double compute_inner_radius(double z_) const;
185 
187  virtual double get_surface(uint32_t mask_ = FACE_ALL) const;
188 
190  virtual double get_volume(uint32_t flags_ = VOLUME_BULK) const;
191 
193  virtual bool is_inside (const vector_3d &,
194  double skin_ = GEOMTOOLS_PROPER_TOLERANCE) const;
195 
197  virtual bool is_outside (const vector_3d &,
198  double skin_ = GEOMTOOLS_PROPER_TOLERANCE) const;
199 
201  virtual face_identifier on_surface(const vector_3d &,
202  const face_identifier & a_surface_mask = face_identifier::face_bits_any(),
203  double a_skin = GEOMTOOLS_PROPER_TOLERANCE) const;
204 
206  virtual vector_3d get_normal_on_surface (const vector_3d & position_,
207  const face_identifier & ) const;
208 
210  virtual bool find_intercept(const vector_3d & from_,
211  const vector_3d & direction_,
212  face_intercept_info & intercept_,
213  double skin_ = GEOMTOOLS_PROPER_TOLERANCE) const;
214 
216  virtual void initialize(const datatools::properties &, const handle_dict_type * = 0);
217 
219  virtual void reset();
220 
232  };
233 
235  virtual void generate_wires_self(wires_type & wires_,
236  uint32_t options_ = 0) const;
237 
238  protected:
239 
241  void _set_defaults();
242 
244  virtual void _build_bounding_data();
245 
246  private:
247 
248  uint32_t _n_sides_;
249  uint32_t _sector_start_;
250  uint32_t _sector_stop_;
251  double _inner_bottom_radius_;
252  double _outer_bottom_radius_;
253  double _inner_top_radius_;
254  double _outer_top_radius_;
255  double _z_;
256 
257  // Registration interface :
259 
260  };
261 
264 
265 } // end of namespace geomtools
266 
267 #endif // GEOMTOOLS_RIGHT_POLYGONAL_FRUSTRUM_H
268 
269 /*
270 ** Local Variables: --
271 ** mode: c++ --
272 ** c-file-style: "gnu" --
273 ** tab-width: 2 --
274 ** End: --
275 */
Last defined bit.
Definition: right_polygonal_frustrum.h:227
virtual unsigned int compute_faces(face_info_collection_type &) const
Compute informations about the faces of this solid shape.
Definition: right_polygonal_frustrum.h:36
virtual void initialize(const datatools::properties &, const handle_dict_type *=0)
Initialize the frustrum from properties.
Definition: right_polygonal_frustrum.h:39
static const std::string & rpf_label()
Return the identifier label for the class.
double get_sector_angle() const
Get the sector angle.
Definition: right_polygonal_frustrum.h:38
uint32_t get_n_sides() const
Return the number of sides.
double get_inner_top_radius() const
Return the inner top radius.
Mother abstract class for all 3D solid shapes.
Definition: i_shape_3d.h:46
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.
Right polygonal frustrum (3D shape)
Definition: right_polygonal_frustrum.h:27
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.
The abstract base class for all 2D shapes/surfaces.
Definition: composite_surface.h:26
virtual void reset()
Reset the frustrum.
void set_n_sides(uint32_t)
Set the number of sides.
double get_outer_bottom_radius() const
Return the outer bottom radius.
static const uint32_t bit01
Definition: bit_mask.h:28
double get_start_angle(unsigned int sector_) const
Get the start angle per sector.
static const uint32_t bit03
Definition: bit_mask.h:30
double get_zmax() const
Return the maximum Z.
Identifier of a face attached to a solid shape.
Definition: face_identifier.h:32
virtual void _build_bounding_data()
Build bounding data.
Do not render the bottom edge.
Definition: right_polygonal_frustrum.h:225
virtual bool is_inside(const vector_3d &, double skin_=GEOMTOOLS_PROPER_TOLERANCE) const
Check if a point is inside the frustrum.
virtual double get_surface(uint32_t mask_=FACE_ALL) const
Compute the surface.
void compute_inner_face(composite_surface &face_) const
Compute the inner face.
bool has_bottom_face() const
Check for a bottom face.
void set_outer_top_radius(double)
Set the outer top radius.
bool is_valid() const
Check if the frustrum is valid.
void compute_top_face(composite_surface &top_face_, placement &) const
Compute the top face.
bool has_inner_top_radius() const
Check inner top radius.
The face_intercept_info class hosts the parameters of.
Definition: face_intercept_info.h:31
#define GEOMTOOLS_PROPER_TOLERANCE
Definition: geomtools_config.h:26
void set_z(double)
Set the Z dimension.
double get_ymin() const
Return the minimum Y.
Definition: right_polygonal_frustrum.h:35
virtual void generate_wires_self(wires_type &wires_, uint32_t options_=0) const
Generate a sequence of polylines for wires 3D rendering.
right_polygonal_frustrum polygonal_frustrum
Type alias.
Definition: right_polygonal_frustrum.h:263
Abstract base stackable object.
Definition: i_stackable.h:32
Do not render the top edge.
Definition: right_polygonal_frustrum.h:224
void set_inner_top_radius(double)
Set the inner top radius.
bool has_inner_bottom_radius() const
Check inner bottom radius.
void set_inner_bottom_radius(double)
Set the inner bottom radius.
uint32_t get_sector_start() const
Return the starting sector index.
Do not render the bottom edge.
Definition: right_polygonal_frustrum.h:226
double get_xmax() const
Return the maximum X.
double get_ymax() const
Return the maximum Y.
faces_mask_type
Face flags.
Definition: right_polygonal_frustrum.h:33
static const unsigned int MIN_NUMBER_OF_SIDES
The minimum number of sides.
Definition: right_polygonal_frustrum.h:53
volumes_mask_type
Volume flags.
Definition: right_polygonal_frustrum.h:46
static const face_identifier & face_bits_any()
Return a singleton face identifier with any bit.
double get_zmin() const
Return the minimum Z.
double compute_inner_radius(double z_) const
Compute the inner radius at given z.
virtual void tree_dump(std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
Smart print.
std::map< std::string, object_entry > handle_dict_type
Dictionary of handle of 3D object entries.
Definition: i_object_3d.h:124
static const uint32_t bit02
Definition: bit_mask.h:29
double get_xmin() const
Return the minimum X.
static const uint32_t FACE_BITS_NONE
No valid or known face bit.
Definition: face_identifier.h:45
double get_inner_bottom_radius() const
Return the inner bottom radius.
Rendering options bit mask.
Definition: right_polygonal_frustrum.h:228
rpf_wires_rendering_option_type
3D rendering options
Definition: right_polygonal_frustrum.h:222
virtual double get_volume(uint32_t flags_=VOLUME_BULK) const
Compute the volume.
virtual bool is_outside(const vector_3d &, double skin_=GEOMTOOLS_PROPER_TOLERANCE) const
Check if a point is outside the frustrum.
uint32_t get_sector_stop() const
Return the stopping sector index.
virtual ~right_polygonal_frustrum()
Destructor.
double get_outer_top_radius() const
Return the outer top radius.
#define GEOMTOOLS_OBJECT_3D_REGISTRATION_INTERFACE(ModelClassName)
Definition: i_object_3d.h:260
Definition: right_polygonal_frustrum.h:49
bool has_inner_face() const
Check for an inner face.
CLHEP::Hep3Vector vector_3d
Alias for the CLHEP 3D-vector class.
Definition: clhep.h:63
void compute_bottom_face(composite_surface &bottom_face_, placement &) const
Compute the bottom face.
void compute_outer_face(composite_surface &face_) const
Compute the outer face.
right_polygonal_frustrum()
Default constructor.
Definition: right_polygonal_frustrum.h:37
void set_outer_bottom_radius(double)
Set the outer bottom radius.
virtual std::string get_shape_name() const
Return the identifier/name of the shape.
Last defined bit.
Definition: i_wires_3d_rendering.h:62
The placement for a geometry volume with its translation and rotation with respect to some mother ref...
Definition: placement.h:34
Definition: right_polygonal_frustrum.h:48
std::list< polyline_type > wires_type
Alias for a list of 3D-polylines.
Definition: utils.h:61
bool has_top_face() const
Check for a top face.
Do not render the bottom edge.
Definition: right_polygonal_frustrum.h:223
static const uint32_t bit00
Definition: bit_mask.h:27
Definition: right_polygonal_frustrum.h:34
Definition: right_polygonal_frustrum.h:47
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
double get_z() const
Return the Z dimension.
Top-level namespace of the Bayeux/geomtools module library.
Definition: electromagnetic_field_manager.h:39
A dictionary of arbitrary properties.
Definition: properties.h:125
double compute_outer_radius(double z_) const
Compute the outer radius at given z.
virtual vector_3d get_normal_on_surface(const vector_3d &position_, const face_identifier &) const
Compute the normal to the surface of the furstrum.