-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPoint.java
More file actions
51 lines (46 loc) · 861 Bytes
/
Point.java
File metadata and controls
51 lines (46 loc) · 861 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
WeChat: cstutorcs
QQ: 749389476
Email: tutorcs@163.com
import java.util.Scanner;
/**
* Coordinate in 3 dimensional Cartesian space
*/
public class Point {
public double x, y, z;
/**
* Default Constructor
*/
Point()
{
x = 0;
y = 0;
z = 0;
}
/**
* Construct a Point from specified
* x, y, and z values
*/
Point(double x, double y, double z)
{
this.x = x;
this.y = y;
this.z = z;
}
/**
* Apply geometric scaling function
*/
void scale(double scalingFactor)
{
x *= scalingFactor;
y *= scalingFactor;
z *= scalingFactor;
}
/**
* Print a point
*/
//void display(std::ostream& outs) const;
public String toString()
{
return "(" + x + ", " + y + ", " + z + ")";
}
}