Package fmg.fmg8.sonstiges

Examples of fmg.fmg8.sonstiges.Zwischenablage


            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


     */
    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

    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

     *          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

     * @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

     */
    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

     */
    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

    /**
     * @return  Eine einfache Variante von <code>this</code>.
     */
    public Polygon2D toEinfach() {
        Polygon2D neu = new Polygon2D(this.nPoints());
        Vektor2D akt;
        Iterator<Vektor2D> it = this.iterator();
        neu.erzwingeEinfach(true);
       
        while (it.hasNext()) {
            akt = it.next();
View Full Code Here

   
    /**
     * @return  Mittelpunkt des Polygons.
     */
    public Vektor2D mittelpunkt() {
        return new Vektor2D(
                this.getBoundingBox().liObEcke().x
                    + this.getBoundingBox().getBreite() / 2,
                this.getBoundingBox().liObEcke().y
                    + this.getBoundingBox().getHoehe() / 2);
    }
View Full Code Here

            final Vektor2D p1,
            final Vektor2D p2,
            final Vektor2D p3,
            final double step) {
       Polygon2D kurve = new Polygon2D((int) (1 / step) + 1);
       Vektor2D punkt;
       Vektor2D dreiP0 = (new Vektor2D(p0));
       Vektor2D dreiP1 = (new Vektor2D(p1));
       Vektor2D dreiP2 = (new Vektor2D(p2));
       Vektor2D sechsP1 = (new Vektor2D(p1));
       dreiP0.mult(3);
       dreiP1.mult(3);
       dreiP2.mult(3);
       sechsP1.mult(6);
       Vektor2D punkt2, punkt3;
       double tQuad, tKub;

       for (double t = 0; t <= 1; t += step) {
           tQuad = t * t;
           tKub = t * tQuad;
          
           punkt = new Vektor2D(dreiP1);
           punkt.sub(p0);
           punkt.sub(dreiP2);
           punkt.add(p3);
           punkt.mult(tKub);
          
           punkt2 = new Vektor2D(dreiP0);
           punkt2.sub(sechsP1);
           punkt2.add(dreiP2);
           punkt2.mult(tQuad);
          
           punkt3 = new Vektor2D(dreiP1);
           punkt3.sub(dreiP0);
           punkt3.mult(t);
          
           punkt.add(punkt2);
           punkt.add(punkt3);
View Full Code Here

TOP

Related Classes of fmg.fmg8.sonstiges.Zwischenablage

Copyright © 2018 www.massapicom. 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.