Examples of Polygon


Examples of java.awt.Polygon

    /* (non-Javadoc)
     * @see jsynoptic.plugins.circuit.RectangleCircuitComponent#createSymbol()
     */
    protected Polygon[] createSymbol(){
        Polygon[] res = new Polygon[2];
        res[0] = new Polygon(new int[] {2,5,5,7,5,5,2},new int[] {4,4,3,5,7,6,6},7);
        res[1] = new Polygon(new int[] {6,6,7,7,6,6,8,8},new int[] {2,3,3,7,7,8,8,2},8);
       
        return res;
    }
View Full Code Here

Examples of java.awt.Polygon

    if (coordinates == null || coordinates.length == 0 || coordinates.length % 2 != 0)
    {
      throw new JRRuntimeException("A polygon must have an even number of coordinates");
    }
   
    Polygon polygon = new Polygon();
   
    int i;
    for (i = 0; i < coordinates.length - 2; i += 2)
    {
      polygon.addPoint(coordinates[i], coordinates[i + 1]);
    }
    if (coordinates[i] != coordinates[0] || coordinates[i + 1] != coordinates[1])
    {
      polygon.addPoint(coordinates[i], coordinates[i + 1]);
    }

    return polygon;
  }
View Full Code Here

Examples of javafx.scene.shape.Polygon

        createPolygon(new double[] { 0 * scale, 56 * scale, 10 * scale, 61 * scale, 10 * scale, 96 * scale, 0 * scale, 106 * scale }),
        createPolygon(new double[] { 44 * scale, 61 * scale, 54 * scale, 56 * scale, 54 * scale, 106 * scale, 44 * scale, 96 * scale }) };
  }
 
  protected static Polygon createPolygon(final double... points) {
    final Polygon pg = new Polygon(points);
    pg.setCache(true);
    pg.setCacheHint(CacheHint.SPEED);
    pg.setSmooth(false);
    return pg;
  }
View Full Code Here

Examples of lineage2.commons.geometry.Polygon

                }
              }
              Territory territory = null;
              if (spawnType == 2)
              {
                Polygon poly = new Polygon();
                for (Location loc : coords)
                {
                  poly.add(loc.x, loc.y).setZmin(loc.z).setZmax(loc.z);
                }
                if (!poly.validate())
                {
                  error("invalid spawn territory for instance id : " + instanceId + " - " + poly + "!");
                }
                territory = new Territory().add(poly);
              }
View Full Code Here

Examples of net.fortytwo.twitlogic.model.geo.Polygon

    }

    private void assertCentroid(final double lon,
                                final double lat,
                                final String json) throws Exception {
        Polygon p = new Polygon(new JSONArray(json));
        Point c = p.findCentroid();
        assertEquals(lon, c.getLongitude());
        assertEquals(lat, c.getLatitude());
    }
View Full Code Here

