forked from Jus973/baseball-hit-trax
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot.java
More file actions
103 lines (79 loc) · 2.44 KB
/
Copy pathplot.java
File metadata and controls
103 lines (79 loc) · 2.44 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
import java.util.ArrayList;
/**
* Stores the X, Y, and Z axis along with all the lines
* as seen in matplotlib- essentially the base 3d graph function
*/
public class plot {
//can have plot change size based on constructors
private final double INTERVAL_ = 1;
private final double DISTANCE_ = 10;
private int numWide;
private int numLong;
private int numTall;
private ArrayList<graphableLine> axis;
/**
* No-args constructor for plot. It sets every value to 10.
*/
public plot (){
numWide = 10;
numLong = 10;
numTall = 10;
axis = new ArrayList<graphableLine>();
defineAxisArr();
}
/**
* Main constructor for plot, setting each size
* of the plot to be a given value
* @param w The number of X axis lines
* @param l The number of Y axis lines
* @param t The number of Z axis lines
*/
public plot (int w, int l, int t){
numWide = w;
numLong = l;
numTall = t;
axis = new ArrayList<graphableLine>();
defineAxisArr();
}
private void defineAxisArr (){
double temp = 0;
for (int i = 0; i < numWide + 1; i++){
axis.add(new graphableLine(temp, 0, 0, temp, DISTANCE_, 0));
temp += INTERVAL_;
}
temp = 0;
for (int i = 0; i < numLong + 1; i++){
axis.add(new graphableLine(0, temp, 0, DISTANCE_, temp, 0));
temp += INTERVAL_;
}
//z axis
temp = 0;
for (int i = 0; i < numWide + 1; i++){
axis.add(new graphableLine (temp, 0, 0, temp, 0, DISTANCE_));
temp += INTERVAL_;
}
temp = 0;
for (int i = 0; i < numLong + 1; i++){
axis.add(new graphableLine (0, temp, 0, 0, temp, DISTANCE_));
temp += INTERVAL_;
}
//sideways z axis things
temp = 0;
for (int i = 0; i < numTall + 1; i++){
axis.add(new graphableLine (0, 0, temp, DISTANCE_, 0, temp));
temp += INTERVAL_;
}
temp = 0;
for (int i = 0; i < numTall + 1; i++){
axis.add(new graphableLine(0, 0, temp, 0, DISTANCE_, temp));
temp += INTERVAL_;
}
}
/**
* Getter method for all the axis
* @return The X-Axis
*/
public ArrayList<graphableLine> getAxis (){
return axis;
}
}