use of org.apache.commons.math3.geometry.euclidean.twod.Vector2D in project graphysica by Graphysica.
the class AxeVertical method actualiserPositionEtiquettes.
/**
* Actualise la position des étiquettes de cet axe.
*
* @param toile la toile affichant cet axe.
* @param repere le repère de l'espace à graduer.
*/
private void actualiserPositionEtiquettes(@NotNull final Canvas toile, @NotNull final Repere repere) {
final double abscisseReelleAxe = positionReelleAxe(toile, repere);
positionVirtuelle = positionVirtuelleAxe(toile, repere);
final Iterator<Map.Entry<Double, Etiquette>> iteration = etiquettes.entrySet().iterator();
while (iteration.hasNext()) {
final Map.Entry<Double, Etiquette> entree = iteration.next();
final double valeur = entree.getKey();
final Etiquette etiquette = entree.getValue();
etiquette.setPositionAncrage(new Vector2D(abscisseReelleAxe, valeur));
if (positionVirtuelle >= toile.getWidth() - etiquette.getLargeur()) {
etiquette.setPositionRelative(new Vector2D(toile.getWidth() - positionVirtuelle - etiquette.getLargeur(), -etiquette.getHauteur() / 2));
} else {
etiquette.setPositionRelative(new Vector2D(0, -etiquette.getHauteur() / 2));
}
}
}
use of org.apache.commons.math3.geometry.euclidean.twod.Vector2D in project graphysica by Graphysica.
the class DroiteVerticale method dessiner.
@Override
public void dessiner(@NotNull final Canvas toile, @NotNull final Repere repere) {
if (isVisible(toile, repere)) {
final double abscisseVirtuelle = repere.abscisseVirtuelle(getAbscisse());
origineTrace = new Vector2D(abscisseVirtuelle, 0);
arriveeTrace = new Vector2D(abscisseVirtuelle, toile.getHeight());
dessinerContinue(toile.getGraphicsContext2D());
}
}
use of org.apache.commons.math3.geometry.euclidean.twod.Vector2D in project graphysica by Graphysica.
the class Etiquette method dessinerSurbrillance.
@Override
public void dessinerSurbrillance(@NotNull final Canvas toile, @NotNull final Repere repere) {
final Vector2D coinSuperieurGauche = repere.positionVirtuelle(getPositionAncrage()).add(getPositionRelative());
final GraphicsContext contexteGraphique = toile.getGraphicsContext2D();
contexteGraphique.setStroke(getCouleur());
contexteGraphique.setLineWidth(1);
contexteGraphique.strokeRect(coinSuperieurGauche.getX(), coinSuperieurGauche.getY(), getLargeur(), getHauteur());
}
use of org.apache.commons.math3.geometry.euclidean.twod.Vector2D in project graphysica by Graphysica.
the class Etiquette method dessiner.
@Override
public void dessiner(@NotNull final Canvas toile, @NotNull final Repere repere) {
if (imageFormule == null) {
construireImage();
}
final GraphicsContext contexteGraphique = toile.getGraphicsContext2D();
final Vector2D position = repere.positionVirtuelle(getPositionAncrage()).add(getPositionRelative());
contexteGraphique.drawImage(imageFormule, (int) (position.getX()), (int) (position.getY()));
if (isEnSurbrillance()) {
dessinerSurbrillance(toile, repere);
}
}
use of org.apache.commons.math3.geometry.euclidean.twod.Vector2D in project graphysica by Graphysica.
the class SegmentDroite method distance.
@Override
public double distance(@NotNull final Vector2D curseur, @NotNull final Repere repere) {
final Vector2D p1 = repere.positionVirtuelle(getPoint1());
final Vector2D p2 = repere.positionVirtuelle(getPoint2());
return new Segment(p1, p2, null).distance(curseur);
}
Aggregations