-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathSolution.java
More file actions
24 lines (19 loc) · 873 Bytes
/
Solution.java
File metadata and controls
24 lines (19 loc) · 873 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package project;
import java.awt.*;
import java.util.List;
public class Solution {
List<Triangle> triangles;
public Solution(List<Triangle> triangles) {
this.triangles = triangles;
}
public void drawTriangle(Graphics g, Triangle triangle) {
g.drawLine((int) triangle.p1.x, (int) triangle.p1.y, (int) triangle.p2.x, (int) triangle.p2.y);
g.drawLine((int) triangle.p1.x, (int) triangle.p1.y, (int) triangle.p3.x, (int) triangle.p3.y);
g.drawLine((int) triangle.p2.x, (int) triangle.p2.y, (int) triangle.p3.x, (int) triangle.p3.y);
}
public boolean isRightTriangle(Point p1, Point p2, Point p3) {
return Math.abs(p1.getLength(p2) - p1.getLength(p3)) <= 25
&& Math.abs(p1.getLength(p3) - p2.getLength(p3)) <= 25
&& Math.abs(p1.getLength(p2) - p2.getLength(p3)) <= 25;
}
}