float to double (#5118)
This commit is contained in:
committed by
Predrag Maric
parent
278cb53c7f
commit
3824590375
+5
-5
@@ -5,17 +5,17 @@ import java.util.Optional;
|
||||
|
||||
public class LinesIntersectionService {
|
||||
|
||||
public Optional<Point> calculateIntersectionPoint(float m1, float b1, float m2, float b2) {
|
||||
public Optional<Point> calculateIntersectionPoint(double m1, double b1, double m2, double b2) {
|
||||
|
||||
if (m1 == m2) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
float x = (b2 - b1) / (m1 - m2);
|
||||
float y = m1 * x + b1;
|
||||
|
||||
Point point = new Point(Math.round(x), Math.round(y));
|
||||
double x = (b2 - b1) / (m1 - m2);
|
||||
double y = m1 * x + b1;
|
||||
|
||||
Point point = new Point();
|
||||
point.setLocation(x, y);
|
||||
return Optional.of(point);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user