Examples of Vektor2D


Examples of fmg.fmg8.umgebung2D.Vektor2D

        Iterator<Integer> it2;
        Iterator<Transition> it3;
        Knoten knot;
        Knoten knot1;
        Knoten knot2;
        Vektor2D koord1;
        Vektor2D koord2;

        if (!g.istLeer()) {
            final ArrayList<Knoten> knotenListe
                = new ArrayList<Knoten>(g.holAdj().values());
            int knAnzahl = knotenListe.size();
           
            if (knAnzahl < 2) {
                knAnzahl = 2;
            }
           
            int gitterX = Math.abs(this.rechts - this.links)
                          / (int) ((Math.ceil(Math.sqrt(knAnzahl))) - 1);
            int gitterY = Math.abs(this.unten - this.oben)
                          / (int) ((Math.ceil(Math.sqrt(knAnzahl))) - 1);

            int koordX = this.links;
            int koordY = this.oben;
           
            int kX;
            int kY;
            Transition bed;
            int folgeZustand;
            String bedingung;
            int xAusgleich;
            int zaehler = 0;
           
            // Knoten
            it = knotenListe.iterator();
            while (it.hasNext()) {
                knot = it.next();

                if (this.gesetzteKn.containsKey(knot.holeName())) {
                    kX = (int) this.gesetzteKn.get(knot.holeName()).x;
                    kY = (int) this.gesetzteKn.get(knot.holeName()).y;
                    this.setzeKnoten(knot,
                                     darstellung,
                                     kX,
                                     kY,
                                     (Knoten) ausgKn);

                    if (g.istStartZ(knot)) {
                        darstellung.hinzuPfeil(kX - 60,
                                               kY - 60,
                                               kX - 45,
                                               kY - 45,
                                               0.5,
                                               false);
                    }
                } else {
                    this.setzeKnoten(knot,
                                     darstellung,
                                     koordX,
                                     koordY,
                                     (Knoten) ausgKn);

                    this.gesetzteKn.put(knot.holeName(),
                                        new Vektor2D(koordX, koordY));

                    if (g.istStartZ(knot)) {
                        darstellung.hinzuPfeil(koordX - 60,
                                               koordY - 60,
                                               koordX - 45,
View Full Code Here

Examples of fmg.fmg8.umgebung2D.Vektor2D

     *                werden soll.
     * @param x       X-Koordinate.
     * @param y       Y-Koordinate.
     */
    public void neueKoord(final Knoten knoten, final int x, final int y) {
        Vektor2D koord;

        if (this.gesetzteKn.containsKey(knoten.holeName())) {
            koord = this.gesetzteKn.get(knoten.holeName());
            koord.x = x;
            koord.y = y;
        } else {
            this.gesetzteKn.put(knoten.holeName(), new Vektor2D(x, y));
        }
    }
View Full Code Here

Examples of fmg.fmg8.umgebung2D.Vektor2D

                    this.drehen.set(i, !this.drehen.get(i));
                    this.winkel.set(i, this.random.nextDouble() * 0.5);
                }
            }
            if (this.versch.get(i)) {
                Vektor2D vSchiebg = umg.getDynVersch()[this.waende.get(i)];
                vSchiebg.add(new Vektor2D(
                        this.xRicht.get(i),
                        this.yRicht.get(i)));
               
                if (null != umg.verschWand(
                        this.waende.get(i),
                        vSchiebg)) {
                    this.versch.set(i, !this.versch.get(i));
                    this.xRicht.set(i, this.random.nextDouble() * 0.5);
                    this.yRicht.set(i, this.random.nextDouble() * 0.5);
                }
            } else {
                Vektor2D vSchiebg = umg.getDynVersch()[this.waende.get(i)];
                vSchiebg.add(new Vektor2D(
                        -this.xRicht.get(i),
                        -this.yRicht.get(i)));
               
                if (null != umg.verschWand(
                        this.waende.get(i),
View Full Code Here

Examples of fmg.fmg8.umgebung2D.Vektor2D

            this.versch2--;
        }   

        if (null != umg.verschWand(
                wandNum1,
                new Vektor2D(0, this.versch1 * 2))) {
            this.b1 = !this.b1;
        }

        if (null != umg.verschWand(
                wandNum2,
                new Vektor2D(0, this.versch2 * 2))) {
            this.b2 = !this.b2;
        }
    }
View Full Code Here

Examples of fmg.fmg8.umgebung2D.Vektor2D

     */
    public Vektor2D schneidet(final Strecke2D s1) {
        Strecke2D s2
            = new Strecke2D(this.get(this.nPoints() - 1), this.get(0));
        boolean flip = false;
        Vektor2D schnitt;
       
        for (int i = 1; i <= this.nPoints(); i++) {
            schnitt = s1.schnPkt(s2);
           
            if (schnitt != null) {
View Full Code Here

Examples of fmg.fmg8.umgebung2D.Vektor2D

    private void createBoundingBox() {
        if (this.nPoints() == 0) {
            return;
        }
       
        Vektor2D punkt = this.get(0);
       
        this.boundingBox = new Rechteck2D(punkt, punkt);
       
        for (int i = 1; i < this.nPoints(); i++) {
            this.erweitereBoundingBox(this.get(i));
View Full Code Here

Examples of fmg.fmg8.umgebung2D.Vektor2D

     *          nicht gesetzt werden konnte, wird <code>null</code>
     *          zur�ckgegeben.
     */
    @Override
    public Vektor2D set(final int index, final Vektor2D element) {
        Vektor2D alt = this.get(index);
       
        this.remove(index);
        this.add(index, element);
       
        if (this.garantiereEinfach) {
View Full Code Here

Examples of fmg.fmg8.umgebung2D.Vektor2D

     * @return  Polygon.
     */
    public Polygon toPol(final double skalierung, final Vektor2D versch) {
        Polygon pol = new Polygon();
        Iterator<Vektor2D> it = this.iterator();
        Vektor2D punkt;
       
        while (it.hasNext()) {
            punkt = it.next();
            pol.addPoint((int) (punkt.x * skalierung + versch.x),
                         (int) (punkt.y * skalierung + versch.y));
View Full Code Here

Examples of fmg.fmg8.umgebung2D.Vektor2D

     */
    public void normalisiere2() {
        Polygon2D normArr = new Polygon2D(this.nPoints());
        ArrayList<Double> abstaende = new ArrayList<Double>(this.nPoints());
        Iterator<Vektor2D> it = this.iterator();
        Vektor2D letztV;
        Vektor2D aktV = new Vektor2D(Vektor2D.NULL_VEKTOR);
        double aktAbst;
        double letztAbst;
        Vektor2D aktRicht;
        double durchAbst;
        int i = 0;

        if (this.nPoints() <= 2) {
            return;
        }
       
        letztV = this.get(0);
        letztAbst = 0;
        while (it.hasNext()) {
            aktV = it.next();
           
            aktAbst = aktV.distanz(letztV) + letztAbst;
            abstaende.add(aktAbst);
           
            letztAbst = aktAbst;
            letztV = aktV;
        }

        durchAbst = abstaende.get(abstaende.size() - 1)
                    / (abstaende.size() - 1);
       
        aktV = new Vektor2D(this.get(0));
        normArr.add(aktV);
        aktAbst = 0;
        while (i < this.nPoints()) {
            if (i + 1 < this.nPoints()) {
                aktRicht = new Vektor2D(this.get(i + 1));
                aktRicht.sub(this.get(i));
               
                if (this.get(i).distanz(this.get(i + 1)) >= durchAbst) {
                    aktRicht.laengeFestlegen(durchAbst);
                   
                    while (aktAbst < abstaende.get(i + 1)) {
                        aktV = new Vektor2D(aktV);
                        aktV.add(aktRicht);
                        normArr.add(aktV);
                        aktAbst += durchAbst;
                    }
                } else {
                    double zwischAbst = 0;
                    double aktDist;
                   
                    while (i + 1 < nPoints()) {
                        aktDist = this.get(i).distanz(this.get(i + 1));
                       
                        if (zwischAbst + aktDist
                                < durchAbst) {
                            zwischAbst += aktDist;
                            i++;
                        } else {
                            aktRicht = new Vektor2D(this.get(i + 1));
                            aktRicht.sub(this.get(i));
                            aktRicht.laengeFestlegen(durchAbst - zwischAbst);
                            aktV = new Vektor2D(this.get(i));
                            aktV.add(aktRicht);
                            normArr.add(aktV);
                            aktAbst += durchAbst;
                            break;
                        }
View Full Code Here

Examples of fmg.fmg8.umgebung2D.Vektor2D

     */
    public Polygon2D normalisiere() {
        Polygon2D normArr = new Polygon2D(this.nPoints());
        ArrayList<Double> abstaende = new ArrayList<Double>(this.nPoints());
        Iterator<Vektor2D> it = this.iterator();
        Vektor2D letztV;
        Vektor2D aktV = new Vektor2D(Vektor2D.NULL_VEKTOR);
        double aktAbst;
        double letztAbst;
        Vektor2D aktRicht;
        double durchAbst;
        int i = 0;
       
        if (this.nPoints() <= 1) {
            return this;
        }
       
        letztV = this.get(0);
        letztAbst = 0;
        while (it.hasNext()) {
            aktV = it.next();
           
            aktAbst = aktV.distanz(letztV) + letztAbst;
            abstaende.add(aktAbst);
           
            letztAbst = aktAbst;
            letztV = aktV;
        }

        durchAbst = abstaende.get(abstaende.size() - 1)
                    / (abstaende.size() - 1);
       
        aktV = new Vektor2D(this.get(0));
        normArr.add(aktV);
        aktAbst = 0;
        while (i < this.nPoints()) {
            if (i + 1 < this.nPoints()) {
                aktRicht = new Vektor2D(this.get(i + 1));
                aktRicht.sub(this.get(i));
                aktRicht.laengeFestlegen(durchAbst);
               
                while (aktAbst < abstaende.get(i + 1)) {
                    aktV = new Vektor2D(aktV);
                    aktV.add(aktRicht);
                    normArr.add(aktV);
                    aktAbst += durchAbst;
                }
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.