Examples of Vektor2D


Examples of fmg.fmg8.umgebung2D.Vektor2D

     *
     * @return  Der Schnittpunkt von g ung h. Wenn die Strecken keinen
     *          Schnittpunkt haben, wird <code>null</code> zur�ckgegeben.
     */
    public Vektor2D schnPkt(final Strecke2D q) {
        Vektor2D vp, vq;
        Gerade2D g, h;
        vp = this.getNormRicht();
        vq = q.getNormRicht();
       
        g = new Gerade2D(this.anfPkt, vp);
        h = new Gerade2D(q.anfPkt, vq);
       
        Vektor2D strSchnPkt = g.schnPkt(h);
       
        if (strSchnPkt == null) {
            return null;
        }
       
        if (strSchnPkt.istInRechteckOR(this.anfPkt, this.endPkt)
            && strSchnPkt.istInRechteckOR(q.anfPkt, q.endPkt)) {
            return strSchnPkt;
        } else {
            return null;
        }
    }
View Full Code Here

Examples of fmg.fmg8.umgebung2D.Vektor2D

     * @param rad  Radius des Kreises.
     */
    public Kreis2D(final double x,
                   final double y,
                   final double rad) {
        this.mittelpunkt = new Vektor2D(x, y);
        this.radius      = rad;
    }
View Full Code Here

Examples of fmg.fmg8.umgebung2D.Vektor2D

     * @param mit  Mittelpunkt des Kreises.
     * @param rad  Radius des Kreises.
     */
    public Kreis2D(final Vektor2D mit,
                   final double rad) {
        this.mittelpunkt = new Vektor2D(mit);
        this.radius      = rad;
    }
View Full Code Here

