-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmissions.py
94 lines (64 loc) · 2.09 KB
/
missions.py
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
class Vec3:
def __init__(self,x,y,z):
self.x = x
self.y = y
self.z = z
class SetFormation:
def __init__(self,x,y,z , formationSide , distance , group):
self.Center = Vec3(x,y,z)
self.formationSide = formationSide
self.distance = distance
self.group = group
class SetHareket:
def __init__(self,x,y,z,group):
self.Hedef = Vec3(x,y,z)
self.group = group
class Groups:
def __init__(self,swarms):
self.swarms = swarms
def init_group(self,swarm_count):
self.swarm_count = swarm_count
self.group = []
self.groups = []
for i in range(self.swarm_count):
self.group.append(i)
self.groups.append(self.group)
def SplitGroup(self,first,swarms):
if len(swarms) == 0 :
return
if len(self.groups[first])==1:
return
new_group = []
for i in swarms:
self.groups[first].remove(i)
new_group.append(i)
self.swarms[i].getInfo()["Grup"] = len(self.groups)
self.groups.append(new_group)
def AppendGroups(self,first,second):
if first == second :
return
new_group = self.groups[second]
for i in new_group:
self.groups[first].append(i)
self.swarms[i].getInfo()["Grup"] = first
self.groups[first].sort()
new_group = self.groups.pop(second)
import math as m
M_PI = m.pi
class pose:
x, y, z = 0, 0, 0
def __init__(self, x, y, z):
self.x = x
self.y = y
self.z = z
def rotate(curr, angle): # Angle in radians
fn = pose(0,0,0);
fn.x = curr.x*m.cos(angle) - curr.y*m.sin(angle);
fn.y = curr.x*m.sin(angle) + curr.y*m.cos(angle);
fn.z = curr.z;
return fn;
def floor_angle(angle):
angle = angle*180/M_PI;
after_point = angle - (int(angle));
remainder = (int(angle))%360;
return (remainder+after_point)*M_PI/180;