g4tools  5.4.0
bbox_action
Go to the documentation of this file.
1 // Copyright (C) 2010, Guy Barrand. All rights reserved.
2 // See the file tools.license for terms.
3 
4 #ifndef tools_sg_bbox_action
5 #define tools_sg_bbox_action
6 
7 #include "matrix_action"
8 #include "primitive_visitor"
9 
10 #include "../lina/box3f"
11 
12 namespace tools {
13 namespace sg {
14 
17 protected:
18  virtual bool project(float& a_x,float& a_y,float& a_z,float& a_w) {
19  model_point(a_x,a_y,a_z,a_w);
20  return true;
21  }
22 
23  virtual bool add_point(float a_x,float a_y,float a_z,float) {
24  m_box.extend_by(a_x,a_y,a_z);
25  return true;
26  }
27 
28  virtual bool add_point(float a_x,float a_y,float a_z,float,
29  float,float,float,float) {
30  m_box.extend_by(a_x,a_y,a_z);
31  return true;
32  }
33 
34  virtual bool add_line(float a_bx,float a_by,float a_bz,float,
35  float a_ex,float a_ey,float a_ez,float) {
36  m_box.extend_by(a_bx,a_by,a_bz);
37  m_box.extend_by(a_ex,a_ey,a_ez);
38  return true;
39  }
40 
41  virtual bool add_line(float a_bx,float a_by,float a_bz,float a_bw,
42  float,float,float,float,
43  float a_ex,float a_ey,float a_ez,float a_ew,
44  float,float,float,float) {
45  return add_line(a_bx,a_by,a_bz,a_bw,
46  a_ex,a_ey,a_ez,a_ew);
47  }
48 
49  virtual bool add_triangle(float a_p1x,float a_p1y,float a_p1z,float,
50  float a_p2x,float a_p2y,float a_p2z,float,
51  float a_p3x,float a_p3y,float a_p3z,float){
52  m_box.extend_by(a_p1x,a_p1y,a_p1z);
53  m_box.extend_by(a_p2x,a_p2y,a_p2z);
54  m_box.extend_by(a_p3x,a_p3y,a_p3z);
55  return true;
56  }
57 
58  virtual bool add_triangle(float a_p1x,float a_p1y,float a_p1z,float a_p1w,
59  float,float,float,float,
60  float a_p2x,float a_p2y,float a_p2z,float a_p2w,
61  float,float,float,float,
62  float a_p3x,float a_p3y,float a_p3z,float a_p3w,
63  float,float,float,float){
64  return bbox_action::add_triangle(a_p1x,a_p1y,a_p1z,a_p1w,
65  a_p2x,a_p2y,a_p2z,a_p2w,
66  a_p3x,a_p3y,a_p3z,a_p3w);
67  }
68 
69  virtual bool project_normal(float&,float&,float&) {return true;}
70  virtual bool add_point_normal(float a_x,float a_y,float a_z,float a_w,
71  float,float,float) {
72  return bbox_action::add_point(a_x,a_y,a_z,a_w);
73  }
74 
75  virtual bool add_point_normal(float a_x,float a_y,float a_z,float a_w,
76  float,float,float,
77  float,float,float,float) {
78  return bbox_action::add_point(a_x,a_y,a_z,a_w);
79  }
80 
81  virtual bool add_line_normal(float a_bx,float a_by,float a_bz,float a_bw, float,float,float,
82  float a_ex,float a_ey,float a_ez,float a_ew, float,float,float) {
83  return bbox_action::add_line(a_bx,a_by,a_bz,a_bw,a_ex,a_ey,a_ez,a_ew);
84  }
85  virtual bool add_line_normal(float a_bx,float a_by,float a_bz,float a_bw, float,float,float, float,float,float,float,
86  float a_ex,float a_ey,float a_ez,float a_ew, float,float,float, float,float,float,float) {
87  return bbox_action::add_line(a_bx,a_by,a_bz,a_bw,a_ex,a_ey,a_ez,a_ew);
88  }
89 
90  virtual bool add_triangle_normal(float a_p1x,float a_p1y,float a_p1z,float a_p1w, float,float,float,
91  float a_p2x,float a_p2y,float a_p2z,float a_p2w, float,float,float,
92  float a_p3x,float a_p3y,float a_p3z,float a_p3w, float,float,float) {
93  return bbox_action::add_triangle(a_p1x,a_p1y,a_p1z,a_p1w,
94  a_p2x,a_p2y,a_p2z,a_p2w,
95  a_p3x,a_p3y,a_p3z,a_p3w);
96  }
97  virtual bool add_triangle_normal(float a_p1x,float a_p1y,float a_p1z,float a_p1w,
98  float,float,float, float,float,float,float,
99  float a_p2x,float a_p2y,float a_p2z,float a_p2w,
100  float,float,float, float,float,float,float,
101  float a_p3x,float a_p3y,float a_p3z,float a_p3w,
102  float,float,float, float,float,float,float) {
103  return bbox_action::add_triangle(a_p1x,a_p1y,a_p1z,a_p1w,
104  a_p2x,a_p2y,a_p2z,a_p2w,
105  a_p3x,a_p3y,a_p3z,a_p3w);
106  }
107 public:
108  bbox_action(std::ostream& a_out)
109  :parent(a_out,0,0)
110  {}
111  virtual ~bbox_action(){}
112 public:
113  bbox_action(const bbox_action& a_from)
114  :parent(a_from)
115  ,primitive_visitor(a_from)
116  {}
118  if(&a_from==this) return *this;
119  parent::operator=(a_from);
121  m_box.make_empty();
122  return *this;
123  }
124 public:
125  void reset() {
126  parent::reset();
127  m_box.make_empty();
128  }
129  const box3f& box() const {return m_box;}
130  box3f& box() {return m_box;}
131 protected:
133 };
134 
135 }}
136 
137 #endif
tools::sg::bbox_action::add_point_normal
virtual bool add_point_normal(float a_x, float a_y, float a_z, float a_w, float, float, float)
Definition: bbox_action:70
tools::sg::bbox_action::add_triangle
virtual bool add_triangle(float a_p1x, float a_p1y, float a_p1z, float a_p1w, float, float, float, float, float a_p2x, float a_p2y, float a_p2z, float a_p2w, float, float, float, float, float a_p3x, float a_p3y, float a_p3z, float a_p3w, float, float, float, float)
Definition: bbox_action:58
tools::sg::matrix_action::model_point
void model_point(float &a_x, float &a_y, float &a_z, float &a_w)
Definition: matrix_action:95
primitive_visitor
tools::sg::bbox_action::box
const box3f & box() const
Definition: bbox_action:129
tools::sg::bbox_action::operator=
bbox_action & operator=(const bbox_action &a_from)
Definition: bbox_action:117
tools::box3f::make_empty
void make_empty()
Definition: box3f:26
tools::sg::bbox_action::add_line
virtual bool add_line(float a_bx, float a_by, float a_bz, float, float a_ex, float a_ey, float a_ez, float)
Definition: bbox_action:34
tools::sg::bbox_action::add_triangle_normal
virtual bool add_triangle_normal(float a_p1x, float a_p1y, float a_p1z, float a_p1w, float, float, float, float, float, float, float, float a_p2x, float a_p2y, float a_p2z, float a_p2w, float, float, float, float, float, float, float, float a_p3x, float a_p3y, float a_p3z, float a_p3w, float, float, float, float, float, float, float)
Definition: bbox_action:97
tools::sg::bbox_action
Definition: bbox_action:15
tools::sg::matrix_action
Definition: matrix_action:15
tools::sg::bbox_action::~bbox_action
virtual ~bbox_action()
Definition: bbox_action:111
tools::sg::bbox_action::bbox_action
bbox_action(std::ostream &a_out)
Definition: bbox_action:108
tools::box3::extend_by
void extend_by(const VEC3 &a_point)
Definition: box3:94
matrix_action
tools::sg::primitive_visitor::operator=
primitive_visitor & operator=(const primitive_visitor &)
Definition: primitive_visitor:61
tools::sg::bbox_action::add_line_normal
virtual bool add_line_normal(float a_bx, float a_by, float a_bz, float a_bw, float, float, float, float, float, float, float, float a_ex, float a_ey, float a_ez, float a_ew, float, float, float, float, float, float, float)
Definition: bbox_action:85
TOOLS_ACTION
#define TOOLS_ACTION(a__class, a__sclass, a__parent)
Definition: action:60
tools::sg::bbox_action::add_triangle_normal
virtual bool add_triangle_normal(float a_p1x, float a_p1y, float a_p1z, float a_p1w, float, float, float, float a_p2x, float a_p2y, float a_p2z, float a_p2w, float, float, float, float a_p3x, float a_p3y, float a_p3z, float a_p3w, float, float, float)
Definition: bbox_action:90
tools::sg::bbox_action::project_normal
virtual bool project_normal(float &, float &, float &)
Definition: bbox_action:69
tools::sg::bbox_action::project
virtual bool project(float &a_x, float &a_y, float &a_z, float &a_w)
Definition: bbox_action:18
tools::sg::bbox_action::reset
void reset()
Definition: bbox_action:125
tools
inlined C code : ///////////////////////////////////
Definition: aida_ntuple:26
tools::sg::bbox_action::m_box
box3f m_box
Definition: bbox_action:132
tools::sg::bbox_action::add_point
virtual bool add_point(float a_x, float a_y, float a_z, float)
Definition: bbox_action:23
tools::sg::bbox_action::add_line
virtual bool add_line(float a_bx, float a_by, float a_bz, float a_bw, float, float, float, float, float a_ex, float a_ey, float a_ez, float a_ew, float, float, float, float)
Definition: bbox_action:41
tools::sg::bbox_action::bbox_action
bbox_action(const bbox_action &a_from)
Definition: bbox_action:113
tools::sg::bbox_action::add_triangle
virtual bool add_triangle(float a_p1x, float a_p1y, float a_p1z, float, float a_p2x, float a_p2y, float a_p2z, float, float a_p3x, float a_p3y, float a_p3z, float)
Definition: bbox_action:49
tools::sg::bbox_action::box
box3f & box()
Definition: bbox_action:130
tools::sg::bbox_action::add_point
virtual bool add_point(float a_x, float a_y, float a_z, float, float, float, float, float)
Definition: bbox_action:28
tools::box3f
Definition: box3f:13
tools::sg::bbox_action::add_line_normal
virtual bool add_line_normal(float a_bx, float a_by, float a_bz, float a_bw, float, float, float, float a_ex, float a_ey, float a_ez, float a_ew, float, float, float)
Definition: bbox_action:81
tools::sg::primitive_visitor
Definition: primitive_visitor:20
tools::sg::bbox_action::add_point_normal
virtual bool add_point_normal(float a_x, float a_y, float a_z, float a_w, float, float, float, float, float, float, float)
Definition: bbox_action:75