-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVector3D.java
More file actions
56 lines (41 loc) · 855 Bytes
/
Copy pathVector3D.java
File metadata and controls
56 lines (41 loc) · 855 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
52
53
54
55
56
import java.util.ArrayList;
public class Vector3D {
private float x;
private float y;
private float z;
public Vector3D(float x, float y, float z) {
this.x = x;
this.y = y;
this.z = z;
}
public Vector3D(Point3D pInicial, Point3D pFinal) {
x = pFinal.getX() - pInicial.getX();
y = pFinal.getY() - pInicial.getY();
z = pFinal.getZ() - pInicial.getZ();
}
public float getModulo() {
float r = (float) Math.sqrt(x * x + y * y + z * z);
return r;
}
public static void printVector(Vector3D v) {
System.out.println(v.getX() + " , " + v.getY() + " , " + v.getZ());
}
public float getX() {
return x;
}
public float getY() {
return y;
}
public float getZ() {
return z;
}
public void setX(float x) {
this.x = x;
}
public void setY(float y) {
this.y = y;
}
public void setZ(float z) {
this.z = z;
}
}