Class ArtMath

java.lang.Object
com.example.brickpaint.ArtMath

public abstract class ArtMath extends Object
Handles the math required to draw various shapes on the canvas in different directions
Author:
matde
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    compare(double value1, double value2, double range)
    Takes two points on a line and a value, if that value is between the two points the method returns true
    static void
    DrawCircle(double x1, double y1, double x2, double y2, javafx.scene.canvas.GraphicsContext gc, boolean fill)
    Draws a Circle in the desired direction based on the cursor location
    static void
    DrawOval(double x1, double y1, double x2, double y2, javafx.scene.canvas.GraphicsContext gc, boolean fill)
    Draws an oval in the desired direction based on the cursor location
    static void
    DrawPoly(double x1, double y1, double x2, double y2, int sides, javafx.scene.canvas.GraphicsContext gc, boolean fill)
    Draws a Polygon in the desired direction based on the cursor location
    static void
    DrawRect(double x1, double y1, double x2, double y2, javafx.scene.canvas.GraphicsContext gc, boolean fill)
    Draws a Rectangle in the desired direction based on the cursor location
    static void
    DrawRoundedRect(double x1, double y1, double x2, double y2, javafx.scene.canvas.GraphicsContext gc, boolean fill)
    Draws a Rectangle in the desired direction based on the cursor location
    static void
    DrawSquare(double x1, double y1, double x2, double y2, javafx.scene.canvas.GraphicsContext gc, boolean fill)
    Draws a Square in the desired direction based on the cursor location
    static javafx.geometry.Point2D
    getTopLeft(double x1, double y1, double x2, double y2)
    Takes in two points on a rectangle and will return the value of the top left point of the ractangle

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ArtMath

      public ArtMath()
  • Method Details

    • DrawRect

      public static void DrawRect(double x1, double y1, double x2, double y2, javafx.scene.canvas.GraphicsContext gc, boolean fill)
      Draws a Rectangle in the desired direction based on the cursor location
      Parameters:
      x1 - start x cord
      y1 - start y cord
      x2 - mouse x cord
      y2 - mouse y cord
      gc - the graphics content to draw the shape on
      fill - boolean to determine if the shape should be filled in
    • DrawRoundedRect

      public static void DrawRoundedRect(double x1, double y1, double x2, double y2, javafx.scene.canvas.GraphicsContext gc, boolean fill)
      Draws a Rectangle in the desired direction based on the cursor location
      Parameters:
      x1 - start x cord
      y1 - start y cord
      x2 - mouse x cord
      y2 - mouse y cord
      gc - the graphics content to draw the shape on
      fill - boolean to determine if the shape should be filled in
    • DrawSquare

      public static void DrawSquare(double x1, double y1, double x2, double y2, javafx.scene.canvas.GraphicsContext gc, boolean fill)
      Draws a Square in the desired direction based on the cursor location
      Parameters:
      x1 - start x cord
      y1 - start y cord
      x2 - mouse x cord
      y2 - mouse y cord
      gc - the graphics content to draw the shape on
      fill - boolean to determine if the shape should be filled in
    • DrawCircle

      public static void DrawCircle(double x1, double y1, double x2, double y2, javafx.scene.canvas.GraphicsContext gc, boolean fill)
      Draws a Circle in the desired direction based on the cursor location
      Parameters:
      x1 - start x cord
      y1 - start y cord
      x2 - mouse x cord
      y2 - mouse y cord
      gc - the graphics content to draw the shape on
      fill - boolean to determine if the shape should be filled in
    • DrawOval

      public static void DrawOval(double x1, double y1, double x2, double y2, javafx.scene.canvas.GraphicsContext gc, boolean fill)
      Draws an oval in the desired direction based on the cursor location
      Parameters:
      x1 - start x cord
      y1 - start y cord
      x2 - mouse x cord
      y2 - mouse y cord
      gc - the graphics content to draw the shape on
      fill - boolean to determine if the shape should be filled in
    • DrawPoly

      public static void DrawPoly(double x1, double y1, double x2, double y2, int sides, javafx.scene.canvas.GraphicsContext gc, boolean fill)
      Draws a Polygon in the desired direction based on the cursor location
      Parameters:
      x1 - start x cord
      y1 - start y cord
      x2 - mouse x cord
      y2 - mouse y cord
      sides - number of sides polygon should have
      gc - the graphics content to draw the shape on
      fill - boolean to determine if the shape should be filled in
    • compare

      public static boolean compare(double value1, double value2, double range)
      Takes two points on a line and a value, if that value is between the two points the method returns true
      Parameters:
      value1 - first point
      value2 - second point
      range - value to test
      Returns:
      true if value is within range false if not
    • getTopLeft

      public static javafx.geometry.Point2D getTopLeft(double x1, double y1, double x2, double y2)
      Takes in two points on a rectangle and will return the value of the top left point of the ractangle
      Parameters:
      x1 - point 1 x
      y1 - point 1 y
      x2 - point 2 x
      y2 - point 2 y
      Returns:
      Point2D corresponding to the top left of the rectangle