-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vec3D.java
75 lines (60 loc) · 1.63 KB
/
Vec3D.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
package co.earthme.wafkbot.math;
public class Vec3D {
private double x;
private double y;
private double z;
private double yaw;
private double pitch;
public Vec3D(double x, double y, double z,double yaw,double pitch) {
this.x = x;
this.y = y;
this.z = z;
this.yaw = yaw;
this.pitch = pitch;
}
public synchronized double getPitch() {
return this.pitch;
}
public synchronized double getYaw() {
return this.yaw;
}
public synchronized void setPitch(double pitch) {
this.pitch = pitch;
}
public synchronized void setYaw(double yaw) {
this.yaw = yaw;
}
public synchronized double getX() {
return this.x;
}
public synchronized double getY() {
return this.y;
}
public synchronized double getZ() {
return this.z;
}
public synchronized void setX(double x){
this.x = x;
}
public synchronized void setY(double y){
this.y = y;
}
public synchronized void setZ(double z){
this.z = z;
}
public synchronized void setRelatively(double delta,Relative target){
switch (target){
case X -> this.x+=delta;
case Y -> this.y+=delta;
case Z -> this.z+=delta;
case YAW -> this.yaw+=delta;
case PITCH -> this.pitch+=delta;
}
}
public synchronized Vec3D copy(){
return new Vec3D(this.x,this.y,this.z,this.yaw,this.pitch);
}
public enum Relative{
X,Y,Z,YAW,PITCH
}
}