Bayeux  3.4.1
Core Foundation library for SuperNEMO
plane.h
Go to the documentation of this file.
1 /* Author(s): Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date: 2012-09-27
4  * Last modified: 2012-09-27
5  *
6  * License:
7  *
8  * Description:
9  *
10  * A plane in 3D cartesian space
11  *
12  * History:
13  *
14  */
15 
16 #ifndef GEOMTOOLS_PLANE_H
17 #define GEOMTOOLS_PLANE_H
18 
19 // This project:
20 #include <geomtools/utils.h>
21 #include <geomtools/i_shape_2d.h>
22 
23 namespace geomtools {
24 
26  class plane : public i_shape_2d
27  {
28  public:
29 
31  static const std::string & plane_label();
32 
34  bool is_valid() const;
35 
37  void initialize(const datatools::properties &, const handle_dict_type * = 0);
38 
40  void reset();
41 
43  double a() const;
44 
46  double b() const;
47 
49  double c() const;
50 
52  double d() const;
53 
56 
58  void set(double a_, double b_, double c_, double d_);
59 
61  void set(const geomtools::vector_3d & point_,
62  const geomtools::vector_3d & normal_);
63 
65  void set(const geomtools::vector_3d & point_,
66  const geomtools::vector_3d & u1_,
67  const geomtools::vector_3d & u2_);
68 
70  plane();
71 
73  plane(double a_, double b_, double c_, double d_);
74 
76  plane(const geomtools::vector_3d & point_,
77  const geomtools::vector_3d & normal_);
78 
80  plane(const geomtools::vector_3d & point_,
81  const geomtools::vector_3d & u1_,
82  const geomtools::vector_3d & u2_);
83 
85  double distance(const geomtools::vector_3d & position_) const;
86 
89 
91  const geomtools::vector_3d & direction_) const;
92 
93  virtual bool is_on_surface(const geomtools::vector_3d & position_,
94  double skin_ = GEOMTOOLS_PROPER_TOLERANCE) const;
95 
96  virtual geomtools::vector_3d
98  bool check_ = true,
99  double skin_ = GEOMTOOLS_PROPER_TOLERANCE) const;
100 
101  virtual bool find_intercept(const geomtools::vector_3d & from_,
102  const geomtools::vector_3d & direction_,
103  face_intercept_info & intercept_,
104  double tolerance_ = GEOMTOOLS_PROPER_TOLERANCE) const;
105 
106  void print_grid(std::ostream & out_, double padding_ = 1.0, int n1_ = 3, int n2_ = 3) const;
107 
108  virtual std::string get_shape_name() const;
109 
111  virtual void generate_wires_self(wires_type & wires_,
112  uint32_t options_ = 0) const;
113 
114  protected:
115 
117  void _set_defaults();
118 
119  private:
120 
121  // a.x + b.y + c.z + d = 0
122  double _a_;
123  double _b_;
124  double _c_;
125  double _d_;
126 
127  };
128 
129 } // end of namespace geomtools
130 
131 #endif // GEOMTOOLS_PLANE_H
132 
133 /*
134 ** Local Variables: --
135 ** mode: c++ --
136 ** c-file-style: "gnu" --
137 ** tab-width: 2 --
138 ** End: --
139 */
double c() const
Return the third parameter.
void reset()
Reset the shape.
double d() const
Return the fourth parameter.
The face_intercept_info class hosts the parameters of.
Definition: face_intercept_info.h:31
geomtools::vector_3d normal() const
Return the normal to the plane.
#define GEOMTOOLS_PROPER_TOLERANCE
Definition: geomtools_config.h:26
virtual bool find_intercept(const geomtools::vector_3d &from_, const geomtools::vector_3d &direction_, face_intercept_info &intercept_, double tolerance_=GEOMTOOLS_PROPER_TOLERANCE) const
double distance(const geomtools::vector_3d &position_) const
Compute the distance from a position to the plane.
bool is_valid() const
Check if the plane is valid.
void _set_defaults()
Set default attributes values.
geomtools::vector_3d orthogonal_projection(const geomtools::vector_3d &position_) const
Compute the orthogonal projection from a position.
A plane (2D shape) in a 3D space.
Definition: plane.h:26
double b() const
Return the second parameter.
std::map< std::string, object_entry > handle_dict_type
Dictionary of handle of 3D object entries.
Definition: i_object_3d.h:124
double a() const
Return the first parameter.
virtual void generate_wires_self(wires_type &wires_, uint32_t options_=0) const
Generate a sequence of polylines for wires 3D rendering.
geomtools::vector_3d projection(const geomtools::vector_3d &position_, const geomtools::vector_3d &direction_) const
plane()
Default constructor.
The abstract base class for all 2D shapes/surfaces.
Definition: i_shape_2d.h:37
CLHEP::Hep3Vector vector_3d
Alias for the CLHEP 3D-vector class.
Definition: clhep.h:63
void initialize(const datatools::properties &, const handle_dict_type *=0)
Initialize from properties and a dictionary of 3D-objects.
virtual geomtools::vector_3d get_normal_on_surface(const geomtools::vector_3d &position_, bool check_=true, double skin_=GEOMTOOLS_PROPER_TOLERANCE) const
std::list< polyline_type > wires_type
Alias for a list of 3D-polylines.
Definition: utils.h:61
void set(double a_, double b_, double c_, double d_)
Set the parameters.
virtual bool is_on_surface(const geomtools::vector_3d &position_, double skin_=GEOMTOOLS_PROPER_TOLERANCE) const
void print_grid(std::ostream &out_, double padding_=1.0, int n1_=3, int n2_=3) const
virtual std::string get_shape_name() const
Return the name of the shape.
static const std::string & plane_label()
Return the identifier label for the class.
Top-level namespace of the Bayeux/geomtools module library.
Definition: electromagnetic_field_manager.h:39
A dictionary of arbitrary properties.
Definition: properties.h:125