UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
u3d_abstract_shooter.hpp
1 /* u3d_abstract_shooter.hpp */
2 /* $Id: u3d_abstract_shooter.hpp,v 1.22 2008/09/29 10:26:11 ibadm Exp $ */
3 //-----------------------------------------------------------------------------
4 #ifndef __u3d_abstract_shooter_hpp
5 #define __u3d_abstract_shooter_hpp
6 
7 #include "u3d_raydyn_calculator.hpp"
8 #include "u3d_shooter_defines.hpp"
9 
10 #define SHOOTER_DEBUG
11 
12 //#define ARS_DEBUG
13 
14 //=============================================================================
16 //class U3dAbstractRayShooter : public U3dRayTracing
18 {
19 public:
20 
21  U3dAbstractRayShooter(U3dModel *mod3d, U3dReflCoefType coeff_type = ZOEPPRITZ);
22  virtual ~U3dAbstractRayShooter() {}
23  //protected:
24 
25 
26 
28  bool findNextCell(int faceId, int &condId, int &i, int &j,
29  int &filled_cells_num, int &shadow_cells_num, int& conf_type,
30  int debug_level=0);
31 
32  bool findNextCleanCell(int faceId, int &confId, int &resI, int &resJ,
33  int &filled_cells_num, int &shadow_cells_num, int& conf_type,
34  int debug_level=0);
35 
36  bool checkFaceZone(int faceId, int zoneId, int conf, int& conf_type, int &resI, int &recJ);
37 
38 
39 
40 
41 
42 
43 
45  bool coverConf(int confId, int faceId, int i0, int j0, U3dPoint p, U3dCodeAr c, int conf_type);
46 
48  bool coverNhbCCross(int faceId, int ni, int nj, U3dPoint p, U3dCodeAr c,
49  int &resi, int &resj);
50 
52  bool coverNhbC1(int faceId, int i0, int j0, U3dPoint p, U3dCodeAr c);
53 
55  bool coverNhbC2(int faceId, int i0, int j0, U3dPoint p, U3dCodeAr c);
56 
57  bool shootNhbC2Cross(int faceId, int i0, int j0, U3dPoint p, U3dCodeAr c,
58  int i_n0, int j_n0, int i_n1, int j_n1);
59 
61  bool coverNhbC3(int faceId, int i0, int j0, U3dPoint p, U3dCodeAr c, int conf_type);
62 
64  bool coverNhbC4(int faceId, int i0, int j0, U3dPoint p, U3dCodeAr c);
65 
67  bool coverNhbC5(int faceId, int i0, int j0, U3dPoint p, U3dCodeAr c);
68 
70  bool coverNhbCSpiral(int faceId, int i0, int j0, U3dPoint p, U3dCodeAr c);
71 
72 
73 
74  /* =================== Neighbour cells configuration analysis procedures (u3d_abstract_shooter_conf.cpp) =================== */
75 
76  int checkConf(int i0, int j0, int faceId);
77 
78  bool checkConf(int confId, int i0, int j0, int faceId, int& conf_type);
79 
81  bool checkConf1(int i0, int j0, int faceId);
82 
84  bool checkConf2(int i0, int j0, int faceId);
85 
87  bool checkConf3(int i0, int j0, int faceId, int& conf_type);
88 
90  bool checkConf4(int i0, int j0, int faceId);
91 
93  bool checkConf5(int i0, int j0, int faceId);
94 
96  bool checkConf6(int i0, int j0, int faceId);
97 
98 
99  bool find2FilledNhbC3(int faceId, int i0, int j0, int conf_type,
100  int& i_n0, int& j_n0, int& i_n1, int& j_n1);
101 
103  bool find3FilledNhbC4(int faceId, int i0, int j0,
104  int& i_n0, int& j_n0, int& i_n1, int& j_n1, int& i_n2, int& j_n2);
105 
107  bool find3FilledNhbC5(int faceId, int i0, int j0,
108  int& i_n0, int& j_n0, int& i_n1, int& j_n1, int& i_n2, int& j_n2);
109 
112  bool calcNhbCPlaneAngles(int faceId, int i0, int j0,
113  int i_n0, int j_n0,
114  int i_n1, int j_n1,
115  int i_n2, int j_n2,
116  float& stF, float& stAz);
117 
118  void printConfCell(int i0, int j0, int faceId, int confId = 3);
119 
120  void printCellNhbC(int i0, int j0, int faceId, int nhb_num = 7);
121 
122 
123 
124  /* =================== Service procedures (u3d_abstract_shooter_service.cpp) =================== */
125 
127  int checkNhbCell(int faceId, int i0, int j0);
128 
130  int shootNcheckPh1(int faceId, U3dPoint p, float f, float az,
131  int ni, int nj, U3dCodeAr c, int &resI, int &resJ);
132 
134  bool shootNcheckPh2(int faceId, U3dPoint p, float f, float az,
135  int i0, int j0, U3dCodeAr c, int &resI, int &resJ);
136 
138  bool findFilledNhbCell(int faceId, int &i, int &j);
139 
142  bool findFilledFaceNhbCell(U3dPoint p, int faceId, U3dCodeAr c, int &resI, int &resJ);
143 
145  bool findCleanNhbCell(int faceId, int &i, int &j, int &filled_cells_num, int &shadow_cells_num);
146 
148  bool isFaceCellClean(int i, int j, int faceId);
149 
151  bool isFaceCellShadowed(int i, int j, int faceId);
152 
154  bool isFaceCellFilled(int i, int j, int faceId);
155 
156  char getCellStatus(int i, int j, int faceId);
157 
158 
159 
160 
161 
162 
163 
165  virtual int getFaceId(U3dRay *r)
166  {
167 #ifdef SHOOTER_DEBUG
168  U3dMessage::error("U3dAbstractRayShooter :: getFaceId works...");
169 #endif
170  return -1;
171  }
172 
174  virtual int getFaceIMax(int faceId)
175  {
176 #ifdef SHOOTER_DEBUG
177  U3dMessage::error("U3dAbstractRayShooter :: getFaceIMax works...");
178 #endif
179  return -1;
180  }
181 
183  virtual int getFaceJMax(int faceId)
184  {
185 #ifdef SHOOTER_DEBUG
186  U3dMessage::error("U3dAbstractRayShooter :: getFaceJMax works...");
187 #endif
188  return -1;
189  }
190 
192  virtual void getFaceCellIJ(U3dPoint p, int faceId, int &i, int &j)
193  {
194 #ifdef SHOOTER_DEBUG
195  U3dMessage::error("U3dAbstractRayShooter :: getFaceCellIJ works...");
196 #endif
197  }
198 
200  virtual void setShadowedFlag(int i, int j, int faceId)
201  {
202 #ifdef SHOOTER_DEBUG
203  U3dMessage::error("U3dAbstractRayShooter :: setShadowedFlag works...");
204 #endif
205  }
206 
208  virtual float getFaceCellT(int i, int j, int faceId)
209  {
210 #ifdef SHOOTER_DEBUG
211  U3dMessage::error("U3dAbstractRayShooter :: getFaceCellT works...");
212 #endif
213  return 0;
214  }
215 
217  virtual float getFaceCellStF(int i, int j, int faceId)
218  {
219 #ifdef SHOOTER_DEBUG
220  U3dMessage::error("U3dAbstractRayShooter :: getFaceCellStF works...");
221 #endif
222  return 0;
223  }
224 
226  virtual float getFaceCellStAz(int i, int j, int faceId)
227  {
228 #ifdef SHOOTER_DEBUG
229  U3dMessage::error("U3dAbstractRayShooter :: getFaceCellStAz works...");
230 #endif
231  return 0;
232  }
233 
234 
235 
236  struct ARSFaceZone
237  {
238  int imin;
239  int imax;
240  int jmin;
241  int jmax;
242  };
243 
244  typedef std::vector<ARSFaceZone> ARSFaceZonesAr;
245 
246  ARSFaceZonesAr m_face_active_zones;
247 
248  virtual void formFaceActiveZones(int faceId)
249  {
250 #ifdef SHOOTER_DEBUG
251  U3dMessage::error("U3dAbstractRayShooter :: formFaceActiveZones works...");
252 #endif
253  int imax = getFaceIMax(faceId), jmax = getFaceJMax(faceId);
254 
255  ARSFaceZone face_zone;
256 
257  face_zone.imin = 0;
258  face_zone.imax = imax;
259 
260  face_zone.jmin = 0;
261  face_zone.jmax = jmax;
262 
263  m_face_active_zones.push_back(face_zone);
264 
265  }
266 
267 };
268 
269 #endif
270 
271 //-----------------------------------------------------------------------------
272 /* u3d_abstract_shooter.hpp */
bool isFaceCellShadowed(int i, int j, int faceId)
bool coverConf(int confId, int faceId, int i0, int j0, U3dPoint p, U3dCodeAr c, int conf_type)
static void error(const char *format,...)
bool find3FilledNhbC5(int faceId, int i0, int j0, int &i_n0, int &j_n0, int &i_n1, int &j_n1, int &i_n2, int &j_n2)
virtual void getFaceCellIJ(U3dPoint p, int faceId, int &i, int &j)
Definition: u3d_abstract_shooter.hpp:192
bool coverNhbC5(int faceId, int i0, int j0, U3dPoint p, U3dCodeAr c)
bool coverNhbC1(int faceId, int i0, int j0, U3dPoint p, U3dCodeAr c)
bool findNextCell(int faceId, int &condId, int &i, int &j, int &filled_cells_num, int &shadow_cells_num, int &conf_type, int debug_level=0)
virtual void setShadowedFlag(int i, int j, int faceId)
Definition: u3d_abstract_shooter.hpp:200
bool shootNcheckPh2(int faceId, U3dPoint p, float f, float az, int i0, int j0, U3dCodeAr c, int &resI, int &resJ)
bool checkConf2(int i0, int j0, int faceId)
bool checkConf5(int i0, int j0, int faceId)
bool coverNhbC2(int faceId, int i0, int j0, U3dPoint p, U3dCodeAr c)
bool checkConf4(int i0, int j0, int faceId)
bool findCleanNhbCell(int faceId, int &i, int &j, int &filled_cells_num, int &shadow_cells_num)
virtual float getFaceCellT(int i, int j, int faceId)
Definition: u3d_abstract_shooter.hpp:208
int checkNhbCell(int faceId, int i0, int j0)
Definition: u3d_point.hpp:16
virtual int getFaceId(U3dRay *r)
Definition: u3d_abstract_shooter.hpp:165
bool checkConf1(int i0, int j0, int faceId)
bool findFilledFaceNhbCell(U3dPoint p, int faceId, U3dCodeAr c, int &resI, int &resJ)
bool coverNhbC4(int faceId, int i0, int j0, U3dPoint p, U3dCodeAr c)
Definition: u3d_ray.hpp:14
int shootNcheckPh1(int faceId, U3dPoint p, float f, float az, int ni, int nj, U3dCodeAr c, int &resI, int &resJ)
bool coverNhbCSpiral(int faceId, int i0, int j0, U3dPoint p, U3dCodeAr c)
bool coverNhbC3(int faceId, int i0, int j0, U3dPoint p, U3dCodeAr c, int conf_type)
virtual int getFaceIMax(int faceId)
Definition: u3d_abstract_shooter.hpp:174
bool find3FilledNhbC4(int faceId, int i0, int j0, int &i_n0, int &j_n0, int &i_n1, int &j_n1, int &i_n2, int &j_n2)
Definition: u3d_raydyn_calculator.hpp:14
virtual float getFaceCellStAz(int i, int j, int faceId)
Definition: u3d_abstract_shooter.hpp:226
Definition: u3d_model.hpp:15
bool calcNhbCPlaneAngles(int faceId, int i0, int j0, int i_n0, int j_n0, int i_n1, int j_n1, int i_n2, int j_n2, float &stF, float &stAz)
Definition: u3d_abstract_shooter.hpp:17
bool checkConf6(int i0, int j0, int faceId)
virtual int getFaceJMax(int faceId)
Definition: u3d_abstract_shooter.hpp:183
bool checkConf3(int i0, int j0, int faceId, int &conf_type)
bool isFaceCellClean(int i, int j, int faceId)
bool findFilledNhbCell(int faceId, int &i, int &j)
virtual float getFaceCellStF(int i, int j, int faceId)
Definition: u3d_abstract_shooter.hpp:217
bool coverNhbCCross(int faceId, int ni, int nj, U3dPoint p, U3dCodeAr c, int &resi, int &resj)
bool isFaceCellFilled(int i, int j, int faceId)