Repository navigation
Expand file tree
/
Copy pathPoint3D.java
More file actions
105 lines (95 loc) · 2.13 KB
/
Copy pathPoint3D.java
File metadata and controls
105 lines (95 loc) · 2.13 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
104
105
/**
* Represents a point in 3D space.
*/
public class Point3D {
private double _x;
private double _y;
private double _z;
/**
* Constructs and initializes a Point3D from the specified x, y, z coordinates.
*
* @param x the x coordinate
* @param y the y coordinate
* @param z the z coordinate
*/
public Point3D() {
_x = 0;
_y = 0;
_z = 0;
}
/**
* Constructs and initializes a Point3D from the specified x, y, z coordinates.
*
* @param x the x coordinate
* @param y the y coordinate
* @param z the z coordinate
*/
public Point3D(double x, double y, double z) {
_x = x;
_y = y;
_z = z;
}
/**
* Constructs and initializes a Point3D from the specified Point3D.
*
* @param other the Point3D which the new instance initialization will be based
* on
*/
public Point3D(Point3D other) {
_x = other._x;
_y = other._y;
_z = other._z;
}
/**
* Returns the x coordinate of this Point3D.
*
* @return the x coordinate of this Point3D.
*/
public double getX() {
return _x;
}
/**
* Returns the y coordinate of this Point3D.
*
* @return the y coordinate of this Point3D.
*/
public double getY() {
return _y;
}
/**
* Returns the z coordinate of this Point3D.
*
* @return the z coordinate of this Point3D.
*/
public double getZ() {
return _z;
}
/**
* Sets the x coordinate of this Point3D.
*
* @param num the new x coordinate.
*/
public void setX(double num) {
_x = num;
}
/**
* Sets the y coordinate of this Point3D.
*
* @param num the new y coordinate.
*/
public void setY(double num) {
_y = num;
}
/**
* Sets the z coordinate of this Point3D.
*
* @param num the new z coordinate.
*/
public void setZ(double num) {
_z = num;
}
@Override
public String toString() {
return "(" + _x + ", " + _y + ", " + _z + ")";
}
}