Package eas.math.geometry

Examples of eas.math.geometry.Polygon2D


   
  /* Form des Körpers */
  @Override
  public synchronized Polygon2D getAgentShape() {
    if (shape == null) {
      shape = new Polygon2D();
      shape.add(new Vector2D(-0.5, -0.5));
      shape.add(new Vector2D(-0.5, 0.5));
      shape.add(new Vector2D(0.5, 0.5));
      shape.add(new Vector2D(0.5, -0.5));
    }
View Full Code Here


   
  /* Form des Körpers */
  @Override
  public synchronized Polygon2D getAgentShape() {
    if (shape == null) {
      shape = new Polygon2D();
      shape.add(new Vector2D(-0.5, -0.5));
      shape.add(new Vector2D(-0.5, 0.5));
      shape.add(new Vector2D(0.5, 0.5));
      shape.add(new Vector2D(0.5, -0.5));
    }
View Full Code Here

                   
                    Color c = new Color(a, 100, 100, 100);
                   
                    g.setColor(c);
                   
                    Polygon2D p = new Polygon2D();
                    p.add(v1);
                    p.add(new Vector2D(v1.x, v1.y + this.heightProfileGridHeight));
                    p.add(new Vector2D(v1.x + this.heightProfileGridWidth, v1.y + this.heightProfileGridHeight));
                    p.add(new Vector2D(v1.x + this.heightProfileGridWidth, v1.y));
                    p = this.getPolygonInVisualization(p);
                    Polygon pol = p.toPol();
                   
                    g.drawPolygon(pol);
                    g.fillPolygon(pol);
                    g.drawLine(pol.xpoints[0], pol.ypoints[0], pol.xpoints[2], pol.ypoints[2]);
                }
View Full Code Here

   
    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

      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

    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

    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

    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

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

    @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

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.