BAEL-2151 code moved to algorithms module (#5141)

This commit is contained in:
Predrag Maric
2018-09-02 12:06:04 +02:00
committed by GitHub
parent c0b78ee35e
commit a32904fc19
2 changed files with 2 additions and 2 deletions
@@ -1,21 +0,0 @@
package com.baeldung.linesintersection;
import java.awt.Point;
import java.util.Optional;
public class LinesIntersectionService {
public Optional<Point> calculateIntersectionPoint(double m1, double b1, double m2, double b2) {
if (m1 == m2) {
return Optional.empty();
}
double x = (b2 - b1) / (m1 - m2);
double y = m1 * x + b1;
Point point = new Point();
point.setLocation(x, y);
return Optional.of(point);
}
}