-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRead3D.java
38 lines (27 loc) · 870 Bytes
/
Read3D.java
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
33
34
35
36
37
import java.awt.Color;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Scanner;
public class Read3D {
public static void main(String[] args) throws FileNotFoundException {
//File f = new File("3DObjects.txt");
ArrayList<ThreeDObject> objects = new ArrayList<ThreeDObject>();
Scanner read = new Scanner(new File("3DObjects.txt"));
while(read.hasNext()){
double radius = read.nextDouble();
double x = read.nextDouble();
double y = read.nextDouble();
double z = read.nextDouble();
ThreeDPoint p = new ThreeDPoint(x, y, z);
int r = read.nextInt();
int g = read.nextInt();
int b = read.nextInt();
java.awt.Color c = new java.awt.Color(r, g, b);
Sphere shape = new Sphere(radius, p, c);
objects.add(shape);
}
read.close();
System.out.println(objects);
}
}