Examples of Polygon2D


Examples of eas.math.geometry.Polygon2D

   
    public SutherlandHodgmanClipping() {
        setPreferredSize(new Dimension(600, 500));
        // these subject and clip points are assumed to be valid
        Polygon2D subjPoints = new Polygon2D();
        subjPoints.add(new Vector2D(50, 150));
        subjPoints.add(new Vector2D(200, 50));
        subjPoints.add(new Vector2D(350, 150));
        subjPoints.add(new Vector2D(350, 300));
        subjPoints.add(new Vector2D(250, 300));
        subjPoints.add(new Vector2D(200, 250));
        subjPoints.add(new Vector2D(150, 350));
        subjPoints.add(new Vector2D(100, 250));
        subjPoints.add(new Vector2D(100, 200));
        Polygon2D clipPoints = new Polygon2D();
        clipPoints.add(new Vector2D(125, 40));
        clipPoints.add(new Vector2D(300, 100));
        clipPoints.add(new Vector2D(350, 350));
        clipPoints.add(new Vector2D(200, 350));
        clipPoints.add(new Vector2D(100, 300));
        p1 = new Polygon2D(subjPoints);
        p2 = new Polygon2D(clipPoints);
        result = p1.clipPolygonOneConvex(p2);
    }
View Full Code Here

Examples of eas.math.geometry.Polygon2D

      public String id() {
        return "drive";
      }
    });

    this.shape = new Polygon2D();
    this.shape.add(new Vector2D(-.5, -.5));
    this.shape.add(new Vector2D(-.5, .5));
    this.shape.add(new Vector2D(.5, .5));
    this.shape.add(new Vector2D(.5, -.5));
View Full Code Here

Examples of eas.math.geometry.Polygon2D

    private Polygon2D shape;
   
    @Override
    public synchronized Polygon2D getAgentShape() {
        if (shape == null) {
            shape = new Polygon2D();
            shape.add(new Vector2D(-1, -1));
            shape.add(new Vector2D(-1, 1));
            shape.add(new Vector2D(1, 1));
            shape.add(new Vector2D(1, -1));
//            shape.convertRootPointToMiddle();
View Full Code Here

Examples of eas.math.geometry.Polygon2D

    private Polygon2D shape;

    @Override
    public strictfp Polygon2D getAgentShape() {
        if (shape == null) {
            shape = new Polygon2D();
            shape.add(new Vector2D(-8, 0));
            shape.add(new Vector2D(8, 0));
            shape.add(new Vector2D(8, 2));
            shape.add(new Vector2D(-8, 2));
            shape.translateRootPointToMiddle();
View Full Code Here

Examples of eas.math.geometry.Polygon2D

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

Examples of eas.math.geometry.Polygon2D

    }
   
    @Override
    public Vector2D getPointInVisualization(Vector3D fieldPos) {
        double scale = env.globalScale();
        Polygon2D b = env.getCurrentViewBox().toPol2D();

        b.scale(Vector2D.NULL_VECTOR, new Vector2D(scale, scale));
        Vector2D pos = new Vector2D(fieldPos.x, fieldPos.y);

        if (env.getVisualizationAngleCenterPoint() != null) {
            pos.rotate(env.getVisualizationAngleCenterPoint(), env.getVisualizationAngleRAD());
        }

        pos.scale(Vector2D.NULL_VECTOR, new Vector2D(scale, scale));
        Vector2D midTranslation = new Vector2D(
                env.getScreenWidth() / 2,
                env.getScreenHeight() / 2);
        midTranslation.sub(b.centerPoint());
        pos.translate(midTranslation);

        return pos;
    }
View Full Code Here

Examples of eas.math.geometry.Polygon2D

    @Override
    public Polygon2D getAgentShape() {
        if (pol == null) {
            final double precision = 17;
            final double radius = 15;
            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

Examples of eas.math.geometry.Polygon2D



    @Override
    public Polygon2D getAgentShape() {
        Polygon2D p = new Polygon2D();
        p.add(new Vector2D(-5, -30));
        p.add(new Vector2D(5, -30));
        p.add(new Vector2D(5, 30));
        p.add(new Vector2D(-5, 30));
        return p;
    }
View Full Code Here

Examples of eas.math.geometry.Polygon2D

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

Examples of eas.math.geometry.Polygon2D

                        && 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
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.