@Test void constructors() { Line base = new Line(-1, 2); assertEquals(base.slope, -1); assertEquals(base.intercept, 2); assertFalse(base.isVertical()); Point p1 = new Point(-1000, 1002); Point p2 = new Point(10000, -9998); Line pointSlope1 = new Line(p1, -1); Line pointSlope2 = new Line(p2, -1); assertEquals(pointSlope1, base); assertEquals(pointSlope2, base); assertFalse(pointSlope1.isVertical()); assertFalse(pointSlope2.isVertical()); Line pointPoint = new Line(p1, p2); assertEquals(pointPoint, base); assertFalse(pointPoint.isVertical()); assertThrows(IllegalArgumentException.class, () -> { new Line(Double.NEGATIVE_INFINITY, 0); }); Line posVertical = new Line(new Point(5, 0), Double.NEGATIVE_INFINITY); Line negVertical = new Line(new Point(5, 0), Double.NEGATIVE_INFINITY); assertEquals(posVertical, negVertical); assertEquals(negVertical.slope, Double.NEGATIVE_INFINITY); assertTrue(posVertical.isVertical()); assertTrue(negVertical.isVertical()); Line twoPointVertical = new Line(new Point(-2, -2), new Point(-2, -4)); assertEquals(twoPointVertical.slope, Double.NEGATIVE_INFINITY); assertTrue(twoPointVertical.isVertical()); }
public boolean isVertical() { return this.isVerticalLine; }
Line { public boolean isVertical() { return this.isVerticalLine; } }
Line { public boolean isVertical() { return this.isVerticalLine; } Line(Point p1, Point p2);  Line(Point point, double slope);  Line(double slope, double yIntercept); }
Line { public boolean isVertical() { return this.isVerticalLine; } Line(Point p1, Point p2);  Line(Point point, double slope);  Line(double slope, double yIntercept); double perpendicularSlope(); double evaluate(double x); Point intersect(Line l2); Point nearestLinePoint(Point p); boolean isVertical(); static Point midpoint(Point p1, Point p2); static double distance(Point p1, Point p2); @Override boolean equals(Object o); }
Line { public boolean isVertical() { return this.isVerticalLine; } Line(Point p1, Point p2);  Line(Point point, double slope);  Line(double slope, double yIntercept); double perpendicularSlope(); double evaluate(double x); Point intersect(Line l2); Point nearestLinePoint(Point p); boolean isVertical(); static Point midpoint(Point p1, Point p2); static double distance(Point p1, Point p2); @Override boolean equals(Object o);  }