(ArrayList<Line> lines, Line line)
| 8 | |
| 9 | /* Count lines within an array of lines which are "equivalent" (slope and y-intercept are within an epsilon value) to a given line */ |
| 10 | public static int countEquivalentLines(ArrayList<Line> lines, Line line) { |
| 11 | if (lines == null) { |
| 12 | return 0; |
| 13 | } |
| 14 | |
| 15 | int count = 0; |
| 16 | for (Line parallelLine : lines) { |
| 17 | if (parallelLine.isEquivalent(line)) { |
| 18 | count++; |
| 19 | } |
| 20 | } |
| 21 | return count; |
| 22 | } |
| 23 | |
| 24 | /* Check hashmap for lines that are equivalent. Note that we need to check one epsilon above and below the actual slope |
| 25 | * since we're defining two lines as equivalent if they're within an epsilon of each other. |
no test coverage detected