Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYCalculParcours.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) <2012-2024> <EDF-DTG> <FRANCE>
3  * This file is part of Code_TYMPAN (R).
4  * Code_TYMPAN (R) is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  * Code_TYMPAN (R) is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11  * See the GNU General Public License for more details.
12  * You should have received a copy of the GNU General Public License along
13  * with Code_TYMPAN (R). If not, see <https://www.gnu.org/licenses/>.
14  */
15 
16 /*
17  *
18  */
19 
20 #include <stdio.h>
21 #include <math.h>
22 
24 #include "TYCalculParcours.h"
25 #include <assert.h>
26 
28 
29 TYCalculParcours::TYCalculParcours(int nNbSegMax, bool bVertical)
30 {
31  _bVertical = bVertical;
32  _nNbSegMax = nNbSegMax;
33  // Creation d'un set geometrique pour les donnees d'entree:
39 
40  // Creation d'un set geometrique pour le segment d'entree Source-Recepteur:
42  _geoSR->_nNbPolylines = 0;
46 
47  _vectorPoint.clear();
49 }
50 
52 {
55  _vectorPoint.clear();
57 }
58 
59 void TYCalculParcours::InitChangementVariable2D3D(bool bAxeXMoinsSignifiant)
60 {
61  // Changement de variable en entree pour traitement 2D (une coordonnee ne sera pas prise en compte)
62  if (_bVertical)
63  {
64  // Lorsque le rayon Source-Recepteur est plus oriente suivant Y que X (repere Tympan),
65  // on garde Y (au lieu de X) comme seconde composante (apres Z, l'altitude = la premiere composante
66  // 2D). Remarques :
67  //* la composante ignoree est tout de meme stockee et restituee a la fin (cgangement de variable)
68  //* on ne fait que choisir des points existants
69  //(on n'en calcule pas de nouveaux -du moins pour le calcul vertical-)
70  //* pour les calculs horizontaux, seuls les points sur le trajet Source-Recepteur sont susceptibles
71  // d'etre issus de calculs au lieu de selection. La coordonnee Z de ces points resulte alors d'une
72  // interpollation (cf methode IntersectionDroites) Exemple: le rayon Source-Recepteur est parallele a
73  // l'axe Y; dans ce cas, le plan 2D est (0y, 0z)
74  if (bAxeXMoinsSignifiant)
75  {
76  _indexXInOut = 1; // Y->X
77  _indexYInOut = 2; // Z->Y
78  _indexZInOut = 0; // X->Z
79  }
80  else
81  {
82  _indexXInOut = 0;
83  _indexYInOut = 2; // Z->Y
84  _indexZInOut = 1; // Y->Z
85  }
86  }
87  else
88  {
89  _indexXInOut = 0;
90  _indexYInOut = 1;
91  _indexZInOut = 2;
92  }
93 }
94 
96  bool bVertical)
97 {
98  _geoSR = geoSR;
99  _geoImporterDXF = geoImporterDXF;
100  _bVertical = bVertical;
101  _nNbSegMax = -1; // on se souvient que les polylignes ont ete importees petit a petit
102 }
103 
104 void TYCalculParcours::AjouterSegment(double* ptA, double* ptB, bool isInfra, bool isEcran,
106 {
107  // create point1 from ptA
108  TYPointParcours p1_temp;
109  p1_temp.isInfra = isInfra;
110  p1_temp.isEcran = isEcran;
111  p1_temp.x = ptA[_indexXInOut];
112  p1_temp.y = ptA[_indexYInOut];
113  p1_temp.z = ptA[_indexZInOut];
114 
115  // create point2 from ptB
116  TYPointParcours p2_temp;
117  p2_temp.isInfra = isInfra;
118  p2_temp.isEcran = isEcran;
119  p2_temp.x = ptB[_indexXInOut];
120  p2_temp.y = ptB[_indexYInOut];
121  p2_temp.z = ptB[_indexZInOut];
122 
123  bool ptA_AlreadyExists = false;
124  bool ptB_AlreadyExists = false;
125 
126  int indicePt1Doublon = -1;
127  int indicePt2Doublon = -1;
128 
129  // verifier si ptA et ptB pas de doublons dans la liste de point
130  for (int i = static_cast<int>(_vectorPoint.size()) - 1; i >= 0; i--)
131  {
132  if ((_vectorPoint[i]->Identifiant != INDENTIFIANT_SOURCE) &&
133  (_vectorPoint[i]->Identifiant != INDENTIFIANT_RECEPTEUR) &&
134  (_vectorPoint[i]->isEcran == p1_temp.isEcran) && (_vectorPoint[i]->isInfra == p1_temp.isInfra) &&
136  {
137  ptA_AlreadyExists = true;
138  indicePt1Doublon = i;
139  break;
140  }
141  }
142 
143  for (int i = static_cast<int>(_vectorPoint.size()) - 1; i >= 0; i--)
144  {
145  if ((_vectorPoint[i]->Identifiant != INDENTIFIANT_SOURCE) &&
146  (_vectorPoint[i]->Identifiant != INDENTIFIANT_RECEPTEUR) &&
147  (_vectorPoint[i]->isEcran == p2_temp.isEcran) && (_vectorPoint[i]->isInfra == p2_temp.isInfra) &&
149  {
150  ptB_AlreadyExists = true;
151  indicePt2Doublon = i;
152  break;
153  }
154  }
155 
156  if (ptA_AlreadyExists & !ptB_AlreadyExists)
157  { // SI doublon ptA
158  TYPointParcours* p2 = &(geo->_ListePoint[geo->_nNbPointTotal]);
159  p2->isInfra = isInfra;
160  p2->isEcran = isEcran;
161  p2->x = ptB[_indexXInOut];
162  p2->y = ptB[_indexYInOut];
163  p2->z = ptB[_indexZInOut];
164  p2->Identifiant = geo->_nNbPointTotal;
165  p2->Identifiant = geo->_nNbPointTotal;
166  _vectorPoint.push_back(p2);
167  geo->_nNbPointTotal++;
168  geo->_ListePolylines[geo->_nNbPolylines].ajouteSegment(_vectorPoint[indicePt1Doublon], p2);
169  geo->_nNbPolylines++;
170  // delete p1;
171  }
172  else if (!ptA_AlreadyExists & ptB_AlreadyExists)
173  { // SI doublon ptB
174  TYPointParcours* p1 = &(geo->_ListePoint[geo->_nNbPointTotal]);
175  p1->isInfra = isInfra;
176  p1->isEcran = isEcran;
177  p1->x = ptA[_indexXInOut];
178  p1->y = ptA[_indexYInOut];
179  p1->z = ptA[_indexZInOut];
180  p1->Identifiant = geo->_nNbPointTotal;
181  p1->Identifiant = geo->_nNbPointTotal;
182  _vectorPoint.push_back(p1);
183  geo->_nNbPointTotal++;
184  geo->_ListePolylines[geo->_nNbPolylines].ajouteSegment(p1, _vectorPoint[indicePt2Doublon]);
185  geo->_nNbPolylines++;
186  // delete p2;
187  }
188  else if (ptA_AlreadyExists & ptB_AlreadyExists)
189  { // SI doublon ptA et ptB
190  geo->_ListePolylines[geo->_nNbPolylines].ajouteSegment(_vectorPoint[indicePt1Doublon],
191  _vectorPoint[indicePt2Doublon]);
192  geo->_nNbPolylines++;
193  // delete p1,p2;
194  }
195  else
196  { // SI aucun doublon
197  TYPointParcours* p1 = &(geo->_ListePoint[geo->_nNbPointTotal]);
198  p1->isInfra = isInfra;
199  p1->isEcran = isEcran;
200  p1->x = ptA[_indexXInOut];
201  p1->y = ptA[_indexYInOut];
202  p1->z = ptA[_indexZInOut];
203  p1->Identifiant = geo->_nNbPointTotal;
204 
205  p1->Identifiant = geo->_nNbPointTotal;
206  geo->_nNbPointTotal++;
207  TYPointParcours* p2 = &(geo->_ListePoint[geo->_nNbPointTotal]);
208  p2->isInfra = isInfra;
209  p2->isEcran = isEcran;
210  p2->x = ptB[_indexXInOut];
211  p2->y = ptB[_indexYInOut];
212  p2->z = ptB[_indexZInOut];
213  p2->Identifiant = geo->_nNbPointTotal;
214  p2->Identifiant = geo->_nNbPointTotal;
215  geo->_nNbPointTotal++;
216  _vectorPoint.push_back(p1);
217  _vectorPoint.push_back(p2);
218  // On ajoute une polyligne a geo:
219  geo->_ListePolylines[geo->_nNbPolylines].ajouteSegment(p1, p2);
220  geo->_nNbPolylines++;
221  }
222 }
223 
224 void TYCalculParcours::AjouterSegmentCoupe(double* ptA, double* ptB, bool isInfra, bool isEcran)
225 {
227  AjouterSegment(ptA, ptB, isInfra, isEcran, _geoImporterDXF);
228 }
229 
230 void TYCalculParcours::AjouterSegmentSR(double* ptA, double* ptB)
231 {
232  assert(_geoSR->_nNbPointTotal == 0);
233  assert(_geoSR->_nNbPolylines == 0);
234  // On fait ici le choix du systeme de coordonnee:
235  double dDeltaX = fabs(ptA[0] - ptB[0]);
236  double dDeltaY = fabs(ptA[1] - ptB[1]);
237  InitChangementVariable2D3D(dDeltaX < dDeltaY);
238  // InitChangementVariable2D3D(ptA[0] == ptB[0]);
239  AjouterSegment(ptA, ptB, false, false, _geoSR);
240 
241  // On attribue des identifiants speciaux aux points S & R, pour ne pas les melanger a d'autres
244 }
245 
246 void TYCalculParcours::PointTrajetGauche(int i, double* pt)
247 {
249 }
250 
251 void TYCalculParcours::PointTrajetDroite(int i, double* pt)
252 {
254 }
255 
257 {
258  assert(i < geo->_nNbPointTotal);
259  pt[_indexXInOut] = geo->_ListePoint[i].x;
260  pt[_indexYInOut] = geo->_ListePoint[i].y;
261  pt[_indexZInOut] = geo->_ListePoint[i].z;
262 }
263 
265 {
266  if (_geoTrajetDroite == nullptr)
267  {
268  return 0;
269  }
270 
271  double ptA[3];
272  double ptB[3];
273  PointTrajet(0, ptA, _geoSR);
274  PointTrajet(1, ptB, _geoSR);
275 
277 }
278 
280 {
281  if (_geoTrajetGauche == nullptr)
282  {
283  return 0;
284  }
285 
286  double ptA[3];
287  double ptB[3];
288  PointTrajet(0, ptA, _geoSR);
289  PointTrajet(1, ptB, _geoSR);
290 
292 }
293 
295 {
296  _geoTrajetGauche = nullptr;
297  _geoTrajetDroite = nullptr;
298 
299  bool resTraitement =
301 
302  return resTraitement;
303 }
304 
305 bool TYCalculParcours::CalculTrajet(TYSetGeometriqueParcours& geoCourant, bool bCoteGauche,
306  bool* PointsAGauche, bool* PointsADroite,
307  TYSetGeometriqueParcours& geoPremierePasse,
308  TYSetGeometriqueParcours*& geoTrajet)
309 {
310  bool bPasEnferme = true;
311  // 3.4 Calcul des trajets
312  // A partir de maintenant, on ne traite plus qu'un seul cote
313  // bool bCoteGauche = true;
314  // 3.4.1 Ramener les points traversant la frontiere sur la frontiere
315  int* IndexePointsFrontiere = new int[geoCourant._nNbPointTotal];
316  int NbPointsFrontiere = 0;
317 
318  // on considere ici que les polylignes sont en fait des segments (vrai venant de Tympan)
320  _geoSR->_ListePoint[0], _geoSR->_ListePoint[1], IndexePointsFrontiere, NbPointsFrontiere,
321  _estUnPointIntersectant, bCoteGauche, PointsAGauche, PointsADroite);
322 
323  // On va plus loin que s'il y a des points d'intersection (sinon, c'est SR)
324  if (NbPointsFrontiere)
325  {
326  // 3.4.2 Mettre bout a bout les polylignes
327  // Merger les segments: on considere ici que chaque point ne peut appartenir a plus de 2 polylignes (a
328  // verifier en venant de Tympan)
329  Connexite* Connexes = new Connexite[geoCourant._nNbPointTotal];
330 
331  bool bOk = geoCourant.ListerPointsConnexes(Connexes, _estUnPointIntersectant);
332  if (!bOk)
333  {
334  bPasEnferme = false; // on a trouve des points n-uples; comme on ne sait pas les gerer, on
335  // pretexte un enfermemnt
337  }
338  else
339  {
340  // Est-on enferme ? C'est le cas si en suivant une polyligne intersectante,
341  // on se retrouve avant S ou apres R sur [S,R]
342  // Comme on doit parcourir toutes les polylignes intersectantes, on en profite pour calculer les
343  // trajets:
344  bPasEnferme = geoCourant.PremierePasse(_geoSR->_ListePoint[0], _geoSR->_ListePoint[1],
345  IndexePointsFrontiere, NbPointsFrontiere,
346  _estUnPointIntersectant, Connexes, geoPremierePasse);
347  }
348  if (bPasEnferme)
349  {
350  geoTrajet = &geoPremierePasse;
351  }
352 
353  SAFE_DELETE_LIST(Connexes);
354  }
355  SAFE_DELETE_LIST(IndexePointsFrontiere);
356 
357  return bPasEnferme;
358 }
359 
361  TYSetGeometriqueParcours& geoDernierePasseDroite,
362  TYSetGeometriqueParcours*& geoTrajetGauche,
363  TYSetGeometriqueParcours*& geoTrajetDroite)
364 {
365  // Preparation des donnees
366  // 1. Le segment SR doit etre present
367  assert(NULL != _geoSR);
368  if (NULL == _geoSR->_ListePoint)
369  {
370  return -1;
371  }
372  // 2. S et R doivent avoir des identifiants speciaux pour ne pas les melanger a d'autres
375 
376  // S'il n'y a pas d'obstacle:
378  {
379  // On copie _geoSR
380  geoDernierePasseGauche.Copy(*_geoSR);
381  geoDernierePasseDroite.Copy(*_geoSR);
382 
383  // On n'ecrit pas le fichier
384  return 0;
385  }
386 
387  // 3.1 Filtrage
388  // 3.1.1 Filtrage sur les polylignes
389  if (!_bVertical)
390  {
391  TYPointParcours** pTableauECD = NULL;
392  int nbPtsECD = 0;
393  TYPointParcours** pTableauECG = NULL;
394  TYPointParcours** pTableauFinG = NULL;
395  TYPointParcours** pTableauFinD = NULL;
396 
397  int nbPtsECG = 0;
398  int nbPtsFinG = 0;
399  int nbPtsFinD = 0;
400 
401  TYSetGeometriqueParcours geoGauche;
402  TYSetGeometriqueParcours geoDroite;
403 
405 
406  // 3.2 Marquage des points a gauche ou a droite
407  bool* PointsAGauche = NULL;
408  bool* PointsADroite = NULL;
410  PointsAGauche, PointsADroite);
411 
412  // 3.3 Separation des points suivants le côté droit au gauche
413  // Cette separation donne deja les segments intersectant [SR]
414 
415  _geoImporterDXF->SeparationDroiteGauche(PointsAGauche, PointsADroite, geoGauche, geoDroite);
416 
417  // 3.4 Calcul des trajets
418  TYSetGeometriqueParcours geoPremierePasseGauche;
419  bool bPasEnfermeAGauche = CalculTrajet(geoGauche, true, PointsAGauche, PointsADroite,
420  geoPremierePasseGauche, geoTrajetGauche);
421  if (bPasEnfermeAGauche && geoPremierePasseGauche._nNbPolylines > 0)
422  {
423  TYSetGeometriqueParcours geoSecondePasseGauche;
424  bool bGeoSecondePasseGaucheIntersects = false;
425  int nNbBouclesPasseGauche = 0;
426  do
427  {
428  nNbBouclesPasseGauche++;
429  geoGauche.SecondePasse(geoPremierePasseGauche, geoSecondePasseGauche, true, pTableauECG,
430  nbPtsECG);
431  geoGauche.SecondePasse(geoSecondePasseGauche, geoDernierePasseGauche, true, pTableauFinG,
432  nbPtsFinG, MAX_POINTS, true);
433  bGeoSecondePasseGaucheIntersects = geoGauche.intersects(geoDernierePasseGauche);
434  if (geoPremierePasseGauche.coincideWith(geoDernierePasseGauche))
435  {
436  break;
437  }
438 
439  geoPremierePasseGauche.Clean();
440  geoPremierePasseGauche.Copy(geoDernierePasseGauche);
441  } while (bGeoSecondePasseGaucheIntersects && (nNbBouclesPasseGauche < 4));
442 
443  if (!bGeoSecondePasseGaucheIntersects)
444  {
445  geoTrajetGauche = &geoDernierePasseGauche;
446  }
447  else
448  {
449  geoTrajetGauche = nullptr;
450  }
451  }
452 
453  TYSetGeometriqueParcours geoPremierePasseDroite;
454  bool bPasEnfermeADroite = CalculTrajet(geoDroite, false, PointsAGauche, PointsADroite,
455  geoPremierePasseDroite, geoTrajetDroite);
456  if (bPasEnfermeADroite && geoPremierePasseDroite._nNbPolylines > 0)
457  {
458  TYSetGeometriqueParcours geoSecondePasseDroite;
459  bool bGeoSecondePasseDroiteIntersects = false;
460  int nNbBouclesPasseDroite = 0;
461  do
462  {
463  nNbBouclesPasseDroite++;
464  geoDroite.SecondePasse(geoPremierePasseDroite, geoSecondePasseDroite, false, pTableauECD,
465  nbPtsECD);
466  geoDroite.SecondePasse(geoSecondePasseDroite, geoDernierePasseDroite, false, pTableauFinD,
467  nbPtsFinD, MAX_POINTS, true);
468  bGeoSecondePasseDroiteIntersects = geoDroite.intersects(geoDernierePasseDroite);
469  if (geoPremierePasseDroite.coincideWith(geoDernierePasseDroite))
470  {
471  break;
472  }
473 
474  geoPremierePasseDroite.Clean();
475  geoPremierePasseDroite.Copy(geoDernierePasseDroite);
476  } while (bGeoSecondePasseDroiteIntersects && (nNbBouclesPasseDroite < 4));
477 
478  if (!bGeoSecondePasseDroiteIntersects)
479  {
480  geoTrajetDroite = &geoDernierePasseDroite;
481  }
482  else
483  {
484  geoTrajetDroite = nullptr;
485  }
486  }
487 
488  SAFE_DELETE_LIST(PointsAGauche);
489  SAFE_DELETE_LIST(PointsADroite);
490 
491  SAFE_DELETE_LIST(pTableauECD);
492  SAFE_DELETE_LIST(pTableauECG);
493 
494  SAFE_DELETE_LIST(pTableauFinG);
495  SAFE_DELETE_LIST(pTableauFinD);
496  }
497  else
498  {
499  // Il suffit de calculer l'EC de l'ensemble des points formes par ceux d'abscisse compris entre Sx &
500  // Rx, et d'en prendre la partie superieure Avant, on termine le merge entrepris avant, ie qu'on ne
501  // reordonne la liste pour mettre en premier les nons doublons
502  //_geoImporterDXF->GenerePointNonConfondus();
503  // Hypotheses:
504  // On suppose que ni source ni recepteur ne sont dans un batiment
505  TYPointParcours** TableauDePointsSelectionnes =
507  2]; // +2 pour prendre en compte les points S et R qui sont ajoutes
508  int nNbPointsSelectiones = _geoImporterDXF->SelectionnePointsEntreSetRetDuCoteDeSR(
509  _geoSR, TableauDePointsSelectionnes, _geoImporterDXF->_nNbPointTotal);
510 
511  TYPointParcours** TableauDePointsEC = new TYPointParcours*[nNbPointsSelectiones];
512  // int nNbPointsEC =
513  // TYSetGeometriqueParcours::EnveloppeConvexeLes2PremiersPointsEtantLesPlusBas(TableauDePointsSelectionnes,
514  // nNbPointsSelectiones, TableauDePointsEC);
515 
516  int nNbPointsEC = 0;
517  bool bWrong = false;
518  int idx = 0;
519  TYPointParcours A, B;
520 
521  // xbh: corrige le pb de trajet vu sur le projet UMP 1.7 insono.xml
522  // Ce n'est vraiment pas optimal, mais je n'ai pas trouve de meilleure solution
523  // avec l'algorithme actuel que d'eliminer les points posant probleme et de recalculer
524  // l'enveloppe convexe a partir du nouvel ensemble de points.
525  // Cela a l'air de mieux fonctionner, mais il doit rester des cas ou des problemes persistent.
526  // En particulier, on suppose dans le filtrage de l'enveloppe que l'on n'a pas de points de
527  // rebroussements. Ce qui est faux dans le cas ou on passe par dessus un mur d'epaisseur nulle (mais
528  // ce cas est-il possible dans Tympan??)
529  do
530  {
532  TableauDePointsSelectionnes, nNbPointsSelectiones, TableauDePointsEC, false);
533 
534  // xbh: ajout d'une deuxieme passe pour filter l'enveloppe convexe en eliminant les points de
535  // rebroussements
536  bWrong = false;
537  idx = 0;
538  for (int i = 0; i < nNbPointsEC; i++)
539  {
540  if (i > 1)
541  {
542  A = TYPointParcours::vecteur2D(*TableauDePointsEC[i - 1], *TableauDePointsEC[i - 2]);
543  B = TYPointParcours::vecteur2D(*TableauDePointsEC[i - 1], *TableauDePointsEC[i]);
544 
545  if (TYPointParcours::Scalaire(A, B) >
546  0) // point de rebroussement dans l'enveloppe, on l'oublie pour lisser l'enveloppe
547  {
548  bWrong = true;
549  idx = i - 1;
550  break; // on s'arrete ici...
551  }
552  else if (ABS(TYPointParcours::Scalaire(A, B)) < EPSILON_13)
553  {
554  // on autorise les angles a 90i�� que lors du suivis du contour d'un obstacle
556  TableauDePointsEC[i - 2], TableauDePointsEC[i - 1], TableauDePointsEC[i]))
557  {
558  bWrong = true;
559  idx = i - 1;
560  break; // on s'arrete ici...
561  }
562  }
563  else if ((A.x == 0.0f) || (B.x == 0.0f))
564  {
565  // on autorise les segments verticaux que lors du suivis du contour d'un obstacle
567  TableauDePointsEC[i - 2], TableauDePointsEC[i - 1], TableauDePointsEC[i]))
568  {
569  bWrong = true;
570  idx = i - 1;
571  break; // on s'arrete ici...
572  }
573  }
574  }
575  }
576 
577  if (bWrong) // Si un point pose pb, on l'elimine et on recommence le calcul de l'enveloppe...
578  {
579  int k = 0;
580  for (k = 0; k < nNbPointsSelectiones; k++)
581  {
582  if (TableauDePointsEC[idx] == TableauDePointsSelectionnes[k])
583  {
584  idx = k;
585  break; // on a trouve le point, on stop ici
586  }
587  }
588  for (k = idx; k < nNbPointsSelectiones - 1; k++)
589  {
590  // On decale tout le tableau
591  TableauDePointsSelectionnes[k] = TableauDePointsSelectionnes[k + 1];
592  }
593  nNbPointsSelectiones--;
594  }
595  } while (bWrong);
596 
597  // Les points doivent etre ordonnes pour le trajet; on sait que le premier point est S, le second R
598  // Si S est a droite de R, il faudra reordonner les points pour le trajet
599  bool bAGaucheDeSR = (_geoSR->_ListePoint[0].x < _geoSR->_ListePoint[1].x);
600  geoDernierePasseGauche.CreerTrajetAPartirDuneListeDePointsTriee(TableauDePointsEC, nNbPointsEC,
601  bAGaucheDeSR, true);
602  geoTrajetGauche = &geoDernierePasseGauche;
603 
604  SAFE_DELETE_LIST(TableauDePointsEC);
605  SAFE_DELETE_LIST(TableauDePointsSelectionnes);
606  }
607 
608  return 0;
609 }
All base classes related to 3D manipulation.
#define EPSILON_13
Definition: 3d.h:41
double ABS(double a)
Return the absolute value.
Definition: 3d.h:67
int nNbAbandonsParPointNuples
#define INDENTIFIANT_SOURCE
#define MAX_POINTS
#define INDENTIFIANT_RECEPTEUR
TYSetGeometriqueParcours * _geoImporterDXF
TYSetGeometriqueParcours * _geoSR
std::vector< bool > _estUnPointIntersectant
void AjouterSegmentSR(double *ptA, double *ptB)
Add points A (source) and B (receptor)
void AjouterSegmentCoupe(double *ptA, double *ptB, bool isInfra, bool isEcran)
Add a segment defined by 2 points.
int _nNbSegMax
Number of segments (encountered faces)
void InitChangementVariable2D3D(bool bAxeXMoinsSignifiant)
Select the 2D plane and set _indexXInOut, _indexYInOut, _indexZInOut.
int Traite(TYSetGeometriqueParcours &geoDernierePasseGauche, TYSetGeometriqueParcours &geoDernierePasseDroite, TYSetGeometriqueParcours *&geoTrajetGauche, TYSetGeometriqueParcours *&geoTrajetDroite)
Handles the pathfinding for lateral and vertical paths.
TYSetGeometriqueParcours * _geoTrajetGauche
Paths list on the left.
~TYCalculParcours()
Destructor.
bool Traitement()
Build the left and right geometric paths.
TYCalculParcours(int nNbSegMax, bool _bVertical)
Constructor.
void PointTrajetDroite(int i, double *pt)
Return the ith point of the right geometric path.
int NombrePointsTrajetDroite()
Return the points number of the left geometric path.
void PointTrajetGauche(int i, double *pt)
Return the ith point of the left geometric path.
int NombrePointsTrajetGauche()
Return the points number of the right geometric path.
bool _bVertical
True if horizontal view.
void AjouterSegment(double *ptA, double *ptB, bool isInfra, bool isEcran, TYSetGeometriqueParcours *geo)
creates and add vector AB into geo
TYSetGeometriqueParcours _geoDernierePasseGauche
TYSetGeometriqueParcours * _geoTrajetDroite
Paths list on the right.
TYSetGeometriqueParcours _geoDernierePasseDroite
std::vector< TYPointParcours * > _vectorPoint
void PointTrajet(int i, double *pt, TYSetGeometriqueParcours *geo)
copy coordinates from the point of index i from the object geo into pt
bool CalculTrajet(TYSetGeometriqueParcours &geoCourant, bool bCoteGauche, bool *PointsAGauche, bool *PointsADroite, TYSetGeometriqueParcours &geoPremierePasse, TYSetGeometriqueParcours *&geoTrajet)
select the points that could be included in the path
void ajouteSegment(TYPointParcours *p1, TYPointParcours *p2)
Add a first polyline with two points p1 and p2.
Class to build a geometric path used by the TYCalculParcours class.
void MarquePointsADroiteEtAGauche(TYPointParcours &Srce, TYPointParcours &Dest, bool *&PointsAGauche, bool *&PointsADroite)
Mark points on the left and on the right of the current geometric path.
bool intersects(TYPointParcours &P1, TYPointParcours &P2)
Check if [P1P2] segment can intersect the geometric path.
void Clean()
Delete polylines list and points list.
bool SecondePasse(TYSetGeometriqueParcours &geoPremierePasse, TYSetGeometriqueParcours &geoSecondePasse, bool bTrajetsAGaucheDeSR, TYPointParcours **&pTableauEC, int &nbPtsEC, int compteurIter=0, bool bIsLastSecondePasse=false)
Second pass.
TYPointParcours * _ListePoint
List of points on the path.
void RamenerPointsTraversantLaFrontiere(TYPointParcours &Srce, TYPointParcours &Dest, int *IndexePointsFrontiere, int &NbPointsFrontiere, std::vector< bool > &pEstUnPointIntersectant, bool bCoteGauche, bool *PointsAGauche, bool *PointsADroite)
To be commented.
static int EnveloppeConvexeLes2PremiersPointsEtant(TYPointParcours **TableauDePoints, int nNbPoints, TYPointParcours **TableauDePointsECOut, bool bPremiersPointsLesPlusHauts)
Compute the convex hull (arrays should be allocated before the call)
int SupressionPolylignesRedondantes()
Suppress useless polylines.
TYPolyligneParcours * _ListePolylines
Geometric path as a polylines.
int SelectionnePointsEntreSetRetDuCoteDeSR(TYSetGeometriqueParcours *geoSR, TYPointParcours **TableauDePoints, int nNbPoints)
Select points from the current geometric path which are between source and receptor of the geoSR geom...
void CreerTrajetAPartirDuneListeDePointsTriee(TYPointParcours **TableauDePoints, int nNbPoints, bool bSens, bool bGardeIdentifiant)
Create paths from a sorted points list (Used only for vertical paths)
void SeparationDroiteGauche(bool *PointsAGauche, bool *PointsADroite, TYSetGeometriqueParcours &geoGauche, TYSetGeometriqueParcours &geoDroite, int compteurIter=0)
Separate left and right polylines with two geometric paths.
bool coincideWith(TYSetGeometriqueParcours &otherGeoPasse)
Tests if the first polyline of this geo parcours coincide with the geo passe in argument,...
int _nNbPolylines
Polylines number.
void Copy(TYSetGeometriqueParcours &geoIn)
Copy operator.
int _nNbPointTotal
Total number of points.
void AllouerPolylignes(int nNbPolylineAllouee)
Allocation of the polylines list.
bool PremierePasse(TYPointParcours &Srce, TYPointParcours &Dest, int *IndexePointsFrontiere, int NbPointsFrontiere, std::vector< bool > &pEstUnPointIntersectant, Connexite *Connexes, TYSetGeometriqueParcours &geoPremierePasse, int compteurIter=0)
First pass to build a path along all the intersecting polylines.
bool ListerPointsConnexes(Connexite *&Connexes, std::vector< bool > &pEstUnPointIntersectant)
Fill for each point the connectivity with segments.
bool AppartienneMemePolyligne(TYPointParcours *a, TYPointParcours *b, TYPointParcours *c)
Check if the points a, b, c belong to the same polyline.
#define SAFE_DELETE_LIST(_p)
Definition: macros.h:239
#define SAFE_DELETE(_p)
Definition: macros.h:225
Connectivity between points and segments.
Point of a path.
double z
z coordinate of the point
bool isInfra
Flag set to indicate if the point is an infrastructure.
int Identifiant
Point id.
static bool Confondus(TYPointParcours *P1, TYPointParcours *P2)
double y
y coordinate of the point
static double Scalaire(TYPointParcours &P1, TYPointParcours &P2, TYPointParcours &P3, TYPointParcours &P4)
Compute the scalar product of the vector P1P2 and P3P4.
double x
x coordinate of the point
bool isEcran
Flag set to indicate if the point is a screen.
static TYPointParcours vecteur2D(TYPointParcours &P1, TYPointParcours &P2)
Compute the 2 dimensional vector P1P2 in the XY plane.