@Test void perpendicularSlope() { Line posSlope = new Line(3, 5); Line negSlope = new Line(-3, -10924); Line horizontalLine = new Line(0, 2); Line verticalLine = new Line(new Point(5, 2), new Point(5, 4)); assertEquals(posSlope.perpendicularSlope(), -1.0/3, MathUtil.EPSILON); assertEquals(negSlope.perpendicularSlope(), 1.0/3, MathUtil.EPSILON); assertEquals(horizontalLine.perpendicularSlope(), Double.NEGATIVE_INFINITY); assertEquals(verticalLine.perpendicularSlope(), 0); }
public double perpendicularSlope() { return -1.0 / slope; }
Line { public double perpendicularSlope() { return -1.0 / slope; } }
Line { public double perpendicularSlope() { return -1.0 / slope; } Line(Point p1, Point p2);  Line(Point point, double slope);  Line(double slope, double yIntercept); }
Line { public double perpendicularSlope() { return -1.0 / slope; } 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 double perpendicularSlope() { return -1.0 / slope; } 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);  }