Bayeux  3.4.1
Core Foundation library for SuperNEMO
elliptical_cylinder.h
Go to the documentation of this file.
1 /* Author(s): A. Chapon <chapon@lpccaen.in2p3.fr>
3  * F. Mauger <mauger@lpccaen.in2p3.fr>
4  * Creation date: 2014-11-17
5  * Last modified: 2015-03-11
6  *
7  * License:
8  *
9  * Description:
10  * 3D elliptical cylinder description
11  *
12  * History:
13  *
14  */
15 
16 #ifndef GEOMTOOLS_ELLIPTICAL_CYLINDER_H
17 #define GEOMTOOLS_ELLIPTICAL_CYLINDER_H 1
18 
19 // Standard library:
20 #include <iostream>
21 #include <string>
22 
23 // Third party:
24 // - Bayeux/datatools:
26 
27 // This project:
28 #include <geomtools/i_shape_3d.h>
29 #include <geomtools/i_stackable.h>
30 
31 namespace datatools {
32  // Forward class declaration:
33  class properties;
34 }
35 
36 namespace geomtools {
37 
38  // Forward class declarations:
39  class elliptical_sector;
40  class elliptical_cylinder_sector;
41 
44  public i_stackable
45  {
46  public:
47 
55  | FACE_BOTTOM
56  | FACE_TOP)
57  };
58 
60  static const std::string & elliptical_cylinder_label();
61 
64  elliptical_sector & face_,
65  placement & face_placement_) const;
66 
69  placement & face_placement_) const;
70 
72  virtual unsigned int compute_faces(face_info_collection_type & faces) const;
73 
75  double get_xmin () const;
76 
78  double get_xmax () const;
79 
81  double get_ymin () const;
82 
84  double get_ymax () const;
85 
87  double get_zmin () const;
88 
90  double get_zmax () const;
91 
93  double get_z () const;
94 
96  void set_z (double);
97 
99  double get_half_z() const;
100 
102  void set_half_z (double);
103 
105  double get_x_radius () const;
106 
108  void set_x_radius (double);
109 
111  double get_y_radius () const;
112 
114  void set_y_radius (double);
115 
117  void set (double xr_, double yr_, double z_);
118 
121 
123  elliptical_cylinder (double xr_, double yr_, double z_);
124 
126  virtual ~elliptical_cylinder ();
127 
129  virtual std::string get_shape_name () const;
130 
132  virtual double get_parameter (const std::string &) const;
133 
135  bool is_valid () const;
136 
138  virtual void initialize(const datatools::properties &,
139  const handle_dict_type *);
140 
142  virtual void reset();
143 
145  virtual double get_surface (uint32_t mask_ = FACE_ALL) const;
146 
148  virtual double get_volume (uint32_t flags_ = 0) const;
149 
151  virtual bool is_inside (const vector_3d &,
152  double skin_ = GEOMTOOLS_PROPER_TOLERANCE) const;
153 
155  virtual bool is_outside (const vector_3d &,
156  double skin_ = GEOMTOOLS_PROPER_TOLERANCE) const;
157 
159  virtual face_identifier on_surface(const vector_3d &,
160  const face_identifier & a_surface_mask = face_identifier::face_bits_any(),
161  double a_skin = GEOMTOOLS_PROPER_TOLERANCE) const;
162 
164  virtual vector_3d get_normal_on_surface(const vector_3d & a_position,
165  const face_identifier & a_surface_bit) const;
166 
168  virtual bool find_intercept (const vector_3d & from_,
169  const vector_3d & direction_,
170  face_intercept_info & intercept_,
171  double skin_ = GEOMTOOLS_PROPER_TOLERANCE) const;
172 
173  friend std::ostream &
174  operator<< (std::ostream &, const elliptical_cylinder &);
175 
176  friend std::istream &
177  operator>> (std::istream &, elliptical_cylinder &);
178 
180  virtual void tree_dump (std::ostream & out_ = std::clog,
181  const std::string & title_ = "",
182  const std::string & indent_ = "",
183  bool inherit_ = false) const;
184 
194  };
195 
197  virtual void generate_wires_self(wires_type & wires_,
198  uint32_t options_ = 0) const;
199 
202 
203  protected:
204 
206  void _set_default();
207 
209  virtual void _build_bounding_data();
210 
211  private:
212 
213  double _x_radius_;
214  double _y_radius_;
215  double _z_;
216 
217  // Registration interface :
219 
220  };
221 
222  // Type alias:
224 
225 } // end of namespace geomtools
226 
228 // @arg geomtools::elliptical_cylinder the name the class
230 
231 #endif // GEOMTOOLS_ELLIPTICAL_CYLINDER_H
232 
233 /*
234 ** Local Variables: --
235 ** mode: c++ --
236 ** c-file-style: "gnu" --
237 ** tab-width: 2 --
238 ** End: --
239 */
Definition: elliptical_cylinder.h:50
void set_half_z(double)
Set half the Z dimension.
Mother abstract class for all 3D solid shapes.
Definition: i_shape_3d.h:46
double get_ymin() const
Return the min Y coordinates (bounding box)
double get_y_radius() const
Return the Y radius.
double get_half_z() const
Return half the Z dimension.
virtual void _build_bounding_data()
Build bounding data.
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 of a segment with the surface.
virtual void tree_dump(std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
Smart print.
double get_x_radius() const
Return the X radius.
virtual vector_3d get_normal_on_surface(const vector_3d &a_position, const face_identifier &a_surface_bit) const
Return the vector normal to the surface at some position.
static const uint32_t bit01
Definition: bit_mask.h:28
The 2D shape/surface model for an elliptical cylinder sector.
Definition: elliptical_cylinder_sector.h:39
Identifier of a face attached to a solid shape.
Definition: face_identifier.h:32
double get_xmax() const
Return the max X coordinates (bounding box)
virtual bool is_outside(const vector_3d &, double skin_=GEOMTOOLS_PROPER_TOLERANCE) const
Check if a point is outside the cylinder.
virtual double get_volume(uint32_t flags_=0) const
Compute the volume of the cylinder.
friend std::istream & operator>>(std::istream &, elliptical_cylinder &)
An object that describes the way an object of a given class can be configured through properties.
Definition: object_configuration_description.h:234
virtual void generate_wires_self(wires_type &wires_, uint32_t options_=0) const
Generate a sequence of polylines for wires 3D rendering.
Rendering options bit mask.
Definition: elliptical_cylinder.h:191
elliptical_cylinder_wires_rendering_option_type
3D rendering options
Definition: elliptical_cylinder.h:186
void _set_default()
Set default attributes.
virtual void reset()
Reset.
The face_intercept_info class hosts the parameters of.
Definition: face_intercept_info.h:31
#define GEOMTOOLS_PROPER_TOLERANCE
Definition: geomtools_config.h:26
elliptical_cylinder elliptical_tube
Definition: elliptical_cylinder.h:223
The 3D shape model for an elliptical cylinder.
Definition: elliptical_cylinder.h:43
Definition: elliptical_cylinder.h:52
void set_x_radius(double)
Set the X radius.
Abstract base stackable object.
Definition: i_stackable.h:32
faces_mask_type
Masks used for the faces of the elliptical cylinder.
Definition: elliptical_cylinder.h:49
friend std::ostream & operator<<(std::ostream &, const elliptical_cylinder &)
elliptical_cylinder()
Default constructor.
virtual std::string get_shape_name() const
Return the name of the shape.
DOCD_CLASS_DECLARATION(my::algo)
Declaration of the OCD support for the my::algo class.
void set_z(double)
Set the Z dimension.
virtual double get_surface(uint32_t mask_=FACE_ALL) const
Compute the surface of the cylinder.
double get_z() const
Return the Z dimension.
double get_zmin() const
Return the min Z coordinates (bounding box)
static const face_identifier & face_bits_any()
Return a singleton face identifier with any bit.
static void init_ocd(datatools::object_configuration_description &)
OCD support.
A elliptical_sector sector surface (2D shape)
Definition: elliptical_sector.h:29
double get_ymax() const
Return the max Y coordinates (bounding box)
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
static const uint32_t FACE_BITS_NONE
No valid or known face bit.
Definition: face_identifier.h:45
Do not render the bottom face.
Definition: elliptical_cylinder.h:187
void compute_top_bottom_face(faces_mask_type face_id_, elliptical_sector &face_, placement &face_placement_) const
Compute the top or bottom face and placement.
virtual double get_parameter(const std::string &) const
Return a parameter by name.
void set(double xr_, double yr_, double z_)
Set the X and Y radii and Z.
virtual unsigned int compute_faces(face_info_collection_type &faces) const
Compute informations about the faces of this solid shape.
#define GEOMTOOLS_OBJECT_3D_REGISTRATION_INTERFACE(ModelClassName)
Definition: i_object_3d.h:260
Definition: elliptical_cylinder.h:54
virtual ~elliptical_cylinder()
Destructor.
CLHEP::Hep3Vector vector_3d
Alias for the CLHEP 3D-vector class.
Definition: clhep.h:63
Definition: elliptical_cylinder.h:51
bool is_valid() const
Check the validity.
Last defined bit.
Definition: i_wires_3d_rendering.h:62
virtual bool is_inside(const vector_3d &, double skin_=GEOMTOOLS_PROPER_TOLERANCE) const
Check if a point is inside the cylinder.
The Bayeux/datatools library top-level namespace.
Definition: algo.h:13
void set_y_radius(double)
Set the Y radius.
The placement for a geometry volume with its translation and rotation with respect to some mother ref...
Definition: placement.h:34
std::list< polyline_type > wires_type
Alias for a list of 3D-polylines.
Definition: utils.h:61
static const std::string & elliptical_cylinder_label()
Return the elliptical cylinder shape label.
static const uint32_t bit00
Definition: bit_mask.h:27
Do not render the side face.
Definition: elliptical_cylinder.h:189
Definition: elliptical_cylinder.h:53
double get_zmax() const
Return the max Z coordinates (bounding box)
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: elliptical_cylinder.h:190
virtual void initialize(const datatools::properties &, const handle_dict_type *)
Initialize from properties.
double get_xmin() const
Return the min X coordinates (bounding box)
std::vector< face_info > face_info_collection_type
Type alias for a collection of face information objects.
Definition: face_info.h:168
void compute_side_face(elliptical_cylinder_sector &face_, placement &face_placement_) const
Compute the side face and placement.
Do not render the top face.
Definition: elliptical_cylinder.h:188
Top-level namespace of the Bayeux/geomtools module library.
Definition: electromagnetic_field_manager.h:39
A dictionary of arbitrary properties.
Definition: properties.h:125