-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPosition.java
71 lines (57 loc) · 973 Bytes
/
Position.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
import java.io.Serializable;
public class Position implements Serializable
{
private String obj;
private float x;
private float z;
private float rotation;
public Position(float x, float z, float r)
{
this.x = x;
this.z = z;
this.rotation = r;
}
public Position(String obj, float x, float z, float r)
{
this.obj = obj;
this.x = x;
this.z = z;
this.rotation = r;
}
public void change(float dx, float dz, float dr)
{
this.x += dx;
this.z += dz;
this.rotation += dr;
}
public void set(float x, float z, float r)
{
this.x = x;
this.z = z;
this.rotation = r;
}
public float distance2D(Position b)
{
return (float)Math.sqrt((this.x - b.X())*(this.x - b.X()) + (this.z - b.Z())*(this.z - b.Z()));
}
public String OBJ()
{
return obj;
}
public float X()
{
return x;
}
public float Z()
{
return z;
}
public float R()
{
return rotation;
}
public void setR(float R)
{
rotation = R;
}
}