Class CartesianPositivePlane

java.lang.Object
jaba.cartesian.CartesianPositivePlane

public class CartesianPositivePlane extends Object
This class manages and draws points in a dimensional cartesian plane. This class draws just the first quadrant of the plane.
Author:
Sebastiano Spicuglia
  • Constructor Details

    • CartesianPositivePlane

      public CartesianPositivePlane(Graphics2D g, DPoint origin, int xAxisLength, int yAxisLength, double xMaxValue, double yMaxValue) throws Exception
      Creates a new CartesianPositivePlane object
      Parameters:
      g - the specified Graphics context
      origin - the point on g where to place the origin of the plane
      xAxisLength - the x-axis length
      yAxisLength - the y-axis length
      xMaxValue - the max value of abscissa you want to place on the graph
      yMaxValue - the max value of ordinate you want to place on the graph
      Throws:
      Exception
  • Method Details

    • drawValuesOnXAxis

      public void drawValuesOnXAxis(ArrayList<DPoint> points)
      Draws the value of the abscissa for all points in the @points list.
      Parameters:
      points - an arraylist of points
    • drawValuesOnYAxis

      public void drawValuesOnYAxis(ArrayList<DPoint> points)
      Draws the value of the ordinate for all points in the @points list.
      Parameters:
      points - an arraylist of points
    • drawProjectionOnTheXAxis

      public void drawProjectionOnTheXAxis(DPoint p)
      Draws the the orthogonal projection of the point @p onto the x-axis
      Parameters:
      p - a point
    • drawProjectionOnTheYAxis

      public void drawProjectionOnTheYAxis(DPoint p)
      Draws the the orthogonal projection of the point @p onto the y-axis
      Parameters:
      p - a point
    • draw

      public void draw(String xAxisLabel, String yAxisLabel)
      Draws the plane
      Parameters:
      xAxisLabel - the x-axis label
      yAxisLabel - the y-axis label
    • drawSegment

      public void drawSegment(DPoint p1, DPoint p2)
      Draws a segment between two points
      Parameters:
      p1 - start point
      p2 - end point
    • getTrueX

      public int getTrueX(double x)
      Returns the x-coordinate of the @x point into the graphics context
      Parameters:
      x - a point
      Returns:
      the x-coordinate of the @x point into the graphics context
    • getTrueY

      public int getTrueY(double y)
      Returns the y-coordinate of the @y point into the graphics context
      Parameters:
      y - a point
      Returns:
      the y-coordinate of the @y point into the graphics context
    • getTruePoint

      public DPoint getTruePoint(DPoint p)
      Returns the coordinates of the @p point into the graphics context
      Parameters:
      p - a point
      Returns:
      the coordinates of the @p point into the graphics context
    • getTruePoint

      public DPoint getTruePoint(Point2D p)
      Returns the coordinates of the @p point into the graphics context
      Parameters:
      p - a point
      Returns:
      the coordinates of the @p point into the graphics context
    • getGraphPointFromTruePoint

      public DPoint getGraphPointFromTruePoint(DPoint p)
      Returns the coordinates of the @p point (on the graphics context) into the plane
      Parameters:
      p - a point
      Returns:
      the coordinates of the @p point into the plane