Examples of fmg.fmg8.umgebung2D.Vektor2D

            final int ident) {

        super(fenstertitel);

        this.skalierung = 1;
        this.verschiebung = new Vektor2D(Vektor2D.NULL_VEKTOR);
       
        this.markierte = new LinkedList<Integer>();
        this.userSegs = new LinkedList<SegSpez>();
        this.setSize(750, 700);
       
        this.aktDicke = fmg.fmg8.graphVis.zeichenModi.Konstanten.PFEIL_DICKE;
        this.pfeilPol = new Polygon2D();
        this.pars = params;
        this.zeichenArt = new PfeilMaster(this.pars);
        this.segBeschr = new SegSpez[1000];
       
        this.addMouseWheelListener(this);
       
        this.addComponentListener(new ComponentListener() {
            @Override
            public void componentHidden(final ComponentEvent e) {

            }

            @Override
            public void componentMoved(final ComponentEvent e) {

            }

            @Override
            public void componentResized(final ComponentEvent e) {
                ZeichFen.this.neuZeichnen();
            }

            @Override
            public void componentShown(final ComponentEvent e) {
               
            }
        }
        );

        this.addMouseMotionListener(new MouseMotionAdapter() {
            public void mouseDragged(final MouseEvent event) {
                Vektor2D vek = new Vektor2D(
                        (event.getX() - verschiebung.x) / skalierung,
                        (event.getY() - verschiebung.y) / skalierung);
                Vektor2D neu;

                if (ZeichFen.this.vekClick != null) {
                    for (int i = 0; i < ZeichFen.this.pfeilPol.size(); i++) {
                        if (ZeichFen.this.markierte.contains(i)) {
                           
                            neu = new Vektor2D(ZeichFen.this.pfeilPol.get(i));
                            neu.add(vek);
                            neu.sub(ZeichFen.this.ersteEcke);
                           
                            ZeichFen.this.pfeilPol.set(i, neu);
                        }
                    }
                   
                    ZeichFen.this.vekClick
                        = ZeichFen.this.containsPoint(vek);

                    ZeichFen.this.ersteEcke = vek;
                   
                    ZeichFen.this.neuZeichnen();
                } else {
                    ZeichFen.this.zweiteEcke
                        = new Vektor2D(
                                (event.getX() - verschiebung.x) / skalierung,
                                (event.getY() - verschiebung.y) / skalierung);
                   
                    ZeichFen.this.neuZeichnen();
                }
            }
        });

        this.addMouseListener(new MouseAdapter() {
            public void mousePressed(final MouseEvent event) {
                Vektor2D vek = new Vektor2D(
                        (event.getX() - verschiebung.x) / skalierung,
                        (event.getY() - verschiebung.y) / skalierung);
               
                ZeichFen.this.ersteEcke = new Vektor2D(vek);
               
                ZeichFen.this.vekClick
                    = ZeichFen.this.containsPoint(vek);
               
                ZeichFen.this.mark1 = ZeichFen.this.mark2;
                ZeichFen.this.mark2 = ZeichFen.this.pfeilPol.realIndexOf(
                        ZeichFen.this.vekClick);
               
                if (ZeichFen.this.mark1 != null
                        && ZeichFen.this.mark1 < 0) {
                    ZeichFen.this.mark1 = null;
                }
                if (ZeichFen.this.mark2 != null
                        && ZeichFen.this.mark2 < 0) {
                    ZeichFen.this.mark2 = null;
                }
               
                if (ZeichFen.this.mark1 != null
                        && !ZeichFen.this.markierte.contains(
                                ZeichFen.this.mark1)) {
                    ZeichFen.this.markierte.add(ZeichFen.this.mark1);
                }
                if (ZeichFen.this.mark2 != null
                        && !ZeichFen.this.markierte.contains(
                                ZeichFen.this.mark2)) {
                    ZeichFen.this.markierte.add(ZeichFen.this.mark2);
                }
            }
           
            public void mouseClicked(final MouseEvent event) {
                Vektor2D vek = new Vektor2D(
                        (event.getX() - verschiebung.x) / skalierung,
                        (event.getY() - verschiebung.y) / skalierung);

                if (event.getButton() == 3) {
                    skaliere();
                    zentriere();
                    return;
                }
               
                if (ZeichFen.this.containsPoint(vek) == null
                        && (ZeichFen.this.mark1 != null
                        || ZeichFen.this.mark2 != null
                        || ZeichFen.this.markierte.size() > 0)) {
                    ZeichFen.this.markierte.clear();
                    ZeichFen.this.mark1 = null;
                    ZeichFen.this.mark2 = null;
                } else {
                    if (ZeichFen.this.vekClick == null
                            && event.getClickCount() >= 2) {
                        ZeichFen.this.pfeilPol.add(new Vektor2D(vek));
                        ZeichFen.this.dicken.add(ZeichFen.this.aktDicke);
                    }
                }
            }
           
View Full Code Here

Examples of fmg.fmg8.umgebung2D.Vektor2D

        AusgMerkm ausgGELBPassiv = new AusgMerkm(
                Color.black, new Color(200, 200, 200), true, true);
        AusgMerkm ausgROTPassiv = new AusgMerkm(
                Color.black, new Color(200, 200, 200), true, true);
        Polygon2D quad = new Polygon2D(4);
        Vektor2D xSub = new Vektor2D(radius * 1.5, 0);
        Vektor2D ySub = new Vektor2D(0, radius * 1.5);
        Vektor2D zwisch;
        zwisch = new Vektor2D(linksOben);
        zwisch.sub(xSub);
        zwisch.sub(ySub);
        quad.add(zwisch);

        zwisch = new Vektor2D(linksOben.x, linksOben.y + radius * 4 + radius);
        zwisch.sub(xSub);
        zwisch.add(ySub);
        quad.add(zwisch);

        zwisch = new Vektor2D(linksOben.x, linksOben.y + radius * 4 + radius);
        zwisch.add(xSub);
        zwisch.add(ySub);
        quad.add(zwisch);

        zwisch = new Vektor2D(linksOben.x, linksOben.y);
        zwisch.add(xSub);
        zwisch.sub(ySub);
        quad.add(zwisch);
       
        AusgMerkm zwAusg = new AusgMerkm(Color.black, Color.black, true, true);
        liste.add(zwAusg);
        liste.add(quad.toPol(1, Vektor2D.NULL_VEKTOR));
View Full Code Here

Examples of fmg.fmg8.umgebung2D.Vektor2D

     * @return  Die Markierungskreise.
     */
    private LinkedList<Kreis2D> fehlerQuellen(final List<AbstractMsg> liste) {
        LinkedList<Kreis2D> kreise = new LinkedList<Kreis2D>();
        final double radius = 10;
        Vektor2D zwisch;
       
        for (AbstractMsg m : liste) {
            if (m.getZusatz() != null
                    && m.getZusatz().getClass().equals(Vektor2D.class)) {
               
                zwisch = new Vektor2D((Vektor2D) m.getZusatz());
                zwisch.mult(skalierung);
                zwisch.add(verschiebung);
                kreise.add(new Kreis2D(zwisch, radius));
            }
        }
       
        return kreise;
View Full Code Here

Examples of fmg.fmg8.umgebung2D.Vektor2D

                        ausg,
                        0,
                        this.pfeilPol.size() - 1,
                        PfeilMaster.DOPPELSPITZES_ENDE,
                        PfeilMaster.EINFACHE_SPITZE_1,
                        new Vektor2D(1, 1),
                        new Vektor2D(1, 1));
               
                this.addSeg(segNeu, false);
               
            }

            segs = this.zeichenArt.erzeugePfeilsegmente(
                    this.pfeilPol,
                    this.dicken,
                    this.segBeschr,
                    this.pars);
           
            liste = Geometrie2D.erzeugeObjList(
                    segs,
                    this.skalierung,
                    this.verschiebung);

            if (this.markiereEcken) {
                AusgMerkm unmark1 = new AusgMerkm(
                        Color.black,
                        Color.white,
                        true,
                        true);
                AusgMerkm unmark2 = new AusgMerkm(
                        Color.black,
                        Color.white,
                        false,
                        false);
                AusgMerkm m1 = new AusgMerkm(
                        Color.black,
                        Color.red,
                        true,
                        true);
                AusgMerkm m2 = new AusgMerkm(
                        Color.black,
                        Color.yellow,
                        true,
                        true);
               
                ArrayList<Integer> markierung
                    = new ArrayList<Integer>(this.markierte.size());
               
                for (int i : this.markierte) {
                    markierung.add(i);
                }
               
                this.zeichenArt.markiereEcken(
                        this.pfeilPol.toPol(
                                this.skalierung,
                                this.verschiebung),
                        liste,
                        markierung,
                        m2,
                        unmark1,
                        4);
               
                markierung.clear();
               
                markierung.add(this.mark1);
                markierung.add(this.mark2);

                this.zeichenArt.markiereEcken(
                        this.pfeilPol.toPol(
                                this.skalierung,
                                this.verschiebung),
                        liste,
                        markierung,
                        m1,
                        unmark2,
                        4);
            }
           
            if (this.ersteEcke != null && this.zweiteEcke != null) {
                Polygon2D quad = new Polygon2D(4);
               
                quad.add(new Vektor2D(this.ersteEcke));
                quad.add(new Vektor2D(this.ersteEcke.x, this.zweiteEcke.y));
                quad.add(new Vektor2D(this.zweiteEcke));
                quad.add(new Vektor2D(this.zweiteEcke.x, this.ersteEcke.y));
               
                liste.add(new AusgMerkm(
                        Color.lightGray,
                        Color.black,
                        true,
                        false));
                liste.add(quad.toPol(this.skalierung, this.verschiebung));
            }
           
            LinkedList<AbstractMsg> msgsError
                = this.pars.getMsgs(
                    (new MsgError(null, 0, null)).getType(),
                    zeit,
                    Long.MAX_VALUE);

            LinkedList<AbstractMsg> msgsWarning
                = this.pars.getMsgs(
                    (new MsgWarning(null, 0, null)).getType(),
                    zeit,
                    Long.MAX_VALUE);

            if (this.fehlerStufe == 2 || !msgsError.isEmpty()) {
                liste.addAll(this.ampel(2, new Vektor2D(50, 50), 7));
            } else if (this.fehlerStufe == 1 || !msgsWarning.isEmpty()) {
                liste.addAll(this.ampel(1, new Vektor2D(50, 50), 7));
            } else {
                liste.addAll(this.ampel(0, new Vektor2D(50, 50), 7));
            }
           
            liste.add(new AusgMerkm(
                    Color.black,
                    Color.red,
View Full Code Here

Examples of fmg.fmg8.umgebung2D.Vektor2D

     * @param bezKonst  Die Bezierkonstante.
     */
    public void bezier(final double bezKonst) {
        double bezK = bezKonst;
        Polygon2D bez;
        Vektor2D v1, v2, v3, v4;
        ArrayList<Integer> mark = new ArrayList<Integer>(4);
       
        if (bezK > 1) {
            bezK = fmg.fmg8.graphVis.zeichenModi.Konstanten.BEZ_NORMAL;
        }
View Full Code Here

Examples of fmg.fmg8.umgebung2D.Vektor2D

                aktSeg,
                m1,
                m2,
                PfeilMaster.EINFACHER_ABSCHLUSS,
                PfeilMaster.EINFACHER_ABSCHLUSS,
                new Vektor2D(1, 1),
                new Vektor2D(1, 1));
       
        this.addSeg(neu, true);
        this.userSegs.add(neu);
    }
View Full Code Here

Examples of fmg.fmg8.umgebung2D.Vektor2D

     * Skaliert die Grafik auf Maximalgr��e relativ zum Zeichenfenster.
     */
    public void skaliere() {
        double xF = this.getWidth();
        double yF = this.getHeight();
        Vektor2D pLO
            = new Vektor2D(this.pfeilPol.getBoundingBox().getLinkObEcke());
        Vektor2D pRU
            = new Vektor2D(this.pfeilPol.getBoundingBox().getRechtUntEcke());
       
        this.skalierung =
            Math.min(xF / (pRU.x - pLO.x), yF / (pRU.y - pLO.y));
        this.skalierung /= 1.2;
    }
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.