Bayeux  3.4.1
Core Foundation library for SuperNEMO
sphere.h
Go to the documentation of this file.
1 /* Author(s): F.Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date: 2006-11-28
4  * Last modified: 2014-04-08
5  *
6  * License:
7  *
8  * Description:
9  * 3D sphere description
10  *
11  * History:
12  *
13  */
14 
15 #ifndef GEOMTOOLS_SPHERE_H
16 #define GEOMTOOLS_SPHERE_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>
30 
31 namespace datatools {
32  // Forward class declaration:
33  class properties;
34 }
35 
36 namespace geomtools {
37 
38  // Class forward declarations:
39  class disk;
40  class spherical_sector;
41  class right_circular_conical_nappe;
42 
44  class sphere : public i_shape_3d,
45  public i_stackable
46  {
47  public:
48 
64  };
65 
66  static const std::string & sphere_label();
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_r() const;
81 
82  double get_r_max() const;
83 
84  double get_radius() const;
85 
86  bool has_r_min() const;
87 
88  double get_r_min() const;
89 
90  void set_r(double);
91 
92  void set_r_max(double);
93 
94  void set_radius(double);
95 
96  void set_r_min(double);
97 
98  void reset_r_max();
99 
100  void reset_r_min();
101 
102  void set(double rmax_);
103 
104  void set(double rmin_, double rmax_);
105 
106 
108  const angular_range & get_theta_domain() const;
109 
111  bool has_partial_theta() const;
112 
114  bool has_start_theta() const;
115 
117  void set_start_theta(double);
118 
120  double get_start_theta() const;
121 
123  bool has_delta_theta() const;
124 
126  void set_delta_theta(double);
127 
129  double get_delta_theta() const;
130 
132  const angular_range & get_phi_domain() const;
133 
135  bool has_partial_phi() const;
136 
138  bool has_start_phi() const;
139 
141  void set_start_phi(double);
142 
144  double get_start_phi() const;
145 
147  bool has_delta_phi() const;
148 
150  void set_delta_phi(double);
151 
153  double get_delta_phi() const;
154 
155  void set_phi(double start_phi_, double delta_phi_);
156 
157  void set_theta(double start_theta_, double delta_theta_);
158 
159  bool is_orb() const;
160 
162  sphere();
163 
165  sphere(double radius_);
166 
168  sphere(double radius_min_, double radius_max_);
169 
171  virtual ~sphere();
172 
174  virtual std::string get_shape_name() const;
175 
177  virtual double get_parameter(const std::string &) const;
178 
180  bool is_valid() const;
181 
183  virtual void initialize(const datatools::properties &, const handle_dict_type * = 0);
184 
186  virtual void reset();
187 
189  virtual double get_surface(uint32_t mask_ = FACE_ALL) const;
190 
192  virtual double get_volume(uint32_t flags_ = 0) const;
193 
195  virtual bool is_inside(const vector_3d &,
196  double skin_ = GEOMTOOLS_PROPER_TOLERANCE) const;
197 
199  virtual bool is_outside(const vector_3d &,
200  double skin_ = GEOMTOOLS_PROPER_TOLERANCE) const;
201 
203  virtual face_identifier on_surface(const vector_3d &,
204  const face_identifier & a_surface_mask = face_identifier::face_bits_any(),
205  double a_skin = GEOMTOOLS_PROPER_TOLERANCE) const;
206 
208  virtual vector_3d get_normal_on_surface(const vector_3d & a_position,
209  const face_identifier & a_surface_bit) const;
210 
212  virtual bool find_intercept(const vector_3d & from_,
213  const vector_3d & direction_,
214  face_intercept_info & intercept_,
215  double skin_ = GEOMTOOLS_PROPER_TOLERANCE) const;
216 
219 
222 
225 
228 
231 
234 
237 
239  void compute_start_phi_face(disk &, placement &) const;
240 
242  void compute_stop_phi_face(disk &, placement &) const;
243 
245  virtual unsigned int compute_faces(face_info_collection_type & faces_) const;
246 
247 
248  friend std::ostream &
249  operator<<(std::ostream &, const sphere &);
250 
251  friend std::istream &
252  operator>>(std::istream &, sphere &);
253 
254  virtual void tree_dump(std::ostream & out_ = std::clog,
255  const std::string & title_ = "",
256  const std::string & indent_ = "",
257  bool inherit_ = false) const;
258 
274  )
275  };
276 
278  virtual void generate_wires_self(wires_type & wires_,
279  uint32_t options_ = 0) const;
280 
283 
284  protected:
285 
287  void _set_default();
288 
290  virtual void _build_bounding_data();
291 
292  private:
293 
294  double _r_;
295  double _r_min_;
296  angular_range _theta_domain_;
297  angular_range _phi_domain_;
298 
299  // Registration interface :
301 
302  };
303 
304 } // end of namespace geomtools
305 
307 // @arg geomtools::sphere the name the class
309 
310 #endif // GEOMTOOLS_SPHERE_H
311 
312 /*
313 ** Local Variables: --
314 ** mode: c++ --
315 ** c-file-style: "gnu" --
316 ** tab-width: 2 --
317 ** End: --
318 */
double get_start_phi() const
Return the start phi angle.
Definition: sphere.h:52
double get_delta_phi() const
Return the delta angle.
virtual void _build_bounding_data()
Build bounding data.
virtual void tree_dump(std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
Smart print.
void set_delta_phi(double)
Set the delta phi angle.
A sperical sector (2D shape)
Definition: spherical_sector.h:24
double get_ymin() const
double get_zmax() const
A spherical volume (3D solid)
Definition: sphere.h:44
virtual bool is_outside(const vector_3d &, double skin_=GEOMTOOLS_PROPER_TOLERANCE) const
Check if a point is outside the tube.
Right circular conical nappe (2D shape)
Definition: right_circular_conical_nappe.h:29
bool has_delta_theta() const
Check the delta theta angle.
Do not render the external face.
Definition: sphere.h:262
Mother abstract class for all 3D solid shapes.
Definition: i_shape_3d.h:46
friend std::istream & operator>>(std::istream &, sphere &)
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 sphere.
bool is_valid() const
Check the validity of the sphere.
virtual std::string get_shape_name() const
Return the name of the shape.
static const uint32_t bit01
Definition: bit_mask.h:28
friend std::ostream & operator<<(std::ostream &, const sphere &)
double get_zmin() const
Definition: sphere.h:58
Definition: sphere.h:53
static const uint32_t bit03
Definition: bit_mask.h:30
Identifier of a face attached to a solid shape.
Definition: face_identifier.h:32
double get_xmin() const
virtual double get_volume(uint32_t flags_=0) const
Compute the volume.
sphere()
Default constructor.
virtual ~sphere()
Destructor.
Definition: sphere.h:50
double get_r_max() const
static const uint32_t bit04
Definition: bit_mask.h:31
const angular_range & get_phi_domain() const
Return the phi domain (azimuthal angle)
void compute_stop_phi_face(disk &, placement &) const
Compute the stop phi face.
An object that describes the way an object of a given class can be configured through properties.
Definition: object_configuration_description.h:234
void compute_start_phi_face(disk &, placement &) const
Compute the start phi face.
Last defined bit.
Definition: sphere.h:267
bool has_start_theta() const
Check the start theta angle.
The face_intercept_info class hosts the parameters of.
Definition: face_intercept_info.h:31
bool has_partial_theta() const
Check if the sector has partial theta angle.
void compute_stop_theta_face(right_circular_conical_nappe &, disk &, placement &) const
Compute the stop face.
void compute_start_theta_face(right_circular_conical_nappe &, disk &, placement &) const
Compute the start theta face.
bool has_r_min() const
virtual double get_surface(uint32_t mask_=FACE_ALL) const
Compute the surface.
#define GEOMTOOLS_PROPER_TOLERANCE
Definition: geomtools_config.h:26
Do not render the stop phi face.
Definition: sphere.h:266
virtual void reset()
Reset the sphere.
Do not render the start phi face.
Definition: sphere.h:265
bool is_orb() const
Do not render the start theta face.
Definition: sphere.h:263
Abstract base stackable object.
Definition: i_stackable.h:32
virtual unsigned int compute_faces(face_info_collection_type &faces_) const
Return a collection of face info objects.
void set_start_phi(double)
Set the start phi angle.
double get_ymax() const
const angular_range & get_theta_domain() const
Return the theta domain (polar angle)
DOCD_CLASS_DECLARATION(my::algo)
Declaration of the OCD support for the my::algo class.
double get_r() const
void compute_start_stop_theta_face(faces_mask_type, right_circular_conical_nappe &, disk &, placement &) const
Compute the start/stop theta face.
virtual double get_parameter(const std::string &) const
Return the value of some parameter.
void set_r(double)
void set_start_theta(double)
Set the start theta angle.
sphere_wires_rendering_option_type
3D rendering options
Definition: sphere.h:260
void set_r_max(double)
Do not render the stop theta face.
Definition: sphere.h:264
static const face_identifier & face_bits_any()
Return a singleton face identifier with any bit.
double get_r_min() const
double get_xmax() const
std::map< std::string, object_entry > handle_dict_type
Dictionary of handle of 3D object entries.
Definition: i_object_3d.h:124
Definition: sphere.h:51
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
Angular range.
Definition: angular_range.h:33
static const uint32_t bit05
Definition: bit_mask.h:32
void compute_start_stop_phi_face(faces_mask_type, disk &, placement &) const
Compute the start/stop phi face.
void compute_inner_side_face(spherical_sector &) const
Compute the inner side face.
void set_phi(double start_phi_, double delta_phi_)
#define GEOMTOOLS_OBJECT_3D_REGISTRATION_INTERFACE(ModelClassName)
Definition: i_object_3d.h:260
virtual bool is_inside(const vector_3d &, double skin_=GEOMTOOLS_PROPER_TOLERANCE) const
Check if a point is inside the tube.
static const std::string & sphere_label()
bool has_partial_phi() const
Check if the sector has partial phi angle.
CLHEP::Hep3Vector vector_3d
Alias for the CLHEP 3D-vector class.
Definition: clhep.h:63
static void init_ocd(datatools::object_configuration_description &)
OCD support.
Last defined bit.
Definition: i_wires_3d_rendering.h:62
The Bayeux/datatools library top-level namespace.
Definition: algo.h:13
double get_radius() const
The placement for a geometry volume with its translation and rotation with respect to some mother ref...
Definition: placement.h:34
void compute_side_face(faces_mask_type, spherical_sector &) const
Compute the side face.
void set_r_min(double)
void compute_outer_side_face(spherical_sector &) const
Compute the outer side face.
void _set_default()
Set default attributes.
void set(double rmax_)
double get_start_theta() const
Return the start theta angle.
Do not render the internal face.
Definition: sphere.h:261
void set_radius(double)
std::list< polyline_type > wires_type
Alias for a list of 3D-polylines.
Definition: utils.h:61
Rendering options bit mask.
Definition: sphere.h:268
static const uint32_t bit00
Definition: bit_mask.h:27
bool has_start_phi() const
Check the start phi angle.
virtual void generate_wires_self(wires_type &wires_, uint32_t options_=0) const
Generate a sequence of polylines for wires 3D rendering.
void set_theta(double start_theta_, double delta_theta_)
virtual void initialize(const datatools::properties &, const handle_dict_type *=0)
Initialize the sphere from properties.
double get_delta_theta() const
Return the delta angle.
bool has_delta_phi() const
Check the delta phi angle.
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
faces_mask_type
Definition: sphere.h:49
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.
A disk/ring sector surface (2D shape)
Definition: disk.h:26
void set_delta_theta(double)
Set the delta theta angle.
Top-level namespace of the Bayeux/geomtools module library.
Definition: electromagnetic_field_manager.h:39
A dictionary of arbitrary properties.
Definition: properties.h:125