-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCube.java
More file actions
32 lines (26 loc) · 903 Bytes
/
Cube.java
File metadata and controls
32 lines (26 loc) · 903 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
25
26
27
28
29
30
31
32
package org.example;
import java.util.List;
public class Cube {
List<StereoPoint> points;
public Cube(List<StereoPoint> points) {
if (points.size() == 8)
this.points = points;
else
System.out.println("Error: В кубе должно быть 8 точек!");
}
public List<StereoPoint> getPoints() {
return points;
}
public void setPoints(List<StereoPoint> points) {
if (points.size() == 8)
this.points = points;
else
System.out.println("Error: В кубе должно быть 8 точек!");
}
public double getCubeArea() {
double diagonal = GeometricTools.getLineLength(points.get(0), points.get(2));
System.out.println("Диагональ = " + diagonal);
double cubeArea = Math.pow( diagonal / Math.sqrt(2) , 3);
return cubeArea;
}
}