Bayeux  3.4.1
Core Foundation library for SuperNEMO
utils.h
Go to the documentation of this file.
1 /* Author(s): Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date: 2008-05-23
4  * Last modified: 2015-02-18
5  *
6  * License:
7  *
8  * Description:
9  *
10  * Utilities.
11  *
12  */
13 
14 #ifndef GEOMTOOLS_UTILS_H
15 #define GEOMTOOLS_UTILS_H 1
16 
17 // Standard library:
18 #include <string>
19 #include <iostream>
20 #include <list>
21 #include <vector>
22 
23 // Third party:
24 // - Bayeux/datatools:
25 #include <datatools/bit_mask.h>
27 
28 // This project:
30 #include <geomtools/clhep.h>
31 
32 namespace geomtools {
33 
35  bool position_is_in(double position_,
36  double start_position_, double delta_position_,
37  double tolerance_ = 0.0,
38  bool bounds_excluded_ = false);
39 
41  bool angle_is_in(double angle_,
42  double start_angle_, double delta_angle_,
43  double angular_tolerance_ = 0.0,
44  bool bounds_excluded_ = false);
45 
47  typedef std::list<vector_2d> basic_polyline_2d;
48 
50  typedef std::pair<vector_3d, vector_3d> basic_segment_3d;
52 
54  typedef std::list<vector_3d> basic_polyline_3d;
55  typedef std::list<vector_3d> polyline_type;
56 
58  typedef std::vector<vector_3d> vertex_col_type;
59 
61  typedef std::list<polyline_type> wires_type;
62 
63  void print_xy(std::ostream & out_,
64  const vector_2d & p_,
65  bool endl_ = true);
66 
67  std::string to_xy(const vector_2d & p_);
68 
69  std::string vector_2d_to_xy(const vector_2d & p_);
70 
71  void print_xy_stdout(const vector_2d & p_);
72 
73  void print_xy_stderr(const vector_2d & p_);
74 
75  void print_xyz(std::ostream & out_,
76  const vector_3d & p_,
77  bool endl_ = true);
78 
79  void print(std::ostream & out_, const vector_3d & p_);
80 
81  std::string to_xyz(const vector_3d & p_);
82 
83  std::string vector_3d_to_xyz(const vector_3d & p_);
84 
85  void print_xyz_stdout(const vector_3d & p_);
86 
87  void print_xyz_stderr(const vector_3d & p_);
88 
89  void set_vector_2d(const std::vector<double> & source_, vector_2d & target_);
90 
91  void set_vector_3d(const std::vector<double> & source_, vector_3d & target_);
92 
106  bool parse(std::istream & in_, vector_3d & position_, bool nothing_more_ = false);
107 
109  bool parse(const std::string & token_, vector_3d & position_);
110 
111  void print_xy(std::ostream & out_,
112  const basic_polyline_2d & p_,
113  bool endl_ = true);
114 
115  std::string to_xy(const basic_polyline_2d & p_);
116 
117  std::string basic_polyline_2d_to_xy(const basic_polyline_2d & p_);
118 
119  void print_xy_stdout(const basic_polyline_2d & p_);
120 
121  void print_xy_stderr(const basic_polyline_2d & p_);
122 
123  void print_xyz(std::ostream & out_,
124  const basic_polyline_3d & p_,
125  bool endl_ = true);
126 
127  std::string to_xyz(const basic_polyline_3d & p_);
128 
129  std::string basic_polyline_3d_to_xyz(const basic_polyline_3d & p_);
130 
131  void print_xyz_stdout(const basic_polyline_3d & p_);
132 
133  void print_xyz_stderr(const basic_polyline_3d & p_);
134 
139  VERTICAL = 0,
142  };
143 
153  };
154 
170  };
171 
172  direction_type get_direction_from_label(const std::string &);
173 
174  std::string get_direction_label(direction_type);
175 
177  VERTEX_NONE = 0x0,
180  };
181 
183  PATH_NONE = 0x0,
186  };
187 
189  SIDE_NONE = 0x0,
195  };
197 
206  };
207 
209 
211  struct constants {
212  static const int NO_INTERCEPT = -1;
213  static const double DEFAULT_TOLERANCE;
214  static const double DEFAULT_ANGULAR_TOLERANCE;
215  static const double ZERO_TOLERANCE;
216  static const double USING_PROPER_TOLERANCE;
217 
218  static double get_default_tolerance();
219  static double get_default_angular_tolerance();
220  static double get_zero_tolerance();
221  static double get_proper_tolerance();
222  };
223 
225  {
226  public:
227 
228  enum filled_type {
233  };
234 
235  static const std::string & filled_none_label();
236  static const std::string & filled_by_envelope_label();
237  static const std::string & filled_by_extrusion_label();
238 
240 
241  static filled_type get_filled_mode(const std::string & filled_label);
242 
243  };
244 
245  /* Initialize a rotation matrix for
246  * "World coordinates system->Local coordinates system":
247  */
248 
264  };
265 
273  void create(rotation_3d & rot_,
274  double angle0_,
275  double angle1_,
276  double angle2_,
277  euler_angles_type et_);
278 
285  void create_zyz(rotation_3d & rot_,
286  double phi_,
287  double theta_,
288  double delta_);
289 
296  void create(rotation_3d & rot_,
297  double phi_,
298  double theta_,
299  double delta_);
300 
302  void create_zxz(rotation_3d & rot_,
303  double phi_,
304  double theta_,
305  double psi_);
306 
308  void create_xyz(rotation_3d & rot_,
309  double phi_,
310  double theta_,
311  double psi_);
312 
319  void create_rotation_3d(rotation_3d & rot_,
320  double phi_,
321  double theta_,
322  double delta_);
323 
331  double phi_,
332  double theta_,
333  double delta_);
334 
341  void create_rotation(rotation_3d & rot_,
342  double phi_,
343  double theta_,
344  double delta_);
345 
347  bool is_identity(const rotation_3d & rot_);
348 
351  double & a_,
352  double & b_,
353  double & c_);
354 
356  // http://www.geometrictools.com/Documentation/EulerAngles.pdf
358  double & a_,
359  double & b_,
360  double & c_);
361 
362  // http://www.cgafaq.info/wiki/Euler_angles_from_matrix
363  // struct extract_euler_angle
364  // {
365  // int i, neg, alt, rev;
366  // extract_euler_angle() {}
367  // };
368 
376  };
377 
379 
380  double get_special_rotation_angle(int);
381 
382  int get_special_rotation_angle_from_label(const std::string & );
383 
384  std::string get_special_rotation_angle_label(int);
385 
387  enum axis_type {
389  AXIS_X = 0,
390  AXIS_Y = 1,
391  AXIS_Z = 2
392  };
393 
400  };
401 
402  bool check_rotation_axis(int);
403 
404  int get_rotation_axis_from_label(const std::string & );
405 
406  std::string get_rotation_label(int);
407 
409  int axis_,
410  double angle_);
411 
412  void create_rotation(rotation_3d & rot_,
413  int axis_,
414  double angle_);
415 
416  void create_rotation(rotation_3d & rot_,
417  int axis_,
418  int special_angle_);
419 
420  void create_rotation_from(rotation_3d & rot_,
421  const std::string &);
422 
424  void reset(rotation_3d & rot_);
425 
427  void reset_rotation_3d(rotation_3d & rot_);
428 
430  void tree_dump(const rotation_3d & rot_,
431  std::ostream & out_,
432  const std::string & title_ = "",
433  const std::string & indent_ = "");
434 
436  void invalidate(rotation_3d & rot_);
437 
439  void rectify(rotation_3d & rot_);
440 
442  void invalidate_rotation_3d(rotation_3d & rot_);
443 
445  bool is_valid(const rotation_3d & rot_);
446 
448  bool is_valid_rotation_3d(const rotation_3d & rot_);
449 
451  void create(vector_3d &,
452  double x_,
453  double y_,
454  double z_);
455 
457  void create_xyz(vector_3d &,
458  double x_,
459  double y_,
460  double z_);
461 
463  void create_polar(vector_3d &,
464  double r_,
465  double theta_,
466  double z_);
467 
470  double r_,
471  double phi_,
472  double theta_);
473 
475  void set(vector_3d & vec_, double x_, double y_, double z_);
476 
478  void set_r_theta_phi(vector_3d & vec_, double r_, double theta_, double phi_);
479 
481  void set_rho_phi_z(vector_3d & vec_, double rho_, double phi_, double z_);
482 
484  void zero(vector_3d & vec_);
485 
487  const vector_3d & invalid_vector_3d();
488 
490  void invalidate(vector_3d & vec_);
491 
493  void invalidate_vector_3d(vector_3d & vec_);
494 
496  bool is_valid(const vector_3d & vec_);
497 
499  bool is_valid_vector_3d(const vector_3d & vec_);
500 
502  bool are_near(const vector_3d & vec1_,
503  const vector_3d & vec2_,
504  double tolerance_ = constants::DEFAULT_TOLERANCE);
505 
507  bool are_near_vector_3d(const vector_3d & vec1_,
508  const vector_3d & vec2_,
509  double tolerance_);
510 
512  void set(vector_2d & vec_, double x_, double y_);
513 
515  void set_r_phi(vector_2d & vec_, double r_, double phi_);
516 
518  void zero(vector_2d & vec_);
519 
521  void invalidate(vector_2d & vec_);
522 
524  void invalidate_vector_2d(vector_2d & vec_);
525 
527  const vector_2d & invalid_vector_2d();
528 
530  bool is_valid(const vector_2d & vec_);
531 
533  bool is_valid_vector_2d(const vector_2d & vec_);
534 
536  void vector_2d_to_vector_3d(const vector_2d & v2d_, vector_3d & v3d_);
537 
539  void vector_3d_to_vector_2d(const vector_3d & v3d_, vector_2d & v2d_);
540 
542  void make_phi_theta(vector_3d & vec_, double phi_, double theta_);
543 
544 #if __GNUC__ >= 7
545 #pragma GCC diagnostic push
546 #pragma GCC diagnostic ignored "-Wnoexcept-type"
547 #endif
548  template <class ran_func>
558  void randomize_direction(ran_func & ran_, vector_3d & ran_dir_)
559  {
560  double phi = 2. * M_PI * ran_();
561  double cos_theta = -1 + 2 * ran_();
562  double sin_theta = std::sqrt(1. - cos_theta * cos_theta);
563  double x = sin_theta * std::cos(phi);
564  double y = sin_theta * std::sin(phi);
565  double z = cos_theta;
566  ran_dir_.set(x, y, z);
567  }
568 #if __GNUC__ >= 7
569 #pragma GCC diagnostic pop
570 #endif
571 
581  template <class ran_func>
583  {
584  vector_3d dir;
585  randomize_direction(ran_, dir);
586  return dir;
587  }
588 
599  template <class ran_func>
600  void randomize_orthogonal_direction(ran_func & ran_,
601  const vector_3d & dir_,
602  vector_3d & ran_dir_)
603  {
604  double theta = 2. * M_PI * ran_();
605  double dx = cos(theta);
606  double dy = sin(theta);
607  double dz = 0.0;
608  double dir_theta = dir_.theta();
609  double dir_phi = dir_.phi();
610  rotation_3d dir_rot;
611  create_rotation_3d(dir_rot, dir_phi, dir_theta, 0.0);
612  rotation_3d dir_inverse_rot;
613  dir_inverse_rot = dir_rot.inverse();
614  vector_3d v(dx, dy, dz);
615  ran_dir_ = v.transform(dir_inverse_rot);
616  return;
617  }
618 
629  template <class ran_func>
631  const vector_3d & ref_dir_)
632  {
633  vector_3d dir;
634  randomize_direction(ran_, ref_dir_, dir);
635  return dir;
636  }
637 
641  void compute_barycenter(const std::vector<vector_3d> & points_,
642  vector_3d & barycenter_);
643 
647  vector_3d compute_barycenter(const std::vector<vector_3d> & points_);
648 
653  void compute_weighted_barycenter(const std::vector<vector_3d> & points_,
654  const std::vector<double> & weights_,
655  vector_3d & weighted_barycenter_);
656 
661  vector_3d compute_weighted_barycenter(const std::vector<vector_3d> & points_,
662  const std::vector<double> & weights_);
663 
666  {
667  public:
668  rotation_wrapper_type(double mxx_, double mxy_, double mxz_,
669  double myx_, double myy_, double myz_,
670  double mzx_, double mzy_, double mzz_)
671  : rotation_3d(mxx_, mxy_, mxz_,
672  myx_, myy_, myz_,
673  mzx_, mzy_, mzz_) {}
674  };
675 
678 
680  struct io
681  {
682  static const std::string & vector_2d_serial_tag();
683  static const std::string & vector_3d_serial_tag();
684  static const std::string & rotation_3d_serial_tag();
685  static const std::string & position_suffix();
686  static const std::string & rotation_suffix();
687  };
688 
689 } // end namespace geomtools
690 
692 namespace boost {
693 
694  namespace serialization {
695 
696  template<class Archive>
697  void save(Archive & a_ar ,
698  const geomtools::vector_3d & v_,
699  const unsigned int a_version);
700 
701  template<class Archive>
702  void load(Archive & a_ar ,
704  const unsigned int a_version);
705 
706  template<class Archive>
707  void serialize(Archive & a_ar,
709  const unsigned int a_version);
710 
711  } // namespace serialization
712 
713 } // namespace boost
714 
716 namespace boost {
717 
718  namespace serialization {
719 
721  template<class Archive>
722  void save(Archive & a_ar ,
723  const geomtools::vector_2d & v_,
724  const unsigned int a_version);
725 
727  template<class Archive>
728  void load(Archive & a_ar ,
730  const unsigned int a_version);
731 
733  template<class Archive>
734  void serialize(Archive & a_ar,
736  const unsigned int a_version);
737 
738  } // namespace serialization
739 
740 } // namespace boost
741 
743 namespace boost {
744 
745  namespace serialization {
746 
748  template<class Archive>
749  void save(Archive & a_ar ,
750  const geomtools::rotation_3d & r_,
751  const unsigned int a_version);
752 
754  template<class Archive>
755  void load(Archive & a_ar ,
756  geomtools::rotation_3d & a_rotation,
757  const unsigned int a_version);
758 
760  template<class Archive>
761  void serialize(Archive & a_ar,
762  geomtools::rotation_3d & a_rotation,
763  const unsigned int a_version);
764 
765  } // namespace serialization
766 
767 } // namespace boost
768 
769 // Activate reflection layer for some 'geomtools::XXX' enums:
774 
775 #endif // GEOMTOOLS_UTILS_H
776 
777 /*
778 ** Local Variables: --
779 ** mode: c++ --
780 ** c-file-style: "gnu" --
781 ** tab-width: 2 --
782 ** End: --
783 */
180° rotation angle
Definition: utils.h:374
void create_polar(vector_3d &, double r_, double theta_, double z_)
Create/set coordinates of a vector 3D object (polar)
ZXY Tait-Bryan angles.
Definition: utils.h:260
void reset_rotation_3d(rotation_3d &rot_)
Invalidate a rotation 3D object.
Definition: utils.h:191
+x direction
Definition: utils.h:160
YZY classic Euler angles.
Definition: utils.h:254
void create_zxz(rotation_3d &rot_, double phi_, double theta_, double psi_)
Create a rotation using ZXZ Euler angles.
XZY Tait-Bryan angles.
Definition: utils.h:261
vertex_1d_type
Definition: utils.h:176
Z axis.
Definition: utils.h:391
void save(Archive &a_ar, const geomtools::vector_3d &v_, const unsigned int a_version)
void invalidate(rotation_3d &rot_)
Invalidate a rotation 3D object.
bool check_special_rotation_angle(int)
void set_r_theta_phi(vector_3d &vec_, double r_, double theta_, double phi_)
Set coordinates of a vector 3D object (spherical)
Serialization stuff for CLHEP 'vector_3d'.
Definition: portable_archive_exception.hpp:27
void zero(vector_3d &vec_)
Zero a vector 3D object.
void print_xy_stderr(const vector_2d &p_)
void print_xy_stdout(const vector_2d &p_)
void load(Archive &a_ar, geomtools::vector_3d &v_, const unsigned int a_version)
int get_special_rotation_angle_from_label(const std::string &)
Definition: utils.h:184
Definition: utils.h:192
static const std::string & filled_none_label()
void make_phi_theta(vector_3d &vec_, double phi_, double theta_)
Create a vector 3D object from spherical angular coordinates (magnitude is set to 1)
double get_special_rotation_angle(int)
Definition: utils.h:193
void extract_zyz_euler_angle_from_rotation(const rotation_3d &rot_, double &a_, double &b_, double &c_)
Extract the ZYZ Euler angles from a rotation.
bool are_near_vector_3d(const vector_3d &vec1_, const vector_3d &vec2_, double tolerance_)
Check if two vector 3D objects are close to each other given a tolerance.
std::string to_xyz(const vector_3d &p_)
static const uint32_t bit01
Definition: bit_mask.h:28
Definition: utils.h:179
void create_spherical(vector_3d &, double r_, double phi_, double theta_)
Create/set coordinates of a vector 3D object (spherical)
orientation_type
Orientation constants.
Definition: utils.h:136
std::string shape_domain_flag_label(shape_domain_flags_type flag_)
void vector_3d_to_vector_2d(const vector_3d &v3d_, vector_2d &v2d_)
Convert a vector 3D object to a vector 2D object (export only x and y coordinates)
static const uint32_t bit03
Definition: bit_mask.h:30
CLHEP::Hep2Vector vector_2d
Alias for the CLHEP 2D-vector class.
Definition: clhep.h:60
Definition: utils.h:201
ZXZ classic Euler angles.
Definition: utils.h:252
void invalidate_vector_2d(vector_2d &vec_)
Invalidate a vector 2D object.
Horizontal orientation.
Definition: utils.h:141
Null rotation angle.
Definition: utils.h:372
static const std::string & vector_2d_serial_tag()
const vector_3d & invalid_vector_3d()
Return an invalid vector 3D object (static singleton)
std::string vector_2d_to_xy(const vector_2d &p_)
void set(vector_3d &vec_, double x_, double y_, double z_)
Set coordinates of a vector 3D object (cartesian)
Invalid direction.
Definition: utils.h:157
90° rotation angle
Definition: utils.h:373
bool are_near(const vector_3d &vec1_, const vector_3d &vec2_, double tolerance_=constants::DEFAULT_TOLERANCE)
Check if two vector 3D objects are close to each other given a tolerance.
void serialize(Archive &a_ar, geomtools::vector_3d &v_, const unsigned int a_version)
+x direction
Definition: utils.h:148
-x direction
Definition: utils.h:147
static const uint32_t bit04
Definition: bit_mask.h:31
void set_rho_phi_z(vector_3d &vec_, double rho_, double phi_, double z_)
Set coordinates of a vector 3D object (polar)
std::list< vector_3d > basic_polyline_3d
Aliases for a list of 3D vertice as a 3D-polyline.
Definition: utils.h:54
static const double DEFAULT_ANGULAR_TOLERANCE
Definition: utils.h:214
YZX Tait-Bryan angles.
Definition: utils.h:259
+y direction
Definition: utils.h:165
static const double ZERO_TOLERANCE
Definition: utils.h:215
Horizontal orientation.
Definition: utils.h:140
void set_r_phi(vector_2d &vec_, double r_, double phi_)
Set coordinates of a vector 2D object (polar)
-y direction
Definition: utils.h:163
+z direction
Definition: utils.h:152
direction_flags_type
Direction flags.
Definition: utils.h:145
std::string basic_polyline_3d_to_xyz(const basic_polyline_3d &p_)
std::list< vector_2d > basic_polyline_2d
Alias for a list of 2D vertice as a 2D-polyline.
Definition: utils.h:47
static const std::string & filled_by_extrusion_label()
void set_vector_2d(const std::vector< double > &source_, vector_2d &target_)
I/O constants for the serialization of vector(2D/3D) and rotation objects.
Definition: utils.h:680
Vertical orientation.
Definition: utils.h:139
YXZ Tait-Bryan angles.
Definition: utils.h:263
Invalid orientation.
Definition: utils.h:137
rotation_axis_type
Rotation axis type.
Definition: utils.h:395
YXY classic Euler angles.
Definition: utils.h:257
bool angle_is_in(double angle_, double start_angle_, double delta_angle_, double angular_tolerance_=0.0, bool bounds_excluded_=false)
Check if an angle is inside an angular interval.
bool is_valid(const rotation_3d &rot_)
Check if a rotation 3D object is valid.
XZX classic Euler angles.
Definition: utils.h:256
shape_domain_flags_type
Flags determining the position of a point with respect to a 3D shape.
Definition: utils.h:199
static const std::string & rotation_3d_serial_tag()
Wrapper for rotation object.
Definition: utils.h:665
void print_xyz(std::ostream &out_, const vector_3d &p_, bool endl_=true)
Definition: utils.h:190
static std::string get_filled_mode_label(filled_utils::filled_type)
rotation_wrapper_type(double mxx_, double mxy_, double mxz_, double myx_, double myy_, double myz_, double mzx_, double mzy_, double mzz_)
Definition: utils.h:668
Definition: utils.h:183
void compute_barycenter(const std::vector< vector_3d > &points_, vector_3d &barycenter_)
bool check_rotation_axis(int)
void create_rotation_3d(rotation_3d &rot_, double phi_, double theta_, double delta_)
static filled_type get_filled_mode(const std::string &filled_label)
Definition: utils.h:200
Y rotation axis.
Definition: utils.h:398
static const std::string & position_suffix()
+z direction
Definition: utils.h:168
std::string vector_3d_to_xyz(const vector_3d &p_)
filled_type
Definition: utils.h:228
void print_xyz_stderr(const vector_3d &p_)
Z rotation axis.
Definition: utils.h:399
static const std::string & filled_by_envelope_label()
Definition: utils.h:203
Definition: utils.h:177
static const uint32_t nbits31
Definition: bit_mask.h:91
Definition: utils.h:178
-z direction
Definition: utils.h:151
direction_type
Direction type.
Definition: utils.h:156
Definition: utils.h:224
Invalid rotation axis.
Definition: utils.h:396
bool position_is_in(double position_, double start_position_, double delta_position_, double tolerance_=0.0, bool bounds_excluded_=false)
Check if a position is inside a position interval.
std::string get_direction_label(direction_type)
std::string basic_polyline_2d_to_xy(const basic_polyline_2d &p_)
void invalidate_rotation_3d(rotation_3d &rot_)
Invalidate a rotation 3D object.
void print_xyz_stdout(const vector_3d &p_)
void print_xy(std::ostream &out_, const vector_2d &p_, bool endl_=true)
static double get_default_tolerance()
static const std::string & vector_3d_serial_tag()
static const uint32_t bit02
Definition: bit_mask.h:29
static const uint32_t bit05
Definition: bit_mask.h:32
bool is_identity(const rotation_3d &rot_)
Check if a rotation is the identity.
-x direction
Definition: utils.h:159
void create_rotation(rotation_3d &rot_, double phi_, double theta_, double delta_)
Definition: utils.h:146
Definition: utils.h:185
Invalid special rotation angle.
Definition: utils.h:371
void tree_dump(const rotation_3d &rot_, std::ostream &out_, const std::string &title_="", const std::string &indent_="")
Smart print for rotation 3D object.
+y direction
Definition: utils.h:150
void invalidate_vector_3d(vector_3d &vec_)
Invalidate a vector 3D object.
Invalid Euler angles.
Definition: utils.h:251
XYX classic Euler angles.
Definition: utils.h:253
-y direction
Definition: utils.h:149
270° rotation angle
Definition: utils.h:375
CLHEP::HepRotation rotation_3d
Alias for the CLHEP 3D-rotation class.
Definition: clhep.h:66
X rotation axis.
Definition: utils.h:397
-y direction
Definition: utils.h:166
std::string get_rotation_label(int)
bool parse(std::istream &in_, vector_3d &position_, bool nothing_more_=false)
Parse a vector 3D object from an input stream.
void randomize_orthogonal_direction(ran_func &ran_, const vector_3d &dir_, vector_3d &ran_dir_)
Isotropically randomize the direction of an unit vector orthogonal to a given direction.
Definition: utils.h:600
CLHEP::Hep3Vector vector_3d
Alias for the CLHEP 3D-vector class.
Definition: clhep.h:63
-x direction
Definition: utils.h:158
void create_zyz(rotation_3d &rot_, double phi_, double theta_, double delta_)
Vertical orientation.
Definition: utils.h:138
-y direction
Definition: utils.h:162
rotation_wrapper_type rotation_wrapper_t
Type alias.
Definition: utils.h:677
+x direction
Definition: utils.h:161
X axis.
Definition: utils.h:389
ZYX Tait-Bryan angles.
Definition: utils.h:262
void rectify(rotation_3d &rot_)
Rectify a rotation 3D object.
+z direction
Definition: utils.h:169
static const double DEFAULT_TOLERANCE
Definition: utils.h:213
XYZ Tait-Bryan angles.
Definition: utils.h:258
Definition: utils.h:202
bool is_valid_rotation_3d(const rotation_3d &rot_)
Check if a rotation 3D object is valid.
std::list< vector_3d > polyline_type
Definition: utils.h:55
direction_type get_direction_from_label(const std::string &)
static double get_proper_tolerance()
bool is_valid_vector_2d(const vector_2d &vec_)
Check if a vector 2D object is valid.
-y direction
Definition: utils.h:167
void print(std::ostream &out_, const vector_3d &p_)
Y axis.
Definition: utils.h:390
ZYZ classic Euler angles.
Definition: utils.h:255
static const int NO_INTERCEPT
Definition: utils.h:212
basic_segment_3d segment_type
Definition: utils.h:51
std::vector< vector_3d > vertex_col_type
Aliases for an ordered collection of 3D vertice.
Definition: utils.h:58
path_1d_type
Definition: utils.h:182
std::list< polyline_type > wires_type
Alias for a list of 3D-polylines.
Definition: utils.h:61
#define DR_TYPE_INIT(Introspectable)
Definition: reflection_interface.h:165
static double get_default_angular_tolerance()
Definition: utils.h:194
euler_angles_type
Type of Euler angles.
Definition: utils.h:250
std::string to_xy(const vector_2d &p_)
void randomize_direction(ran_func &ran_, vector_3d &ran_dir_)
Isotropically randomize the direction of an unit vector.
Definition: utils.h:558
void set_vector_3d(const std::vector< double > &source_, vector_3d &target_)
static const uint32_t bit00
Definition: bit_mask.h:27
void create_rotation_from(rotation_3d &rot_, const std::string &)
void create_xyz(rotation_3d &rot_, double phi_, double theta_, double psi_)
Create a rotation using XYZ Euler angles.
+y direction
Definition: utils.h:164
static const double USING_PROPER_TOLERANCE
Definition: utils.h:216
void vector_2d_to_vector_3d(const vector_2d &v2d_, vector_3d &v3d_)
Convert a vector 2D object to a vector 3D object (export x and y coordinates, setting z to zero)
void create_rotation_from_axis(rotation_3d &rot_, int axis_, double angle_)
bool is_valid_vector_3d(const vector_3d &vec_)
Check if a vector 3D object is valid.
std::string get_special_rotation_angle_label(int)
side_2d_type edge_2d_type
Definition: utils.h:196
const vector_2d & invalid_vector_2d()
Return an invalid vector 2D object (static singleton)
Invalid axis.
Definition: utils.h:388
void create(rotation_3d &rot_, double angle0_, double angle1_, double angle2_, euler_angles_type et_)
axis_type
Axis type.
Definition: utils.h:387
void reset(rotation_3d &rot_)
Invalidate a rotation 3D object.
Definition: utils.h:189
side_2d_type
Definition: utils.h:188
void extract_xyz_euler_angle_from_rotation(const rotation_3d &rot_, double &a_, double &b_, double &c_)
Extract the XYZ Euler angles from a rotation.
void create_rotation_from_zyz_euler_angles(rotation_3d &rot_, double phi_, double theta_, double delta_)
void compute_weighted_barycenter(const std::vector< vector_3d > &points_, const std::vector< double > &weights_, vector_3d &weighted_barycenter_)
static double get_zero_tolerance()
std::pair< vector_3d, vector_3d > basic_segment_3d
Aliases for a segment made of two 3D vertice.
Definition: utils.h:50
special_rotation_angle_type
Special rotation angle values.
Definition: utils.h:370
int get_rotation_axis_from_label(const std::string &)
Some constants.
Definition: utils.h:211
static const std::string & rotation_suffix()
Top-level namespace of the Bayeux/geomtools module library.
Definition: electromagnetic_field_manager.h:39