Skip to content
This repository has been archived by the owner on Mar 3, 2019. It is now read-only.

Commit

Permalink
Symétrie
Browse files Browse the repository at this point in the history
  • Loading branch information
PFGimenez committed May 23, 2017
1 parent 43de62a commit 4c6abcc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
10 changes: 6 additions & 4 deletions pc/src/pathfinding/astar/arcs/ArcManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -383,20 +383,22 @@ public double heuristicDirect(Cinematique cinematique)
public void disableObstaclesFixes(boolean symetrie, CinematiqueObs obs)
{
disabledObstaclesFixes.clear();
ObstaclesFixes depart;
if(symetrie)
disabledObstaclesFixes.add(ObstaclesFixes.ZONE_DEPART_GAUCHE_CENTRE);
depart = ObstaclesFixes.ZONE_DEPART_GAUCHE_CENTRE;
else
disabledObstaclesFixes.add(ObstaclesFixes.ZONE_DEPART_DROITE_CENTRE);
depart = ObstaclesFixes.ZONE_DEPART_DROITE_CENTRE;
disabledObstaclesFixes.add(depart);
for(ObstaclesFixes o : ObstaclesFixes.values())
if(!o.bordure && o.getObstacle().isColliding(obs.obstacle))
{
log.warning("Désactivation de l'obstacle fixe : " + o + ". Obs : " + obs);
disabledObstaclesFixes.add(o);
}
if(!disabledObstaclesFixes.isEmpty())
dstarlite.disableObstaclesFixes(obs.getPosition());
dstarlite.disableObstaclesFixes(obs.getPosition(), depart.getObstacle());
else
dstarlite.disableObstaclesFixes(null);
dstarlite.disableObstaclesFixes(null, depart.getObstacle());
}

public boolean isToCircle()
Expand Down
5 changes: 3 additions & 2 deletions pc/src/pathfinding/dstarlite/DStarLite.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import container.dependances.LowPFClass;
import graphic.PrintBufferInterface;
import graphic.printable.Couleur;
import obstacles.types.Obstacle;

/**
* Recherche de chemin avec replanification rapide.
Expand Down Expand Up @@ -676,9 +677,9 @@ public synchronized void stopContinuousSearch()
rechercheEnCours = false;
}

public void disableObstaclesFixes(Vec2RO position)
public void disableObstaclesFixes(Vec2RO position, Obstacle obstacle)
{
gridspace.disableObstaclesFixes(position);
gridspace.disableObstaclesFixes(position, obstacle);
}

}
9 changes: 4 additions & 5 deletions pc/src/pathfinding/dstarlite/gridspace/GridSpace.java
Original file line number Diff line number Diff line change
Expand Up @@ -292,15 +292,14 @@ public Layer getLayer()
return Layer.MIDDLE;
}

public void disableObstaclesFixes(Vec2RO position)
public void disableObstaclesFixes(Vec2RO position, Obstacle obstacle)
{
// on initialise comme la grille statique classique
grilleStatiqueModif.clear();
grilleStatiqueModif.or(grilleStatique);
if(position != null)
for(int i = 0; i < PointGridSpace.NB_POINTS; i++)
if(grilleStatiqueModif.get(i) && pointManager.get(i).computeVec2().distanceFast(position) < rayonRobotObstaclesFixes)
grilleStatiqueModif.clear(i);
for(int i = 0; i < PointGridSpace.NB_POINTS; i++)
if(grilleStatiqueModif.get(i) && ((position != null && pointManager.get(i).computeVec2().distanceFast(position) < rayonRobotObstaclesFixes) || obstacle.squaredDistance(pointManager.get(i).computeVec2()) == 0))
grilleStatiqueModif.clear(i);
}

}

0 comments on commit 4c6abcc

Please sign in to comment.