Package eas.math.geometry

Examples of eas.math.geometry.Polygon2D


    @Override
    public Polygon2D getAgentShape() {
        if (pol == null) {
            final double precision = 17;
            final double radius = 3;
            pol = new Polygon2D();
           
            for (double d = 0; d < Math.PI * 2; d += Math.PI * 2 / precision) {
                pol.add(new Vector2D(Math.sin(d) * radius, Math.cos(d) * radius));
            }
        }
View Full Code Here


    }
   
    public int fixiereAgenten() {
        this.senkeKomplettAb();
        Vector2D aktPos = this.getAgentPosition(0);
        Polygon2D pol = this.getAgentShape(0);
        double angle = this.getAgentAngle(0);
        this.removeAgent(0);
        this.drawTile(pol, aktPos, angle, true);
        return this.deleteLines();
    }
View Full Code Here

        super(id, env, params);
    }
   
    @Override
    public Polygon2D getAgentShape() {
        Polygon2D pol = new Polygon2D();
        Vector2D vec1 = new Vector2D(-1, 0);
        Vector2D vec2 = new Vector2D(0, 0);
        Vector2D vec3 = new Vector2D(0, 1);
        Vector2D vec4 = new Vector2D(1, 1);
        pol.add(vec1);
        pol.add(vec2);
        pol.add(vec3);
        pol.add(vec4);
        return pol;
    }
