(GraphPoint p, GraphPoint q)
| 8 | private boolean infinite_slope = false; |
| 9 | |
| 10 | public Line(GraphPoint p, GraphPoint q) { |
| 11 | if (Math.abs(p.x - q.x) > epsilon) { // if x�s are different |
| 12 | slope = (p.y - q.y) / (p.x - q.x); // compute slope |
| 13 | intercept = p.y - slope * p.x; // y intercept from y=mx+b |
| 14 | } else { |
| 15 | infinite_slope = true; |
| 16 | intercept = p.x; // x-intercept, since slope is infinite |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | public boolean isEquivalent(double a, double b) { |
| 21 | return (Math.abs(a - b) < epsilon); |