-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStatistics.java
More file actions
35 lines (30 loc) · 801 Bytes
/
Statistics.java
File metadata and controls
35 lines (30 loc) · 801 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
33
34
35
/* Statistics.java
* Created by William Tyas
* 1/6/18
*
* This class contains methods to calculate the statistics associated
* with spheres used in the ray tracer.
*/
import java.util.*;
import java.io.*;
public class Statistics {
private ArrayList<Sphere> spheres;
public Statistics(ArrayList<Sphere> spheres) {
this.spheres = spheres;
}
/*
* Generates a csv file containing the (x, y, z) coordinates of the
* center of each sphere in the ray tracer.
*/
public void generateUsefulInfo() {
try {
PrintStream output = new PrintStream(new File("stats.csv"));
output.println("x,y,z");
for (int i = 0; i < spheres.size(); i++) {
output.println(spheres.get(i));
}
} catch (FileNotFoundException f) {
System.err.println("File could not be created.");
}
}
}