Bayeux  3.4.1
Core Foundation library for SuperNEMO
ellipsoid.h
Go to the documentation of this file.
1 /* Author(s): A. Chapon <chapon@lpccaen.in2p3.fr>
3  * Creation date: 2014-11-18
4  * Last modified: 2014-11-18
5  *
6  * License:
7  *
8  * Description:
9  * 3D ellipsoid description
10  *
11  * History:
12  *
13  */
14 
15 #ifndef GEOMTOOLS_ELLIPSOID_H
16 #define GEOMTOOLS_ELLIPSOID_H 1
17 
18 // Standard library:
19 #include <string>
20 #include <iostream>
21 
22 // Third party
23 // - Bayeux/datatools:
24 #include <datatools/bit_mask.h>
25 
26 // This project:
27 #include <geomtools/i_shape_3d.h>
28 #include <geomtools/i_stackable.h>
29 
30 namespace datatools {
31  // Forward class declaration:
32  class properties;
33 }
34 
35 namespace geomtools {
36 
37  // Forward class declarations:
38  class elliptical_sector;
39  class ellipsoid_sector;
40 
42  class ellipsoid : public i_shape_3d,
43  public i_stackable
44  {
45  public:
46 
53  };
54 
55  static const std::string & ellipsoid_label();
56 
59  elliptical_sector & face_,
60  placement & face_placement_) const;
61 
64  placement & face_placement_) const;
65 
66  virtual unsigned int compute_faces(face_info_collection_type & faces) const;
67 
68  double get_xmin() const;
69 
70  double get_xmax() const;
71 
72  double get_ymin() const;
73 
74  double get_ymax() const;
75 
76  double get_zmin() const;
77 
78  double get_zmax() const;
79 
80  double get_x_radius() const;
81 
82  void set_x_radius(double);
83 
84  double get_y_radius() const;
85 
86  void set_y_radius(double);
87 
88  double get_z_radius() const;
89 
90  void set_z_radius(double);
91 
92  double get_bottom_z_cut() const;
93 
94  void set_bottom_z_cut(double);
95 
96  double get_top_z_cut() const;
97 
98  void set_top_z_cut(double);
99 
100  void set(double rx_, double ry_, double rz_);
101 
102  void set(double rx_, double ry_, double rz_,
103  double zm_, double zp_);
104 
106  ellipsoid();
107 
109  ellipsoid(double rx_, double ry_, double rz_);
110 
112  ellipsoid(double rx_, double ry_, double rz_,
113  double zm_, double zp_);
114 
116  virtual ~ellipsoid();
117 
119  virtual std::string get_shape_name() const;
120 
122  virtual double get_parameter(const std::string &) const;
123 
125  bool is_valid() const;
126 
128  virtual void initialize(const datatools::properties &,
129  const handle_dict_type * = 0);
130 
132  virtual void reset();
133 
135  virtual double get_surface(uint32_t mask_ = FACE_ALL) const;
136 
138  virtual double get_volume(uint32_t flags_ = 0) const;
139 
141  virtual bool is_inside(const vector_3d &,
142  double skin_ = GEOMTOOLS_PROPER_TOLERANCE) const;
143 
145  virtual bool is_outside(const vector_3d &,
146  double skin_ = GEOMTOOLS_PROPER_TOLERANCE) const;
147 
149  virtual face_identifier on_surface(const vector_3d &,
150  const face_identifier & a_surface_mask = face_identifier::face_bits_any(),
151  double a_skin = GEOMTOOLS_PROPER_TOLERANCE) const;
152 
154  virtual vector_3d get_normal_on_surface(const vector_3d & a_position,
155  const face_identifier & a_surface_bit) const;
156 
158  virtual bool find_intercept(const vector_3d & from_,
159  const vector_3d & direction_,
160  face_intercept_info & intercept_,
161  double skin_ = GEOMTOOLS_PROPER_TOLERANCE) const;
162 
163  friend std::ostream &
164  operator<<(std::ostream &, const ellipsoid &);
165 
166  friend std::istream &
167  operator>>(std::istream &, ellipsoid &);
168 
170  virtual void tree_dump(std::ostream & out_ = std::clog,
171  const std::string & title_ = "",
172  const std::string & indent_ = "",
173  bool inherit_ = false) const;
174 
177 
187  )
188  };
189 
191  virtual void generate_wires_self(wires_type & wires_,
192  uint32_t options_ = 0) const;
193 
194  protected:
195 
197  void _set_default();
198 
200  virtual void _build_bounding_data();
201 
202  private:
203 
204  double _x_radius_;
205  double _y_radius_;
206  double _z_radius_;
207  double _bottom_z_cut_;
208  double _top_z_cut_;
209 
210  // Registration interface :
212 
213  };
214 
215 } // end of namespace geomtools
216 
218 // @arg geomtools::ellipsoid the name the class
220 
221 #endif // GEOMTOOLS_ELLIPSOID_H
222 
223 /*
224 ** Local Variables: --
225 ** mode: c++ --
226 ** c-file-style: "gnu" --
227 ** tab-width: 2 --
228 ** End: --
229 */
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_ymin() const
Do not render the top face.
Definition: ellipsoid.h:182
Definition: ellipsoid.h:49
double get_zmin() const
void compute_side_face(ellipsoid_sector &face_, placement &face_placement_) const
Compute the side face and placement.
void set_y_radius(double)
double get_xmax() const
virtual ~ellipsoid()
Destructor.
static const std::string & ellipsoid_label()
Mother abstract class for all 3D solid shapes.
Definition: i_shape_3d.h:46
Last defined bit.
Definition: ellipsoid.h:183
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: ellipsoid.h:184
virtual void reset()
Reset the ellipsoid.
double get_z_radius() const
void set_x_radius(double)
static const uint32_t bit01
Definition: bit_mask.h:28
virtual bool is_inside(const vector_3d &, double skin_=GEOMTOOLS_PROPER_TOLERANCE) const
Check if a point is inside the tube.
The 3D shape model for an ellipsoid.
Definition: ellipsoid.h:42
Identifier of a face attached to a solid shape.
Definition: face_identifier.h:32
Do not render the side face.
Definition: ellipsoid.h:180
An object that describes the way an object of a given class can be configured through properties.
Definition: object_configuration_description.h:234
void _set_default()
Set default attributes.
double get_x_radius() const
double get_zmax() const
Definition: ellipsoid.h:50
The face_intercept_info class hosts the parameters of.
Definition: face_intercept_info.h:31
void set_top_z_cut(double)
#define GEOMTOOLS_PROPER_TOLERANCE
Definition: geomtools_config.h:26
Definition: ellipsoid.h:52
ellipsoid_wires_rendering_option_type
3D rendering options
Definition: ellipsoid.h:179
faces_mask_type
Definition: ellipsoid.h:47
Abstract base stackable object.
Definition: i_stackable.h:32
double get_y_radius() const
double get_bottom_z_cut() const
Definition: ellipsoid.h:51
Definition: ellipsoid.h:48
DOCD_CLASS_DECLARATION(my::algo)
Declaration of the OCD support for the my::algo class.
bool is_valid() const
Check the validity of the ellipsoid.
Do not render the bottom face.
Definition: ellipsoid.h:181
virtual bool is_outside(const vector_3d &, double skin_=GEOMTOOLS_PROPER_TOLERANCE) const
Check if a point is outside the tube.
static const face_identifier & face_bits_any()
Return a singleton face identifier with any bit.
A elliptical_sector sector surface (2D shape)
Definition: elliptical_sector.h:29
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
void set_z_radius(double)
static void init_ocd(datatools::object_configuration_description &)
OCD support.
ellipsoid()
Constructor.
virtual double get_parameter(const std::string &) const
Return the value of some parameter.
#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.
virtual double get_volume(uint32_t flags_=0) const
Compute the volume.
CLHEP::Hep3Vector vector_3d
Alias for the CLHEP 3D-vector class.
Definition: clhep.h:63
virtual void initialize(const datatools::properties &, const handle_dict_type *=0)
Initialize the ellipsoid from properties.
virtual unsigned int compute_faces(face_info_collection_type &faces) const
Return a collection of face info objects.
Last defined bit.
Definition: i_wires_3d_rendering.h:62
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
friend std::istream & operator>>(std::istream &, ellipsoid &)
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.
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.
void set(double rx_, double ry_, double rz_)
std::list< polyline_type > wires_type
Alias for a list of 3D-polylines.
Definition: utils.h:61
friend std::ostream & operator<<(std::ostream &, const ellipsoid &)
double get_top_z_cut() const
static const uint32_t bit00
Definition: bit_mask.h:27
double get_xmin() const
void set_bottom_z_cut(double)
virtual std::string get_shape_name() const
Return the name of the shape.
The 2D shape/surface model for an ellipsoid sector.
Definition: ellipsoid_sector.h:38
virtual void _build_bounding_data()
Build bounding data.
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.
std::vector< face_info > face_info_collection_type
Type alias for a collection of face information objects.
Definition: face_info.h:168
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 tube.
double get_ymax() const
Top-level namespace of the Bayeux/geomtools module library.
Definition: electromagnetic_field_manager.h:39
A dictionary of arbitrary properties.
Definition: properties.h:125