Bayeux  3.4.1
Core Foundation library for SuperNEMO
torus.h
Go to the documentation of this file.
1 /* Author(s): F. Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date: 2016-02-18
4  * Last modified: 2016-02-19
5  *
6  * License:
7  *
8  * Description:
9  * 3D solid torus sector
10  *
11  * History:
12  *
13  */
14 
15 #ifndef GEOMTOOLS_TORUS_H
16 #define GEOMTOOLS_TORUS_H 1
17 
18 // Standard library:
19 #include <iostream>
20 #include <string>
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 
31 namespace datatools {
32  // Forward class declaration:
33  class properties;
34 }
35 
36 namespace geomtools {
37 
38  // Forward class declarations:
39  class toroid_nappe;
40  class disk;
41 
43  class torus : public i_shape_3d,
44  public i_stackable
45  {
46  public:
47 
56  | FACE_OUTSIDE
58  | FACE_STOP_PHI)
59  };
60 
62  static const std::string & torus_label();
63 
66  toroid_nappe & face_,
67  placement & face_placement_) const;
68 
71  disk & face_,
72  placement & face_placement_) const;
73 
75  virtual unsigned int compute_faces(face_info_collection_type & faces) const;
76 
78  double get_xmin () const;
79 
81  double get_xmax () const;
82 
84  double get_ymin () const;
85 
87  double get_ymax () const;
88 
90  double get_zmin () const;
91 
93  double get_zmax () const;
94 
96  double get_sweep_radius() const;
97 
99  void set_sweep_radius(double);
100 
102  bool has_inside_radius() const;
103 
105  double get_inside_radius () const;
106 
108  void set_inside_radius (double);
109 
111  double get_outside_radius () const;
112 
114  void set_outside_radius (double);
115 
117  void set(double sweep_radius_, double outside_radius_, double inside_radius_, double start_phi_, double delta_phi_);
118 
120  void set(double sweep_radius_, double outside_radius_, double inside_radius_ = 0.0);
121 
123  void set_phi(double start_phi_, double delta_phi_);
124 
126  bool has_partial_phi() const;
127 
129  bool has_start_phi() const;
130 
132  void set_start_phi(double);
133 
135  double get_start_phi() const;
136 
138  bool has_delta_phi() const;
139 
141  void set_delta_phi(double);
142 
144  double get_delta_phi() const;
145 
147  torus();
148 
150  torus(double sweep_radius_, double outside_radius_, double inside_radius_);
151 
153  torus(double sweep_radius_, double outside_radius_, double inside_radius_, double start_phi_, double delta_phi_);
154 
156  virtual ~torus();
157 
159  virtual std::string get_shape_name () const;
160 
162  virtual double get_parameter (const std::string &) const;
163 
165  bool is_valid () const;
166 
168  virtual void initialize(const datatools::properties &,
169  const handle_dict_type *);
170 
172  virtual void reset();
173 
175  virtual double get_surface (uint32_t mask_ = FACE_ALL) const;
176 
178  virtual double get_volume (uint32_t flags_ = 0) const;
179 
181  virtual bool is_inside (const vector_3d &,
182  double skin_ = GEOMTOOLS_PROPER_TOLERANCE) const;
183 
185  virtual bool is_outside (const vector_3d &,
186  double skin_ = GEOMTOOLS_PROPER_TOLERANCE) const;
187 
189  virtual face_identifier on_surface(const vector_3d &,
190  const face_identifier & a_surface_mask = face_identifier::face_bits_any(),
191  double a_skin = GEOMTOOLS_PROPER_TOLERANCE) const;
192 
194  virtual vector_3d get_normal_on_surface(const vector_3d & a_position,
195  const face_identifier & a_surface_bit) const;
196 
198  virtual bool find_intercept (const vector_3d & from_,
199  const vector_3d & direction_,
200  face_intercept_info & intercept_,
201  double skin_ = GEOMTOOLS_PROPER_TOLERANCE) const;
202 
203  friend std::ostream &
204  operator<< (std::ostream &, const torus &);
205 
206  friend std::istream &
207  operator>> (std::istream &, torus &);
208 
210  virtual void tree_dump (std::ostream & out_ = std::clog,
211  const std::string & title_ = "",
212  const std::string & indent_ = "",
213  bool inherit_ = false) const;
214 
226  };
227 
229  virtual void generate_wires_self(wires_type & wires_,
230  uint32_t options_ = 0) const;
231 
234 
235  protected:
236 
238  void _set_defaults();
239 
241  virtual void _build_bounding_data();
242 
243  private:
244 
245  double _sweep_radius_;
246  double _inside_radius_;
247  double _outside_radius_;
248  angular_range _phi_domain_;
249 
250  // Registration interface :
252 
253  };
254 
255 } // end of namespace geomtools
256 
258 // @arg geomtools::torus the name the class
260 
261 #endif // GEOMTOOLS_TORUS_H
262 
263 /*
264 ** Local Variables: --
265 ** mode: c++ --
266 ** c-file-style: "gnu" --
267 ** tab-width: 2 --
268 ** End: --
269 */
bool has_delta_phi() const
Check the delta phi.
virtual void initialize(const datatools::properties &, const handle_dict_type *)
Initialize from properties.
virtual unsigned int compute_faces(face_info_collection_type &faces) const
Compute informations about the faces of this solid shape.
double get_inside_radius() const
Return the inside radius.
Definition: torus.h:54
Mother abstract class for all 3D solid shapes.
Definition: i_shape_3d.h:46
void set_delta_phi(double)
Set the delta phi.
The 3D shape model for a solid torus.
Definition: torus.h:43
void set_sweep_radius(double)
Set the radius of the solid torus.
static const uint32_t bit01
Definition: bit_mask.h:28
void compute_start_stop_phi_face(faces_mask_type face_id_, disk &face_, placement &face_placement_) const
Compute the start/stop phi face and placement.
static const uint32_t bit03
Definition: bit_mask.h:30
Identifier of a face attached to a solid shape.
Definition: face_identifier.h:32
Definition: torus.h:52
Do not render the outside face.
Definition: torus.h:218
double get_zmin() const
Return the min Z coordinates (bounding box)
Rendering options bit mask.
Definition: torus.h:222
Definition: torus.h:55
virtual std::string get_shape_name() const
Return the name of the shape.
Definition: torus.h:50
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.
An object that describes the way an object of a given class can be configured through properties.
Definition: object_configuration_description.h:234
Do not render the inside face.
Definition: torus.h:217
torus_wires_rendering_option_type
3D rendering options
Definition: torus.h:216
double get_zmax() const
Return the max Z coordinates (bounding box)
The face_intercept_info class hosts the parameters of.
Definition: face_intercept_info.h:31
Definition: torus.h:51
#define GEOMTOOLS_PROPER_TOLERANCE
Definition: geomtools_config.h:26
static const std::string & torus_label()
Return the solid torus shape label.
Abstract base stackable object.
Definition: i_stackable.h:32
friend std::ostream & operator<<(std::ostream &, const torus &)
virtual double get_parameter(const std::string &) const
Return a parameter by name.
bool has_inside_radius() const
Check inside radius.
DOCD_CLASS_DECLARATION(my::algo)
Declaration of the OCD support for the my::algo class.
void set_start_phi(double)
Set the start phi.
static const face_identifier & face_bits_any()
Return a singleton face identifier with any bit.
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 double get_volume(uint32_t flags_=0) const
Compute the volume of the cylinder.
bool is_valid() const
Check the validity.
std::map< std::string, object_entry > handle_dict_type
Dictionary of handle of 3D object entries.
Definition: i_object_3d.h:124
virtual void generate_wires_self(wires_type &wires_, uint32_t options_=0) const
Generate a sequence of polylines for wires 3D rendering.
virtual ~torus()
Destructor.
static const uint32_t bit02
Definition: bit_mask.h:29
double get_xmax() const
Return the max X coordinates (bounding box)
static const uint32_t FACE_BITS_NONE
No valid or known face bit.
Definition: face_identifier.h:45
bool has_partial_phi() const
Check if the sector has partial phi.
Angular range.
Definition: angular_range.h:33
void set(double sweep_radius_, double outside_radius_, double inside_radius_, double start_phi_, double delta_phi_)
Set the dimensions and angular limits.
static void init_ocd(datatools::object_configuration_description &)
OCD support.
double get_delta_phi() const
Return the delta phi.
void set_outside_radius(double)
Set the outside radius.
void set_phi(double start_phi_, double delta_phi_)
Set phis.
#define GEOMTOOLS_OBJECT_3D_REGISTRATION_INTERFACE(ModelClassName)
Definition: i_object_3d.h:260
double get_start_phi() const
Return the start phi.
faces_mask_type
Masks used for the faces of the solid torus.
Definition: torus.h:49
torus()
Default constructor.
virtual bool is_inside(const vector_3d &, double skin_=GEOMTOOLS_PROPER_TOLERANCE) const
Check if a point is inside the cylinder.
virtual void tree_dump(std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
Smart print.
void compute_inside_outside_face(faces_mask_type face_id_, toroid_nappe &face_, placement &face_placement_) const
Compute the inside/outside face and placement.
CLHEP::Hep3Vector vector_3d
Alias for the CLHEP 3D-vector class.
Definition: clhep.h:63
A toroid nappe (2D shape)
Definition: toroid_nappe.h:24
double get_xmin() const
Return the min 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.
Last defined bit.
Definition: i_wires_3d_rendering.h:62
The Bayeux/datatools library top-level namespace.
Definition: algo.h:13
virtual void reset()
Reset.
The placement for a geometry volume with its translation and rotation with respect to some mother ref...
Definition: placement.h:34
double get_ymin() const
Return the min Y coordinates (bounding box)
double get_ymax() const
Return the max Y coordinates (bounding box)
void set_inside_radius(double)
Set the inside radius.
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.
double get_sweep_radius() const
Return the radius of the solid torus.
Last defined bit.
Definition: torus.h:221
bool has_start_phi() const
Check the start phi.
std::list< polyline_type > wires_type
Alias for a list of 3D-polylines.
Definition: utils.h:61
virtual double get_surface(uint32_t mask_=FACE_ALL) const
Compute the surface of the cylinder.
virtual void _build_bounding_data()
Build bounding data.
static const uint32_t bit00
Definition: bit_mask.h:27
friend std::istream & operator>>(std::istream &, torus &)
double get_outside_radius() const
Return the outside radius.
void _set_defaults()
Set default attributes.
Definition: torus.h:53
std::vector< face_info > face_info_collection_type
Type alias for a collection of face information objects.
Definition: face_info.h:168
Do not render the start phi face.
Definition: torus.h:219
Do not render the stop phi face.
Definition: torus.h:220
A disk/ring sector surface (2D shape)
Definition: disk.h:26
Top-level namespace of the Bayeux/geomtools module library.
Definition: electromagnetic_field_manager.h:39
A dictionary of arbitrary properties.
Definition: properties.h:125