Search in sources :

Example 6 with Vector2D

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));
        }
    }
}
Also used : Vector2D(org.apache.commons.math3.geometry.euclidean.twod.Vector2D) Map(java.util.Map)

Example 7 with Vector2D

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());
    }
}
Also used : Vector2D(org.apache.commons.math3.geometry.euclidean.twod.Vector2D)

Example 8 with Vector2D

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());
}
Also used : Vector2D(org.apache.commons.math3.geometry.euclidean.twod.Vector2D) GraphicsContext(javafx.scene.canvas.GraphicsContext)

Example 9 with Vector2D

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);
    }
}
Also used : Vector2D(org.apache.commons.math3.geometry.euclidean.twod.Vector2D) GraphicsContext(javafx.scene.canvas.GraphicsContext)

Example 10 with Vector2D

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);
}
Also used : Vector2D(org.apache.commons.math3.geometry.euclidean.twod.Vector2D) Segment(org.apache.commons.math3.geometry.euclidean.twod.Segment)

Aggregations

Vector2D (org.apache.commons.math3.geometry.euclidean.twod.Vector2D)26 Map (java.util.Map)6 ArrayList (java.util.ArrayList)5 HashSet (java.util.HashSet)4 List (java.util.List)4 Set (java.util.Set)4 Collectors (java.util.stream.Collectors)4 Point2d (javax.vecmath.Point2d)4 Point3d (javax.vecmath.Point3d)4 Tweed (org.twak.tweed.Tweed)4 TweedSettings (org.twak.tweed.TweedSettings)4 Line (org.twak.utils.Line)4 Material (com.jme3.material.Material)3 ColorRGBA (com.jme3.math.ColorRGBA)3 Geometry (com.jme3.scene.Geometry)3 Mesh (com.jme3.scene.Mesh)3 Node (com.jme3.scene.Node)3 VertexBuffer (com.jme3.scene.VertexBuffer)3 Collections (java.util.Collections)3 Comparator (java.util.Comparator)3