zyps 0.4.1 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/zyps +32 -80
- data/lib/zyps/actions.rb +74 -2
- data/lib/zyps/environmental_factors.rb +16 -0
- data/lib/zyps.rb +90 -17
- data/test/test_zyps.rb +111 -8
- data/test/zyps/test_actions.rb +111 -46
- data/test/zyps/test_behaviors.rb +0 -0
- data/test/zyps/test_environmental_factors.rb +33 -0
- metadata +3 -134
- data/doc/classes/AccelerateAction.html +0 -182
- data/doc/classes/AccelerateAction.src/M000009.html +0 -19
- data/doc/classes/AccelerateAction.src/M000010.html +0 -18
- data/doc/classes/Action.html +0 -118
- data/doc/classes/AgeCondition.html +0 -181
- data/doc/classes/AgeCondition.src/M000039.html +0 -18
- data/doc/classes/AgeCondition.src/M000040.html +0 -18
- data/doc/classes/ApproachAction.html +0 -189
- data/doc/classes/ApproachAction.src/M000048.html +0 -19
- data/doc/classes/ApproachAction.src/M000049.html +0 -38
- data/doc/classes/Behavior.html +0 -202
- data/doc/classes/Behavior.src/M000001.html +0 -18
- data/doc/classes/Behavior.src/M000002.html +0 -19
- data/doc/classes/BlendAction.html +0 -181
- data/doc/classes/BlendAction.src/M000043.html +0 -18
- data/doc/classes/BlendAction.src/M000044.html +0 -18
- data/doc/classes/Clock.html +0 -165
- data/doc/classes/Clock.src/M000041.html +0 -18
- data/doc/classes/Clock.src/M000042.html +0 -21
- data/doc/classes/CollisionCondition.html +0 -148
- data/doc/classes/CollisionCondition.src/M000053.html +0 -18
- data/doc/classes/Color.html +0 -299
- data/doc/classes/Color.src/M000022.html +0 -18
- data/doc/classes/Color.src/M000023.html +0 -16
- data/doc/classes/Color.src/M000024.html +0 -16
- data/doc/classes/Color.src/M000025.html +0 -16
- data/doc/classes/Color.src/M000026.html +0 -18
- data/doc/classes/Color.src/M000027.html +0 -22
- data/doc/classes/Condition.html +0 -118
- data/doc/classes/Creature.html +0 -191
- data/doc/classes/Creature.src/M000011.html +0 -19
- data/doc/classes/Creature.src/M000012.html +0 -18
- data/doc/classes/DestroyAction.html +0 -181
- data/doc/classes/DestroyAction.src/M000030.html +0 -18
- data/doc/classes/DestroyAction.src/M000031.html +0 -18
- data/doc/classes/EatAction.html +0 -149
- data/doc/classes/EatAction.src/M000045.html +0 -21
- data/doc/classes/Enclosure.html +0 -206
- data/doc/classes/Enclosure.src/M000005.html +0 -18
- data/doc/classes/Enclosure.src/M000006.html +0 -31
- data/doc/classes/Environment.html +0 -203
- data/doc/classes/Environment.src/M000046.html +0 -19
- data/doc/classes/Environment.src/M000047.html +0 -45
- data/doc/classes/EnvironmentalFactor.html +0 -118
- data/doc/classes/FaceAction.html +0 -148
- data/doc/classes/FaceAction.src/M000052.html +0 -18
- data/doc/classes/FleeAction.html +0 -189
- data/doc/classes/FleeAction.src/M000054.html +0 -19
- data/doc/classes/FleeAction.src/M000055.html +0 -38
- data/doc/classes/GameObject.html +0 -282
- data/doc/classes/GameObject.src/M000032.html +0 -19
- data/doc/classes/GameObject.src/M000033.html +0 -16
- data/doc/classes/GameObject.src/M000034.html +0 -19
- data/doc/classes/GameObject.src/M000035.html +0 -16
- data/doc/classes/GameObject.src/M000036.html +0 -16
- data/doc/classes/Location.html +0 -167
- data/doc/classes/Location.src/M000021.html +0 -18
- data/doc/classes/ProximityCondition.html +0 -182
- data/doc/classes/ProximityCondition.src/M000037.html +0 -18
- data/doc/classes/ProximityCondition.src/M000038.html +0 -18
- data/doc/classes/TagAction.html +0 -181
- data/doc/classes/TagAction.src/M000028.html +0 -18
- data/doc/classes/TagAction.src/M000029.html +0 -18
- data/doc/classes/TagCondition.html +0 -181
- data/doc/classes/TagCondition.src/M000007.html +0 -18
- data/doc/classes/TagCondition.src/M000008.html +0 -18
- data/doc/classes/TrailsView.html +0 -209
- data/doc/classes/TrailsView.src/M000003.html +0 -40
- data/doc/classes/TrailsView.src/M000004.html +0 -78
- data/doc/classes/TurnAction.html +0 -182
- data/doc/classes/TurnAction.src/M000050.html +0 -19
- data/doc/classes/TurnAction.src/M000051.html +0 -18
- data/doc/classes/Utility.html +0 -264
- data/doc/classes/Utility.src/M000056.html +0 -26
- data/doc/classes/Utility.src/M000057.html +0 -22
- data/doc/classes/Utility.src/M000058.html +0 -18
- data/doc/classes/Utility.src/M000059.html +0 -21
- data/doc/classes/Utility.src/M000060.html +0 -25
- data/doc/classes/Utility.src/M000061.html +0 -21
- data/doc/classes/Utility.src/M000062.html +0 -21
- data/doc/classes/Vector.html +0 -281
- data/doc/classes/Vector.src/M000013.html +0 -19
- data/doc/classes/Vector.src/M000014.html +0 -16
- data/doc/classes/Vector.src/M000015.html +0 -21
- data/doc/classes/Vector.src/M000016.html +0 -16
- data/doc/classes/Vector.src/M000017.html +0 -18
- data/doc/classes/Vector.src/M000018.html +0 -16
- data/doc/classes/Vector.src/M000019.html +0 -18
- data/doc/classes/Vector.src/M000020.html +0 -25
- data/doc/created.rid +0 -1
- data/doc/files/COPYING_LESSER_txt.html +0 -311
- data/doc/files/COPYING_txt.html +0 -1003
- data/doc/files/README_txt.html +0 -214
- data/doc/files/lib/zyps/actions_rb.html +0 -134
- data/doc/files/lib/zyps/conditions_rb.html +0 -134
- data/doc/files/lib/zyps/environmental_factors_rb.html +0 -134
- data/doc/files/lib/zyps/views/trails_rb.html +0 -134
- data/doc/files/lib/zyps_rb.html +0 -134
- data/doc/fr_class_index.html +0 -53
- data/doc/fr_file_index.html +0 -34
- data/doc/fr_method_index.html +0 -88
- data/doc/index.html +0 -24
- data/doc/rdoc-style.css +0 -208
data/doc/classes/Utility.html
DELETED
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
-
<!DOCTYPE html
|
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
-
|
|
6
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
7
|
-
<head>
|
|
8
|
-
<title>Module: Utility</title>
|
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
-
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
|
11
|
-
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
|
12
|
-
<script type="text/javascript">
|
|
13
|
-
// <![CDATA[
|
|
14
|
-
|
|
15
|
-
function popupCode( url ) {
|
|
16
|
-
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function toggleCode( id ) {
|
|
20
|
-
if ( document.getElementById )
|
|
21
|
-
elem = document.getElementById( id );
|
|
22
|
-
else if ( document.all )
|
|
23
|
-
elem = eval( "document.all." + id );
|
|
24
|
-
else
|
|
25
|
-
return false;
|
|
26
|
-
|
|
27
|
-
elemStyle = elem.style;
|
|
28
|
-
|
|
29
|
-
if ( elemStyle.display != "block" ) {
|
|
30
|
-
elemStyle.display = "block"
|
|
31
|
-
} else {
|
|
32
|
-
elemStyle.display = "none"
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Make codeblocks hidden by default
|
|
39
|
-
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
|
40
|
-
|
|
41
|
-
// ]]>
|
|
42
|
-
</script>
|
|
43
|
-
|
|
44
|
-
</head>
|
|
45
|
-
<body>
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
<div id="classHeader">
|
|
50
|
-
<table class="header-table">
|
|
51
|
-
<tr class="top-aligned-row">
|
|
52
|
-
<td><strong>Module</strong></td>
|
|
53
|
-
<td class="class-name-in-header">Utility</td>
|
|
54
|
-
</tr>
|
|
55
|
-
<tr class="top-aligned-row">
|
|
56
|
-
<td><strong>In:</strong></td>
|
|
57
|
-
<td>
|
|
58
|
-
<a href="../files/lib/zyps_rb.html">
|
|
59
|
-
lib/zyps.rb
|
|
60
|
-
</a>
|
|
61
|
-
<br />
|
|
62
|
-
</td>
|
|
63
|
-
</tr>
|
|
64
|
-
|
|
65
|
-
</table>
|
|
66
|
-
</div>
|
|
67
|
-
<!-- banner header -->
|
|
68
|
-
|
|
69
|
-
<div id="bodyContent">
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
<div id="contextContent">
|
|
74
|
-
|
|
75
|
-
<div id="description">
|
|
76
|
-
<p>
|
|
77
|
-
Various methods for working with Vectors, etc.
|
|
78
|
-
</p>
|
|
79
|
-
|
|
80
|
-
</div>
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
</div>
|
|
84
|
-
|
|
85
|
-
<div id="method-list">
|
|
86
|
-
<h3 class="section-bar">Methods</h3>
|
|
87
|
-
|
|
88
|
-
<div class="name-list">
|
|
89
|
-
<a href="#M000062">collided?</a>
|
|
90
|
-
<a href="#M000060">constrain_value</a>
|
|
91
|
-
<a href="#M000056">find_angle</a>
|
|
92
|
-
<a href="#M000057">find_distance</a>
|
|
93
|
-
<a href="#M000061">find_reflection_angle</a>
|
|
94
|
-
<a href="#M000058">to_degrees</a>
|
|
95
|
-
<a href="#M000059">to_radians</a>
|
|
96
|
-
</div>
|
|
97
|
-
</div>
|
|
98
|
-
|
|
99
|
-
</div>
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
<!-- if includes -->
|
|
103
|
-
|
|
104
|
-
<div id="section">
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
<div id="constants-list">
|
|
108
|
-
<h3 class="section-bar">Constants</h3>
|
|
109
|
-
|
|
110
|
-
<div class="name-list">
|
|
111
|
-
<table summary="Constants">
|
|
112
|
-
<tr class="top-aligned-row context-row">
|
|
113
|
-
<td class="context-item-name">PI2</td>
|
|
114
|
-
<td>=</td>
|
|
115
|
-
<td class="context-item-value">Math::PI * 2.0</td>
|
|
116
|
-
</tr>
|
|
117
|
-
</table>
|
|
118
|
-
</div>
|
|
119
|
-
</div>
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
<!-- if method_list -->
|
|
127
|
-
<div id="methods">
|
|
128
|
-
<h3 class="section-bar">Public Class methods</h3>
|
|
129
|
-
|
|
130
|
-
<div id="method-M000062" class="method-detail">
|
|
131
|
-
<a name="M000062"></a>
|
|
132
|
-
|
|
133
|
-
<div class="method-heading">
|
|
134
|
-
<a href="Utility.src/M000062.html" target="Code" class="method-signature"
|
|
135
|
-
onclick="popupCode('Utility.src/M000062.html');return false;">
|
|
136
|
-
<span class="method-name">collided?</span><span class="method-args">(object1, object2)</span>
|
|
137
|
-
</a>
|
|
138
|
-
</div>
|
|
139
|
-
|
|
140
|
-
<div class="method-description">
|
|
141
|
-
<p>
|
|
142
|
-
Given two GameObjects, determine if the boundary of one crosses the
|
|
143
|
-
boundary of the other.
|
|
144
|
-
</p>
|
|
145
|
-
</div>
|
|
146
|
-
</div>
|
|
147
|
-
|
|
148
|
-
<div id="method-M000060" class="method-detail">
|
|
149
|
-
<a name="M000060"></a>
|
|
150
|
-
|
|
151
|
-
<div class="method-heading">
|
|
152
|
-
<a href="Utility.src/M000060.html" target="Code" class="method-signature"
|
|
153
|
-
onclick="popupCode('Utility.src/M000060.html');return false;">
|
|
154
|
-
<span class="method-name">constrain_value</span><span class="method-args">(value, absolute_maximum)</span>
|
|
155
|
-
</a>
|
|
156
|
-
</div>
|
|
157
|
-
|
|
158
|
-
<div class="method-description">
|
|
159
|
-
<p>
|
|
160
|
-
Reduce a number to within an allowed maximum (or minimum, if the number is
|
|
161
|
-
negative).
|
|
162
|
-
</p>
|
|
163
|
-
</div>
|
|
164
|
-
</div>
|
|
165
|
-
|
|
166
|
-
<div id="method-M000056" class="method-detail">
|
|
167
|
-
<a name="M000056"></a>
|
|
168
|
-
|
|
169
|
-
<div class="method-heading">
|
|
170
|
-
<a href="Utility.src/M000056.html" target="Code" class="method-signature"
|
|
171
|
-
onclick="popupCode('Utility.src/M000056.html');return false;">
|
|
172
|
-
<span class="method-name">find_angle</span><span class="method-args">(origin, target)</span>
|
|
173
|
-
</a>
|
|
174
|
-
</div>
|
|
175
|
-
|
|
176
|
-
<div class="method-description">
|
|
177
|
-
<p>
|
|
178
|
-
Get the angle (in degrees) from one <a href="Location.html">Location</a> to
|
|
179
|
-
another.
|
|
180
|
-
</p>
|
|
181
|
-
</div>
|
|
182
|
-
</div>
|
|
183
|
-
|
|
184
|
-
<div id="method-M000057" class="method-detail">
|
|
185
|
-
<a name="M000057"></a>
|
|
186
|
-
|
|
187
|
-
<div class="method-heading">
|
|
188
|
-
<a href="Utility.src/M000057.html" target="Code" class="method-signature"
|
|
189
|
-
onclick="popupCode('Utility.src/M000057.html');return false;">
|
|
190
|
-
<span class="method-name">find_distance</span><span class="method-args">(origin, target)</span>
|
|
191
|
-
</a>
|
|
192
|
-
</div>
|
|
193
|
-
|
|
194
|
-
<div class="method-description">
|
|
195
|
-
<p>
|
|
196
|
-
Get the distance from one <a href="Location.html">Location</a> to another.
|
|
197
|
-
</p>
|
|
198
|
-
</div>
|
|
199
|
-
</div>
|
|
200
|
-
|
|
201
|
-
<div id="method-M000061" class="method-detail">
|
|
202
|
-
<a name="M000061"></a>
|
|
203
|
-
|
|
204
|
-
<div class="method-heading">
|
|
205
|
-
<a href="Utility.src/M000061.html" target="Code" class="method-signature"
|
|
206
|
-
onclick="popupCode('Utility.src/M000061.html');return false;">
|
|
207
|
-
<span class="method-name">find_reflection_angle</span><span class="method-args">(normal, angle)</span>
|
|
208
|
-
</a>
|
|
209
|
-
</div>
|
|
210
|
-
|
|
211
|
-
<div class="method-description">
|
|
212
|
-
<p>
|
|
213
|
-
Given a normal and an angle, find the reflection angle.
|
|
214
|
-
</p>
|
|
215
|
-
</div>
|
|
216
|
-
</div>
|
|
217
|
-
|
|
218
|
-
<div id="method-M000058" class="method-detail">
|
|
219
|
-
<a name="M000058"></a>
|
|
220
|
-
|
|
221
|
-
<div class="method-heading">
|
|
222
|
-
<a href="Utility.src/M000058.html" target="Code" class="method-signature"
|
|
223
|
-
onclick="popupCode('Utility.src/M000058.html');return false;">
|
|
224
|
-
<span class="method-name">to_degrees</span><span class="method-args">(radians)</span>
|
|
225
|
-
</a>
|
|
226
|
-
</div>
|
|
227
|
-
|
|
228
|
-
<div class="method-description">
|
|
229
|
-
<p>
|
|
230
|
-
Convert radians to degrees.
|
|
231
|
-
</p>
|
|
232
|
-
</div>
|
|
233
|
-
</div>
|
|
234
|
-
|
|
235
|
-
<div id="method-M000059" class="method-detail">
|
|
236
|
-
<a name="M000059"></a>
|
|
237
|
-
|
|
238
|
-
<div class="method-heading">
|
|
239
|
-
<a href="Utility.src/M000059.html" target="Code" class="method-signature"
|
|
240
|
-
onclick="popupCode('Utility.src/M000059.html');return false;">
|
|
241
|
-
<span class="method-name">to_radians</span><span class="method-args">(degrees)</span>
|
|
242
|
-
</a>
|
|
243
|
-
</div>
|
|
244
|
-
|
|
245
|
-
<div class="method-description">
|
|
246
|
-
<p>
|
|
247
|
-
Convert degrees to radians.
|
|
248
|
-
</p>
|
|
249
|
-
</div>
|
|
250
|
-
</div>
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
</div>
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
</div>
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
<div id="validator-badges">
|
|
260
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
261
|
-
</div>
|
|
262
|
-
|
|
263
|
-
</body>
|
|
264
|
-
</html>
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
-
<!DOCTYPE html
|
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
-
|
|
6
|
-
<html>
|
|
7
|
-
<head>
|
|
8
|
-
<title>find_angle (Utility)</title>
|
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
-
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
|
-
</head>
|
|
12
|
-
<body class="standalone-code">
|
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/zyps.rb, line 316</span>
|
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Utility</span>.<span class="ruby-identifier">find_angle</span>(<span class="ruby-identifier">origin</span>, <span class="ruby-identifier">target</span>)
|
|
15
|
-
<span class="ruby-comment cmt">#Get vector from origin to target.</span>
|
|
16
|
-
<span class="ruby-identifier">x_difference</span> = <span class="ruby-identifier">target</span>.<span class="ruby-identifier">x</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">origin</span>.<span class="ruby-identifier">x</span>
|
|
17
|
-
<span class="ruby-identifier">y_difference</span> = <span class="ruby-identifier">target</span>.<span class="ruby-identifier">y</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">origin</span>.<span class="ruby-identifier">y</span>
|
|
18
|
-
<span class="ruby-comment cmt">#Get vector's angle.</span>
|
|
19
|
-
<span class="ruby-identifier">radians</span> = <span class="ruby-constant">Math</span>.<span class="ruby-identifier">atan2</span>(<span class="ruby-identifier">y_difference</span>, <span class="ruby-identifier">x_difference</span>)
|
|
20
|
-
<span class="ruby-comment cmt">#Result will range from negative Pi to Pi, so correct it.</span>
|
|
21
|
-
<span class="ruby-identifier">radians</span> <span class="ruby-operator">+=</span> <span class="ruby-constant">PI2</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">radians</span> <span class="ruby-operator"><</span> <span class="ruby-value">0</span>
|
|
22
|
-
<span class="ruby-comment cmt">#Convert to degrees.</span>
|
|
23
|
-
<span class="ruby-identifier">to_degrees</span>(<span class="ruby-identifier">radians</span>)
|
|
24
|
-
<span class="ruby-keyword kw">end</span></pre>
|
|
25
|
-
</body>
|
|
26
|
-
</html>
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
-
<!DOCTYPE html
|
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
-
|
|
6
|
-
<html>
|
|
7
|
-
<head>
|
|
8
|
-
<title>find_distance (Utility)</title>
|
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
-
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
|
-
</head>
|
|
12
|
-
<body class="standalone-code">
|
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/zyps.rb, line 329</span>
|
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Utility</span>.<span class="ruby-identifier">find_distance</span>(<span class="ruby-identifier">origin</span>, <span class="ruby-identifier">target</span>)
|
|
15
|
-
<span class="ruby-comment cmt">#Get vector from origin to target.</span>
|
|
16
|
-
<span class="ruby-identifier">x_difference</span> = <span class="ruby-identifier">origin</span>.<span class="ruby-identifier">x</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">target</span>.<span class="ruby-identifier">x</span>
|
|
17
|
-
<span class="ruby-identifier">y_difference</span> = <span class="ruby-identifier">origin</span>.<span class="ruby-identifier">y</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">target</span>.<span class="ruby-identifier">y</span>
|
|
18
|
-
<span class="ruby-comment cmt">#Get distance.</span>
|
|
19
|
-
<span class="ruby-constant">Math</span>.<span class="ruby-identifier">sqrt</span>(<span class="ruby-identifier">x_difference</span> <span class="ruby-operator">**</span> <span class="ruby-value">2</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">y_difference</span> <span class="ruby-operator">**</span> <span class="ruby-value">2</span>)
|
|
20
|
-
<span class="ruby-keyword kw">end</span></pre>
|
|
21
|
-
</body>
|
|
22
|
-
</html>
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
-
<!DOCTYPE html
|
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
-
|
|
6
|
-
<html>
|
|
7
|
-
<head>
|
|
8
|
-
<title>to_degrees (Utility)</title>
|
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
-
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
|
-
</head>
|
|
12
|
-
<body class="standalone-code">
|
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/zyps.rb, line 338</span>
|
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Utility</span>.<span class="ruby-identifier">to_degrees</span>(<span class="ruby-identifier">radians</span>)
|
|
15
|
-
<span class="ruby-identifier">radians</span> <span class="ruby-operator">/</span> <span class="ruby-constant">PI2</span> <span class="ruby-operator">*</span> <span class="ruby-value">360</span>
|
|
16
|
-
<span class="ruby-keyword kw">end</span></pre>
|
|
17
|
-
</body>
|
|
18
|
-
</html>
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
-
<!DOCTYPE html
|
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
-
|
|
6
|
-
<html>
|
|
7
|
-
<head>
|
|
8
|
-
<title>to_radians (Utility)</title>
|
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
-
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
|
-
</head>
|
|
12
|
-
<body class="standalone-code">
|
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/zyps.rb, line 343</span>
|
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Utility</span>.<span class="ruby-identifier">to_radians</span>(<span class="ruby-identifier">degrees</span>)
|
|
15
|
-
<span class="ruby-identifier">radians</span> = <span class="ruby-identifier">degrees</span> <span class="ruby-operator">/</span> <span class="ruby-value">360.0</span> <span class="ruby-operator">*</span> <span class="ruby-constant">PI2</span>
|
|
16
|
-
<span class="ruby-identifier">radians</span> = <span class="ruby-identifier">radians</span> <span class="ruby-operator">%</span> <span class="ruby-constant">PI2</span>
|
|
17
|
-
<span class="ruby-identifier">radians</span> <span class="ruby-operator">+=</span> <span class="ruby-constant">PI2</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">radians</span> <span class="ruby-operator"><</span> <span class="ruby-value">0</span>
|
|
18
|
-
<span class="ruby-identifier">radians</span>
|
|
19
|
-
<span class="ruby-keyword kw">end</span></pre>
|
|
20
|
-
</body>
|
|
21
|
-
</html>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
-
<!DOCTYPE html
|
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
-
|
|
6
|
-
<html>
|
|
7
|
-
<head>
|
|
8
|
-
<title>constrain_value (Utility)</title>
|
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
-
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
|
-
</head>
|
|
12
|
-
<body class="standalone-code">
|
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/zyps.rb, line 351</span>
|
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Utility</span>.<span class="ruby-identifier">constrain_value</span>(<span class="ruby-identifier">value</span>, <span class="ruby-identifier">absolute_maximum</span>)
|
|
15
|
-
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">value</span>.<span class="ruby-identifier">abs</span> <span class="ruby-operator">></span> <span class="ruby-identifier">absolute_maximum</span>) <span class="ruby-keyword kw">then</span>
|
|
16
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span> <span class="ruby-operator">>=</span> <span class="ruby-value">0</span> <span class="ruby-keyword kw">then</span>
|
|
17
|
-
<span class="ruby-identifier">value</span> = <span class="ruby-identifier">absolute_maximum</span>
|
|
18
|
-
<span class="ruby-keyword kw">else</span>
|
|
19
|
-
<span class="ruby-identifier">value</span> = <span class="ruby-identifier">absolute_maximum</span> <span class="ruby-operator">*</span> <span class="ruby-value">-1</span>
|
|
20
|
-
<span class="ruby-keyword kw">end</span>
|
|
21
|
-
<span class="ruby-keyword kw">end</span>
|
|
22
|
-
<span class="ruby-identifier">value</span>
|
|
23
|
-
<span class="ruby-keyword kw">end</span></pre>
|
|
24
|
-
</body>
|
|
25
|
-
</html>
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
-
<!DOCTYPE html
|
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
-
|
|
6
|
-
<html>
|
|
7
|
-
<head>
|
|
8
|
-
<title>find_reflection_angle (Utility)</title>
|
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
-
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
|
-
</head>
|
|
12
|
-
<body class="standalone-code">
|
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/zyps.rb, line 363</span>
|
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Utility</span>.<span class="ruby-identifier">find_reflection_angle</span>(<span class="ruby-identifier">normal</span>, <span class="ruby-identifier">angle</span>)
|
|
15
|
-
<span class="ruby-identifier">incidence_angle</span> = <span class="ruby-identifier">normal</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">angle</span>
|
|
16
|
-
<span class="ruby-identifier">reflection_angle</span> = <span class="ruby-identifier">normal</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">incidence_angle</span>
|
|
17
|
-
<span class="ruby-identifier">reflection_angle</span> <span class="ruby-operator">%=</span> <span class="ruby-value">360</span>
|
|
18
|
-
<span class="ruby-identifier">reflection_angle</span>
|
|
19
|
-
<span class="ruby-keyword kw">end</span></pre>
|
|
20
|
-
</body>
|
|
21
|
-
</html>
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
-
<!DOCTYPE html
|
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
-
|
|
6
|
-
<html>
|
|
7
|
-
<head>
|
|
8
|
-
<title>collided? (Utility)</title>
|
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
-
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
|
-
</head>
|
|
12
|
-
<body class="standalone-code">
|
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/zyps.rb, line 371</span>
|
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Utility</span>.<span class="ruby-identifier">collided?</span>(<span class="ruby-identifier">object1</span>, <span class="ruby-identifier">object2</span>)
|
|
15
|
-
<span class="ruby-identifier">object1_radius</span> = <span class="ruby-constant">Math</span>.<span class="ruby-identifier">sqrt</span>(<span class="ruby-identifier">object1</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">/</span> <span class="ruby-constant">Math</span><span class="ruby-operator">::</span><span class="ruby-constant">PI</span>)
|
|
16
|
-
<span class="ruby-identifier">object2_radius</span> = <span class="ruby-constant">Math</span>.<span class="ruby-identifier">sqrt</span>(<span class="ruby-identifier">object2</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">/</span> <span class="ruby-constant">Math</span><span class="ruby-operator">::</span><span class="ruby-constant">PI</span>)
|
|
17
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">find_distance</span>(<span class="ruby-identifier">object1</span>.<span class="ruby-identifier">location</span>, <span class="ruby-identifier">object2</span>.<span class="ruby-identifier">location</span>) <span class="ruby-operator"><</span> <span class="ruby-identifier">object1_radius</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">object2_radius</span>
|
|
18
|
-
<span class="ruby-keyword kw">false</span>
|
|
19
|
-
<span class="ruby-keyword kw">end</span></pre>
|
|
20
|
-
</body>
|
|
21
|
-
</html>
|