View Full Code Here

                        && feldPix[i][j] != ConstantsSimulation.FARBE_INP_GEG
                        && feldPix[i][j] != ConstantsSimulation.FARBE_INP_TABU) {
                    dynFarbe = feldPix[i][j] - Byte.MIN_VALUE;

                    if (this.dynWaende[dynFarbe] == null) {
                        this.dynWaende[dynFarbe] = new Polygon2D();
                        this.dynVersch[dynFarbe] = new Vector2D(0, 0);
                        this.dynOldVersch[dynFarbe] = new Vector2D(0, 0);
                        this.dynGesetzt[dynFarbe] = false;
                        this.tatdynDrehMittPkt[dynFarbe]
                                  = new Vector2D(Vector2D.NULL_VECTOR);
View Full Code Here

        if (nummer == 6) {
            ParCollection params = GlobalVariables.getPrematureParameters();
            ArrowMaster zeichnen = new ArrowMaster(params);

            ArrayList<Double> dicken = new ArrayList<Double>();
            Polygon2D bez = new Polygon2D();

            for (double i = 0.5 * Math.PI; i <= Math.PI * 1.5; i += 0.001) {
                bez.add(new Vector2D(
                        -(Math.sin(i) * 4 - Math.sin(0.5 * Math.PI) * 4),
                        -(Math.cos(i) * 4 - Math.cos(0.5 * Math.PI) * 4)));
            }
           
            for (double i = 0; i < bez.nPoints(); i += 1) {
                dicken.add(1.0);
            }

            a = new Pfeilspitze(
                    zeichnen.segmentPfeilPol2D(
View Full Code Here

        double vektorLen;
        double x1d;
        double x2d;
        double y1d;
        double y2d;
        Polygon2D bez;
        ArrayList<Double> dick;
       
        Vector2D pk0, pk1, pk2, pk3;
       
        if (!gebogen) {
            Vector2D p1 = new Vector2D(xx1, yy1);
            Vector2D p2 = new Vector2D(xx2, yy2);
            Polygon2D a = new Polygon2D();
            a.add(p1);
            a.add(p2);
            dick = new ArrayList<Double>(2);
            dick.add(staerke * ConstantsZeichenModi.DICKEN_REG_ST 
                             + this.pfeilDicke);
            dick.add((double) this.pfeilDicke);
           
View Full Code Here

                                   final Vector2D    anfFaktor,
                                   final Vector2D    endFaktor,
                                   final double    gesamtskalierung,
                                   final Vector2D versch) {
       
        Polygon2D pfeilArr = this.segmentPfeilPol2D(
                punkte,
                dicken,
                pfeilAnfang,
                pfeilEnde,
                anfFaktor,
                endFaktor);
       
        return pfeilArr.toPol(gesamtskalierung, versch);
    }
View Full Code Here

            for (int i = 0; i < punkte.nPoints(); i++) {
                dick.add((double) this.pfeilDicke);
            }
        }
       
        Polygon2D pktList1 = new Polygon2D();
        Polygon2D pktList2 = new Polygon2D();

        // Pfeilanfang.
        Vector2D normAnf = new Vector2D(punkte.get(0));
        Vector2D orthoAnf;
        normAnf.sub(punkte.get(1));
        normAnf.norm();
        orthoAnf = new Vector2D(normAnf);
        orthoAnf.ortho();
        Iterator<Vector2D> it1 = pfeilAnfang.iterator();
        Polygon2D zwisch = new Polygon2D();
       
        while (it1.hasNext()) {
            aktVek = it1.next();
            aktVekX = new Vector2D(orthoAnf);
            aktVekY = new Vector2D(normAnf);
            aktVekX.mult(aktVek.x * anfFaktor.x * dick.get(0));
            aktVekY.mult(aktVek.y * anfFaktor.y * dick.get(0));
            aktVek = new Vector2D(aktVekX);
            aktVek.translate(aktVekY);
            aktVek.translate(punkte.get(0));
            zwisch.add(aktVek);
        }
       
        for (int i = zwisch.nPoints() - 1; i >= 0; i--) {
            pktList2.add(zwisch.get(i));
        }

        Polygon2D zwischPunkte;
       
        Vector2D c1 = new Vector2D(punkte.get(1));
        Vector2D c2;
        c1.sub(punkte.get(0));
        c1.ortho();
        c1.norm();
        c1.mult(dick.get(0) / 2);
       
        Vector2D p01 = new Vector2D(punkte.get(0));
        Vector2D p02 = new Vector2D(p01);
        Vector2D p11;
        Vector2D p12;
       
        p01.translate(c1);
        p02.sub(c1);
       
        pktList1.add(p01);
        pktList2.add(p02);
       
        for (int i = 1; i < punkte.nPoints() - 1; i++) {
            zwischPunkte = eas.math.geometry.Geometry2D.schnPkte(
                    punkte.get(i - 1),
                    punkte.get(i),
                    punkte.get(i + 1),
                    dick.get(i));
           
            p = new LineSegment2D(
                    zwischPunkte.get(0),
                    zwischPunkte.get(1));
            q = new LineSegment2D(
                    pktList1.get(pktList1.nPoints() - 1),
                    pktList2.get(pktList2.nPoints() - 1));
           
            if (p.intersects(q) == null) {
                pktList1.add(zwischPunkte.get(0));
                pktList2.add(zwischPunkte.get(1));
            } else {
                StaticMethods.log(StaticMethods.LOG_WARNING,
                              "Segment konnte nicht überschneidungsfrei "
                              + "platziert werden um Pixel: " + punkte.get(i),
                              this.pars,
                              "",
                              punkte.get(i));
                pktList1.add(zwischPunkte.get(0));
                pktList2.add(zwischPunkte.get(1));
            }
        }
       
        c2 = new Vector2D(punkte.get(punkte.nPoints() - 1));
        c2.sub(punkte.get(punkte.nPoints() - 2));
View Full Code Here

            final Polygon2D punkte,
            final ArrayList<Double> dicken,
            final SegSpez[] segBeschr,
            final ParCollection params) {
        Pol2DMitAusgMerkm[] segmente = new Pol2DMitAusgMerkm[segBeschr.length];
        Polygon2D aktPol;
        Polygon2D aktPunkte = new Polygon2D();
        ArrayList<Double> aktDicken = new ArrayList<Double>();
        ArrowMaster zeichnen = new ArrowMaster(params);
        AusgMerkm ausg;
        GradientPaint grad;
        Vector2D p1Old, p2Old, p1, p2, v1, v2, zwisch;
        Color fuell, rahmen;
       
        for (int i = 0; i < segBeschr.length; i++) {
            if (segBeschr[i] != null) {
                aktPunkte.clear();
                aktDicken.clear();
                for (int j = segBeschr[i].getBeginn();
                 j <= segBeschr[i].getEnde(); j++) {
                    aktPunkte.add(punkte.get(j));
                    if (dicken != null) {
                        aktDicken.add(dicken.get(j));
                    } else {
                        aktDicken.add((double) ConstantsZeichenModi.PFEIL_DICKE);
                    }
                 }
               
                aktPol = zeichnen.segmentPfeilPol2D(
                        aktPunkte,
                        aktDicken,
                        segBeschr[i].getPfeilAnfang(),
                        segBeschr[i].getPfeilEnde(),
                        segBeschr[i].getFaktorAnfang(),
                        segBeschr[i].getFaktorEnde());
               
                ausg = segBeschr[i].getAusg();
               
                if (ausg != null && ausg.getGradPaint() != null) {
                    p1Old = new Vector2D(
                            ausg.getGradPaint().getPoint1().getX(),
                            ausg.getGradPaint().getPoint1().getY());
                    p2Old = new Vector2D(
                            ausg.getGradPaint().getPoint2().getX(),
                            ausg.getGradPaint().getPoint2().getY());
                    v1 = new Vector2D(aktPunkte.get(aktPunkte.nPoints() - 1));
                    v1.sub(aktPunkte.get(0));
                    v2 = new Vector2D(v1);
                    v2.ortho();
                   
                    p1 = new Vector2D(v1);
                    p1.mult(p1Old.y);
                    zwisch = new Vector2D(v2);
                    zwisch.mult(p1Old.x);
                    p1.translate(zwisch);
                    p1.translate(aktPunkte.get(0));
                   
                    p2 = new Vector2D(v1);
                    p2.mult(p2Old.y);
                    zwisch = new Vector2D(v2);
                    zwisch.mult(p2Old.x);
                    p2.translate(zwisch);
                    p2.translate(aktPunkte.get(0));
                   
                    grad = new GradientPaint(
                            (float) p1.x,
                            (float) p1.y,
                            ausg.getGradPaint().getColor1(),
View Full Code Here

        this.markierte = new LinkedList<Integer>();
        this.userSegs = new LinkedList<SegSpez>();
        this.setSize(750, 700);
       
        this.aktDicke = eas.startSetup.marbBuilder.zeichenModi.ConstantsZeichenModi.PFEIL_DICKE;
        this.pfeilPol = new Polygon2D();
        this.pars = params;
        this.zeichenArt = new ArrowMaster(this.pars);
        this.segBeschr = new SegSpez[1000];
       
        this.addMouseWheelListener(this);
View Full Code Here

TOP

Related Classes of eas.math.geometry.Polygon2D

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.