forked from miuramiure/Powergrid_Artisoc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlib_miura.inc
83 lines (58 loc) · 1.86 KB
/
lib_miura.inc
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
Function distance_agt(agt1 as Agt, agt2 as Agt) as Double{
//2つのエージェントの間の距離を取得する関数
//空間を取得する(agt1の空間を取得して距離計算に使う)
Dim sp as Space
Dim agt_type as AgtType
agt_type=SpecifyAgtType(agt1)
sp=GetRideSpace(agt_type)
//距離を計算する
dim distance as Double
distance=MeasureDistance(agt1.X, agt1.Y, agt2.X, agt2.Y, sp)
return(distance)
}
//----------------------------------------------------------
Function direction_agt(agt1 as Agt, agt2 as Agt) as Double{
//agt1から見たagt2の角度を取得する関数
//空間を取得する(agt1の空間を取得して角度計算に使う)
Dim sp as Space
Dim agt_type as AgtType
agt_type=SpecifyAgtType(agt1)
sp=GetRideSpace(agt_type)
//角度を計算する
dim direction as Double
direction=GetDirection(agt1.X, agt1.Y, agt2.X, agt2.Y, sp)
return(direction)
}
//----------------------------------------------------------
Function AgtTypeComp(agt1 as Agt, agt2 as Agt) as Integer{
//agt1とagt2のタイプが一致するとき1,一致しないとき0を出力する
Dim agt_type1 as String
Dim agt_type2 as String
Dim answer as Integer
//それぞれのエージェントタイプを文字列として取得する
agt_type1=CStr(SpecifyAgtType(agt1))
agt_type2=CStr(SpecifyAgtType(agt2))
//文字列が一致していれば1,一致していなければ0を出力する
If StrComp(agt_type1,agt_type2)==0 then
answer=1
Else
answer=0
End if
return(answer)
}
//----------------------------------------------------------
Function AgtTypeComp2(agt1 as Agt, agt_type_str as String) as Integer{
//agt1のタイプ名がagt_type_strと一致するとき1,一致しないとき0を出力する
//agt_type_strは"Universe.空間名.種別名"という形で記述する
Dim agt_type as String
Dim answer as Integer
//それぞれのエージェントタイプを文字列として取得する
agt_type=CStr(SpecifyAgtType(agt1))
//文字列が一致していれば1,一致していなければ0を出力する
If StrComp(agt_type,agt_type_str)==0 then
answer=1
Else
answer=0
End if
return(answer)
}