Examples of net.phys2d.raw.shapes.Polygon

        float angle = (float) (i* 2 * Math.PI/noVerts);
        circleVerts[i] = new Vector2f(
            (float) (Math.cos(angle) * radius[i%radius.length]),
            (float) (Math.sin(angle) * radius[i%radius.length]));
      }
      Polygon circlePolygon = new Polygon(circleVerts);
      Body circle = new Body("circle", circlePolygon, 2);
      circle.setPosition(250, 150);
      world.add(circle);
     
      BasicJoint joint = new BasicJoint(ground, circle, new Vector2f(circle.getPosition()));
      world.add(joint);
    }
    {
      int outerCircleVerts = 30;
      int noVerts = 120;
      Vector2f[] circleVerts = new Vector2f[outerCircleVerts+1 + noVerts+1];
      for( int i = 0; i <= outerCircleVerts; i++ ) {
        float angle = (float) (i* 2 * Math.PI/outerCircleVerts);
        circleVerts[i] = new Vector2f(
            (float) (Math.cos(angle) * 150),
            (float) (Math.sin(angle) * 150));
      }
      float[] radius = {140, 133, 133, 140};
      for( int i = 0; i <= noVerts; i++ ) {
        float angle = (float) (i* 2 * Math.PI/noVerts);
        circleVerts[outerCircleVerts+1 + noVerts-i] = new Vector2f(
            (float) (Math.cos(angle) * radius[i%radius.length]),
            (float) (Math.sin(angle) * radius[i%radius.length]));
      }
      Polygon circlePolygon = new Polygon(circleVerts);
      Body circle = new Body("circle", circlePolygon, 30);
      circle.setPosition(250, 220);
      world.add(circle);
    }
   
    {
      int noVerts = 20;
      Vector2f[] circleVerts = new Vector2f[noVerts];
      float[] radius = {30,20,20,30};
      for( int i = 0; i < noVerts; i++ ) {
        float angle = (float) (i* 2 * Math.PI/noVerts);
        circleVerts[i] = new Vector2f(
            (float) (Math.cos(angle) * radius[i%radius.length]),
            (float) (Math.sin(angle) * radius[i%radius.length]));
      }
      Polygon circlePolygon = new Polygon(circleVerts);
      Body circle = new Body("circle", circlePolygon, 2);
      circle.setPosition(250, 300);
      world.add(circle);
     
      Vector2f[] nonConvexPoly = {new Vector2f(-20,-10), new Vector2f(20,-10), new Vector2f(10,0), new Vector2f(20,10), new Vector2f(-20,10), new Vector2f(-10,0)};
      Polygon poly = new Polygon(nonConvexPoly);
      Body nonConvexBody = new Body("poly", poly, 25);
      nonConvexBody.setPosition(250, 400);
      world.add(nonConvexBody);
     
      BasicJoint joint = new BasicJoint(circle,nonConvexBody, new Vector2f(circle.getPosition()));
View Full Code Here

Examples of nu.fw.jeti.plugins.drawing.shapes.Polygon

  /**
   * Stops drawing the polyline, memorizes the shapes in the history, draws
   * it and sends it to other users.
   */
  public void mouseReleased(Double point, int scaleX, int scaleY) { 
    Shape shape = new Polygon(points, color, chat.getMyJID(), isFilled);
    chat.draw(shape);
    points.clear();
    board.setCurrentShape(null);
  }
View Full Code Here

Examples of org.eclipse.draw2d.Polygon

   *            The reference point
   * @return The anchor location
   */
  @Override
  public Point getLocation(Point reference) {
    Polygon owner;
    if (getOwner() instanceof VertexFigure) {
      owner = (Polygon) getOwner().getChildren().get(0);
    } else {
      throw new NullPointerException();
    }

    Point center = getReferencePoint();
    if (reference.x == center.x && reference.y == center.y) {
      return center;
    }

    // The line run
    float run = (reference.x - center.x);

    PointList pointList = owner.getPoints();
    for (int i = 0; i < pointList.size() - 1; i++) {
      Point start = pointList.getPoint(i);
      Point end = pointList.getPoint(i + 1);

      // Translate from relative to absolute coordinates
      owner.translateToAbsolute(start);
      owner.translateToAbsolute(end);

      // Check intersection
      if (Geometry.linesIntersect(center.x, center.y, reference.x,
          reference.y, start.x, start.y, end.x, end.y)) {
        float p = ((float) (start.y - end.y))
View Full Code Here

Examples of org.eclipse.graphiti.mm.algorithms.Polygon

  }
 
  private Polyline createArrow(GraphicsAlgorithmContainer gaContainer) {
    int xy[] = new int[] { -10, -5, 0, 0, -10, 5, -8, 0 };
    int beforeAfter[] = new int[] { 3, 3, 0, 0, 3, 3, 3, 3 };
    Polygon polyline = Graphiti.getGaCreateService().createPolygon(gaContainer, xy, beforeAfter);
    polyline.setStyle(StyleUtil.getStyleForPolygon(getDiagram()));
    return polyline;
  }
View Full Code Here

Examples of org.geojson.Polygon

  /**Convert a multi-polygon to a java.awt.geom.shape.**/
  protected static Shape toArea(MultiPolygon source) {
    Area a = new Area();
    for (List<List<LngLatAlt>> polyPoints: source.getCoordinates()) {
      Polygon part = new Polygon(polyPoints.get(0));
      for (int i=1; i<polyPoints.size();i++) {
        part.addInteriorRing(polyPoints.get(i));
      }
      a.add(toArea(part));
    }
    return a;
  }
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.