74 if (bAxeXMoinsSignifiant)
123 bool ptA_AlreadyExists =
false;
124 bool ptB_AlreadyExists =
false;
126 int indicePt1Doublon = -1;
127 int indicePt2Doublon = -1;
130 for (
int i =
static_cast<int>(
_vectorPoint.size()) - 1; i >= 0; i--)
135 ptA_AlreadyExists =
true;
136 indicePt1Doublon = i;
141 for (
int i =
static_cast<int>(
_vectorPoint.size()) - 1; i >= 0; i--)
146 ptB_AlreadyExists =
true;
147 indicePt2Doublon = i;
152 if (ptA_AlreadyExists & !ptB_AlreadyExists)
168 else if (!ptA_AlreadyExists & ptB_AlreadyExists)
184 else if (ptA_AlreadyExists & ptB_AlreadyExists)
231 double dDeltaX = fabs(ptA[0] - ptB[0]);
232 double dDeltaY = fabs(ptA[1] - ptB[1]);
250 assert(i < geo->_nNbPointTotal);
294 return resTraitement;
298 bool* PointsAGauche,
bool* PointsADroite,
302 bool bPasEnferme =
true;
308 int NbPointsFrontiere = 0;
316 if (NbPointsFrontiere)
337 IndexePointsFrontiere, NbPointsFrontiere,
342 geoTrajet = &geoPremierePasse;
400 bool* PointsAGauche = NULL;
401 bool* PointsADroite = NULL;
403 PointsAGauche, PointsADroite);
412 bool bPasEnfermeAGauche =
CalculTrajet(geoGauche,
true, PointsAGauche, PointsADroite,
413 geoPremierePasseGauche, geoTrajetGauche);
414 if (bPasEnfermeAGauche && geoPremierePasseGauche.
_nNbPolylines > 0)
417 bool bGeoSecondePasseGaucheIntersects =
false;
418 int nNbBouclesPasseGauche = 0;
421 nNbBouclesPasseGauche++;
422 geoGauche.
SecondePasse(geoPremierePasseGauche, geoSecondePasseGauche,
true, pTableauECG,
424 geoGauche.
SecondePasse(geoSecondePasseGauche, geoDernierePasseGauche,
true, pTableauFinG,
426 bGeoSecondePasseGaucheIntersects = geoGauche.
intersects(geoDernierePasseGauche);
427 if (geoPremierePasseGauche.
coincideWith(geoDernierePasseGauche))
432 geoPremierePasseGauche.
Clean();
433 geoPremierePasseGauche.
Copy(geoDernierePasseGauche);
434 }
while (bGeoSecondePasseGaucheIntersects && (nNbBouclesPasseGauche < 4));
436 if (!bGeoSecondePasseGaucheIntersects)
438 geoTrajetGauche = &geoDernierePasseGauche;
442 geoTrajetGauche =
nullptr;
447 bool bPasEnfermeADroite =
CalculTrajet(geoDroite,
false, PointsAGauche, PointsADroite,
448 geoPremierePasseDroite, geoTrajetDroite);
449 if (bPasEnfermeADroite && geoPremierePasseDroite.
_nNbPolylines > 0)
452 bool bGeoSecondePasseDroiteIntersects =
false;
453 int nNbBouclesPasseDroite = 0;
456 nNbBouclesPasseDroite++;
457 geoDroite.
SecondePasse(geoPremierePasseDroite, geoSecondePasseDroite,
false, pTableauECD,
459 geoDroite.
SecondePasse(geoSecondePasseDroite, geoDernierePasseDroite,
false, pTableauFinD,
461 bGeoSecondePasseDroiteIntersects = geoDroite.
intersects(geoDernierePasseDroite);
462 if (geoPremierePasseDroite.
coincideWith(geoDernierePasseDroite))
467 geoPremierePasseDroite.
Clean();
468 geoPremierePasseDroite.
Copy(geoDernierePasseDroite);
469 }
while (bGeoSecondePasseDroiteIntersects && (nNbBouclesPasseDroite < 4));
471 if (!bGeoSecondePasseDroiteIntersects)
473 geoTrajetDroite = &geoDernierePasseDroite;
477 geoTrajetDroite =
nullptr;
525 TableauDePointsSelectionnes, nNbPointsSelectiones, TableauDePointsEC,
false);
531 for (
int i = 0; i < nNbPointsEC; i++)
549 TableauDePointsEC[i - 2], TableauDePointsEC[i - 1], TableauDePointsEC[i]))
556 else if ((A.
x == 0.0f) || (B.
x == 0.0f))
560 TableauDePointsEC[i - 2], TableauDePointsEC[i - 1], TableauDePointsEC[i]))
573 for (k = 0; k < nNbPointsSelectiones; k++)
575 if (TableauDePointsEC[idx] == TableauDePointsSelectionnes[k])
581 for (k = idx; k < nNbPointsSelectiones - 1; k++)
584 TableauDePointsSelectionnes[k] = TableauDePointsSelectionnes[k + 1];
586 nNbPointsSelectiones--;
595 geoTrajetGauche = &geoDernierePasseGauche;
All base classes related to 3D manipulation.
double ABS(double a)
Return the absolute value.
int nNbAbandonsParPointNuples
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.
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.
TYPointParcours * _ListePoint
List of points on the path.
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 INDENTIFIANT_SOURCE
#define INDENTIFIANT_RECEPTEUR
#define SAFE_DELETE_LIST(_p)
Connectivity between points and segments.
double z
z coordinate of the point
bool isInfra
Flag set to indicate if the point is an infrastructure.
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.