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 Feb 22, 2017
1 parent 8ee2428 commit e43b7dd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
14 changes: 11 additions & 3 deletions pc/src/pathfinding/astar/arcs/CercleArrivee.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import config.Config;
import config.ConfigInfo;
import config.Configurable;
import config.DynamicConfigurable;
import container.Service;
import container.dependances.HighPFClass;
import container.dependances.LowPFClass;
Expand All @@ -44,7 +45,7 @@
*
*/

public class CercleArrivee implements Service, Configurable, Printable, HighPFClass, LowPFClass
public class CercleArrivee implements Service, Configurable, Printable, HighPFClass, LowPFClass, DynamicConfigurable
{
public Vec2RO position;
public double rayon;
Expand All @@ -53,6 +54,7 @@ public class CercleArrivee implements Service, Configurable, Printable, HighPFCl

private double rayonDefaut;
private boolean graphic;
private boolean symetrie = false;

protected Log log;
private PrintBuffer buffer;
Expand All @@ -65,8 +67,8 @@ public CercleArrivee(Log log, PrintBuffer buffer)

private void set(Vec2RO position, double orientationArriveeDStarLite, double rayon, SensFinal sens)
{
this.position = position;
this.arriveeDStarLite = new Vec2RW(rayon, orientationArriveeDStarLite, false);
this.position = new Vec2RO(symetrie ? -position.getX() : position.getX(), position.getY());
this.arriveeDStarLite = new Vec2RW(rayon, symetrie ? Math.PI - orientationArriveeDStarLite : orientationArriveeDStarLite, false);
((Vec2RW)arriveeDStarLite).plus(position);
this.rayon = rayon;
this.sens = sens;
Expand Down Expand Up @@ -139,4 +141,10 @@ public String toString()
{
return position+", rayon "+rayon+", arrivee "+arriveeDStarLite;
}

@Override
public void updateConfig(Config config)
{
symetrie = config.getSymmetry();
}
}
11 changes: 8 additions & 3 deletions pc/src/robot/RobotReal.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public synchronized void updateConfig(Config config)
@Override
public void useConfig(Config config)
{
// c'est le LL qui fournira la position
cinematique = new Cinematique(0, 300, 0, true, 3, Speed.STANDARD.translationalSpeed);
print = config.getBoolean(ConfigInfo.GRAPHIC_ROBOT_AND_SENSORS);
demieLargeurNonDeploye = config.getInt(ConfigInfo.LARGEUR_NON_DEPLOYE)/2;
Expand Down Expand Up @@ -125,13 +126,17 @@ public synchronized void setCinematique(Cinematique cinematique)
synchronized(buffer)
{
// affichage
if(printTrace && cinematique.getPosition() != null && old.distanceFast(cinematique.getPosition()) < 100)
buffer.addSupprimable(new Segment(old, cinematique.getPosition().clone(), Layer.MIDDLE, Couleur.ROUGE.couleur));
else
if(printTrace && old.distanceFast(cinematique.getPosition()) < 100)
buffer.addSupprimable(new Segment(old, cinematique.getPosition().clone(), Layer.FOREGROUND, Couleur.ROUGE.couleur));
else if(print)
buffer.notify();
}
}

/**
* N'est utilisé que pour l'affichage
* @return
*/
public Cinematique getCinematique()
{
return cinematique;
Expand Down

0 comments on commit e43b7dd

Please sign in to comment.