-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgraphable.java
80 lines (70 loc) · 1.63 KB
/
graphable.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
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
/**
* @author Justin, Sambhu, Monesh
* @version 6.2.23
* Class that represents a 3d object.
*/
public class graphable {
private double x;
private double y;
private double z;
/**
* Default constructor, setting the points for a 3D representation
* @param tX The X coordinate
* @param tY The Y coordinate
* @param tZ The Z coordinante
*/
public graphable (double tX, double tY, double tZ){
x = tX;
y = tY;
z = tZ;
}
/**
* Secondary constructor that is used when Graphable is represented as a 2d object
* @param tX The X coordinate
* @param tY The Y coordinate
*/
public graphable (double tX, double tY){
x = tX;
y = tY;
z = 0;
}
/**
* Getter method for the X coordinate
* @return X coordinate
*/
public double getX (){
return x;
}
/**
* Getter method for the Y coordinate
* @return Y coordinate
*/
public double getY (){
return y;
}
/**
* Getter method for the Z coordinate
* @return Z coordinate
*/
public double getZ (){
return z;
}
/**
* Setting the new point
* @param nX The new X value.
* @param nY The new Y value.
* @param nZ The new Z value.
*/
public void setPoint (double nX, double nY, double nZ){
x = nX;
y = nY;
z = nZ;
}
/**
* overrides the toString function for debugging
* @return the string in a new format
*/
public String toString() {
return getX() + " " + getY() + " " + getZ();
}
}