示例#1
0
  /**
   * Draw a point at (x, y).
   *
   * @param x the x-coordinate of the point
   * @param y the y-coordinate of the point
   */
  public static void point(double x, double y) {
    double r = penRadius; // r is the pen radius

    // double ws = factorX(2*r);
    // double hs = factorY(2*r);
    // if (ws <= 1 && hs <= 1) pixel(x, y);
    if (r <= 1) pixel(x, y);
    else offscreen.fill(ShapeAssist.point(x, y, r));
    draw();
  }
示例#2
0
 /**
  * Draw a filled polygon with the given (x[i], y[i]) coordinates.
  *
  * @param x an array of all the x-coordindates of the polygon
  * @param y an array of all the y-coordindates of the polygon
  */
 public static void filledPolygon(double[] x, double[] y) {
   offscreen.fill(ShapeAssist.polygon(x, y));
   draw();
 }
示例#3
0
 /**
  * Draw a polygon with the given (x[i], y[i]) coordinates.
  *
  * @param x an array of all the x-coordindates of the polygon
  * @param y an array of all the y-coordindates of the polygon
  */
 public static void polygon(double[] x, double[] y) {
   offscreen.draw(ShapeAssist.polygon(x, y));
   draw();
 }
示例#4
0
  /**
   * Draw a filled rectangle of given half width and half height, centred on (x, y) and rotated by d
   * degrees.
   *
   * @param x the x-coordinate of the centre of the rectangle
   * @param y the y-coordinate of the centre of the rectangle
   * @param halfWidth is half the width of the rectangle
   * @param halfHeight is half the height of the rectangle
   * @param degrees is the rotation of the rectangle with 3 o'clock being 0 degrees and 12 o'clock
   *     being 270 degrees
   * @throws RuntimeException if halfWidth or halfHeight is negative
   */
  public static void filledAngledRectangle(
      double x, double y, double halfWidth, double halfHeight, double degrees) {

    offscreen.fill(ShapeAssist.angledRectangle(x, y, halfWidth, halfHeight, degrees));
    draw();
  }
示例#5
0
  /**
   * Draw a rectangle of given half width and half height, centered on (x, y).
   *
   * @param x the x-coordinate of the center of the rectangle
   * @param y the y-coordinate of the center of the rectangle
   * @param halfWidth is half the width of the rectangle
   * @param halfHeight is half the height of the rectangle
   * @throws RuntimeException if halfWidth or halfHeight is negative
   */
  public static void rectangle(double x, double y, double halfWidth, double halfHeight) {

    offscreen.draw(ShapeAssist.rectangle(x, y, halfWidth, halfHeight));
    draw();
  }
示例#6
0
 /**
  * Draw a filled equilateral triangle of radius r, centred at <location>.
  *
  * @param location the Point at the centre of the triangle
  * @param r radius is the length from the centre of the triangle to any of its corners.
  * @throws RuntimeException if r is negative
  */
 public static void filledTriangle(double x, double y, double r) {
   offscreen.fill(ShapeAssist.triangle(x, y, r));
   draw();
 }
示例#7
0
 /**
  * Draw a filled diamond of side length 2r, centred on (x, y).
  *
  * @param x the x-coordinate of the centre of the diamond
  * @param y the y-coordinate of the centre of the diamond
  * @param r radius is half the length of any side of the diamond
  * @throws RuntimeException if r is negative
  */
 public static void filledDiamond(double x, double y, double r) {
   offscreen.fill(ShapeAssist.diamond(x, y, r));
   draw();
 }
示例#8
0
 /**
  * Draw a filled square of side length 2r, centred on (x, y).
  *
  * @param x the x-coordinate of the centre of the square
  * @param y the y-coordinate of the centre of the square
  * @param r radius is half the length of any side of the square
  * @throws RuntimeException if r is negative
  */
 public static void filledSquare(double x, double y, double r) {
   offscreen.fill(ShapeAssist.square(x, y, r));
   draw();
 }
示例#9
0
  /**
   * Draw an arc of radius r, centred on (x, y), from angle1 to angle2 (in degrees).
   *
   * @param x the x-coordinate of the centre of the circle
   * @param y the y-coordinate of the centre of the circle
   * @param r the radius of the circle
   * @param angle1 the starting angle. 0 would mean an arc beginning at 3 o'clock.
   * @param angle2 the angle at the end of the arc. For example, if you want a 90 degree arc, then
   *     angle2 should be angle1 + 90.
   * @throws RuntimeException if the radius of the circle is negative
   */
  public static void arc(double x, double y, double r, double angle1, double angle2) {

    offscreen.draw(ShapeAssist.arc(x, y, r, angle1, angle2));
    draw();
  }
示例#10
0
  /**
   * Draw a filled ellipse with given semimajor and semiminor axes, centred on (x, y).
   *
   * @param x the x-coordinate of the centre of the ellipse
   * @param y the y-coordinate of the centre of the ellipse
   * @param semiMajorAxis is the semimajor axis of the ellipse
   * @param semiMinorAxis is the semiminor axis of the ellipse
   * @throws RuntimeException if either of the axes are negative
   */
  public static void filledEllipse(double x, double y, double semiMajorAxis, double semiMinorAxis) {

    offscreen.fill(ShapeAssist.ellipse(x, y, semiMajorAxis, semiMinorAxis));
    draw();
  }
示例#11
0
 /**
  * Draw filled circle of radius r, centred on (x, y).
  *
  * @param x the x-coordinate of the centre of the circle
  * @param y the y-coordinate of the centre of the circle
  * @param r the radius of the circle
  * @throws RuntimeException if the radius of the circle is negative
  */
 public static void filledCircle(double x, double y, double r) {
   offscreen.fill(ShapeAssist.circle(x, y, r));
   draw();
 }