Class Line

java.lang.Object
davidmarino.model.mapmodels.Line

public class Line extends Object
Class Line models a segment and exists in euclidean space.
  • Field Details

    • A

      public Point A
    • B

      public Point B
    • m

      public double m
      The slope of segment AB.
    • b

      public double b
      The y index of segment AB.
    • isVertical

      public boolean isVertical
  • Constructor Details

    • Line

      public Line(Point A, Point B)
      Constructs Line using point A and B.
      Parameters:
      A - point
      B - point
    • Line

      public Line(Point A, Point B, double m, double b, boolean isVertical)
      Line copy constructor
      Parameters:
      A - point
      B - point
      m - is slope
      b - is y index
  • Method Details

    • findBisector

      public Line findBisector()
      Finds the bisector line of this line and returns it as a new line.
      Returns:
      Line
    • drawLine

      public static void drawLine(Graphics2D g2, Line line, Color color)
      Draws line using render library Graphics2D.
      Parameters:
      g2 - is the render library
      line - to be rendered
      color - of the line
    • toString

      public String toString()
      Overrides:
      toString in class Object