zyps 0.2.1 → 0.3.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/README.txt +0 -14
- data/bin/zyps +240 -28
- data/bin/zyps_demo +18 -2
- data/doc/classes/Behavior.html +205 -0
- data/doc/classes/Behavior.src/M000003.html +18 -0
- data/doc/classes/Behavior.src/M000004.html +19 -0
- data/doc/classes/Clock.html +165 -0
- data/doc/classes/Clock.src/M000026.html +18 -0
- data/doc/classes/Clock.src/M000027.html +21 -0
- data/doc/classes/Color.html +299 -0
- data/doc/classes/Color.src/M000015.html +18 -0
- data/doc/classes/Color.src/M000016.html +16 -0
- data/doc/classes/Color.src/M000017.html +16 -0
- data/doc/classes/Color.src/M000018.html +16 -0
- data/doc/classes/Color.src/M000019.html +18 -0
- data/doc/classes/Color.src/M000020.html +22 -0
- data/doc/classes/Creature.html +176 -0
- data/doc/classes/Creature.src/M000005.html +19 -0
- data/doc/classes/Environment.html +203 -0
- data/doc/classes/Environment.src/M000028.html +19 -0
- data/doc/classes/Environment.src/M000029.html +45 -0
- data/doc/classes/EnvironmentalFactor.html +167 -0
- data/doc/classes/EnvironmentalFactor.src/M000021.html +18 -0
- data/doc/classes/GameObject.html +256 -0
- data/doc/classes/GameObject.src/M000022.html +20 -0
- data/doc/classes/GameObject.src/M000023.html +19 -0
- data/doc/classes/GameObject.src/M000024.html +16 -0
- data/doc/classes/GameObject.src/M000025.html +16 -0
- data/doc/classes/Location.html +167 -0
- data/doc/classes/Location.src/M000014.html +18 -0
- data/doc/classes/Responsive.html +143 -0
- data/doc/classes/Responsive.src/M000030.html +18 -0
- data/doc/classes/TrailsView.html +217 -0
- data/doc/classes/TrailsView.src/M000001.html +40 -0
- data/doc/classes/TrailsView.src/M000002.html +76 -0
- data/doc/classes/Utility.html +264 -0
- data/doc/classes/Utility.src/M000031.html +26 -0
- data/doc/classes/Utility.src/M000032.html +22 -0
- data/doc/classes/Utility.src/M000033.html +18 -0
- data/doc/classes/Utility.src/M000034.html +21 -0
- data/doc/classes/Utility.src/M000035.html +25 -0
- data/doc/classes/Utility.src/M000036.html +21 -0
- data/doc/classes/Utility.src/M000037.html +22 -0
- data/doc/classes/Vector.html +281 -0
- data/doc/classes/Vector.src/M000006.html +19 -0
- data/doc/classes/Vector.src/M000007.html +16 -0
- data/doc/classes/Vector.src/M000008.html +21 -0
- data/doc/classes/Vector.src/M000009.html +16 -0
- data/doc/classes/Vector.src/M000010.html +18 -0
- data/doc/classes/Vector.src/M000011.html +16 -0
- data/doc/classes/Vector.src/M000012.html +18 -0
- data/doc/classes/Vector.src/M000013.html +25 -0
- data/doc/created.rid +1 -0
- data/doc/files/COPYING_LESSER_txt.html +311 -0
- data/doc/files/COPYING_txt.html +1003 -0
- data/doc/files/README_txt.html +214 -0
- data/doc/files/lib/zyps/views/trails_rb.html +134 -0
- data/doc/files/lib/zyps_rb.html +134 -0
- data/doc/fr_class_index.html +38 -0
- data/doc/fr_file_index.html +31 -0
- data/doc/fr_method_index.html +63 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/lib/zyps/views/trails.rb +3 -3
- metadata +81 -6
- data/bin/zyps_server +0 -178
@@ -0,0 +1,26 @@
|
|
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>
|
@@ -0,0 +1,22 @@
|
|
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>
|
@@ -0,0 +1,18 @@
|
|
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>
|
@@ -0,0 +1,21 @@
|
|
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>
|
@@ -0,0 +1,25 @@
|
|
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>
|
@@ -0,0 +1,21 @@
|
|
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>
|
@@ -0,0 +1,22 @@
|
|
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>inside_box? (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">inside_box?</span>(<span class="ruby-identifier">point</span>, <span class="ruby-identifier">upper_left</span>, <span class="ruby-identifier">lower_right</span>)
|
15
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">point</span>.<span class="ruby-identifier">x</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">upper_left</span>.<span class="ruby-identifier">x</span>
|
16
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">point</span>.<span class="ruby-identifier">y</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">upper_left</span>.<span class="ruby-identifier">y</span>
|
17
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">point</span>.<span class="ruby-identifier">x</span> <span class="ruby-operator">></span> <span class="ruby-identifier">lower_right</span>.<span class="ruby-identifier">x</span>
|
18
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">point</span>.<span class="ruby-identifier">y</span> <span class="ruby-operator">></span> <span class="ruby-identifier">lower_right</span>.<span class="ruby-identifier">y</span>
|
19
|
+
<span class="ruby-keyword kw">true</span>
|
20
|
+
<span class="ruby-keyword kw">end</span></pre>
|
21
|
+
</body>
|
22
|
+
</html>
|
@@ -0,0 +1,281 @@
|
|
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>Class: Vector</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>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">Vector</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
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
Object
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
<div id="description">
|
82
|
+
<p>
|
83
|
+
An object or force‘s velocity. Has speed and angle components.
|
84
|
+
</p>
|
85
|
+
|
86
|
+
</div>
|
87
|
+
|
88
|
+
|
89
|
+
</div>
|
90
|
+
|
91
|
+
<div id="method-list">
|
92
|
+
<h3 class="section-bar">Methods</h3>
|
93
|
+
|
94
|
+
<div class="name-list">
|
95
|
+
<a href="#M000013">+</a>
|
96
|
+
<a href="#M000006">new</a>
|
97
|
+
<a href="#M000007">pitch</a>
|
98
|
+
<a href="#M000008">pitch=</a>
|
99
|
+
<a href="#M000009">x</a>
|
100
|
+
<a href="#M000010">x=</a>
|
101
|
+
<a href="#M000011">y</a>
|
102
|
+
<a href="#M000012">y=</a>
|
103
|
+
</div>
|
104
|
+
</div>
|
105
|
+
|
106
|
+
</div>
|
107
|
+
|
108
|
+
|
109
|
+
<!-- if includes -->
|
110
|
+
|
111
|
+
<div id="section">
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
<div id="attribute-list">
|
118
|
+
<h3 class="section-bar">Attributes</h3>
|
119
|
+
|
120
|
+
<div class="name-list">
|
121
|
+
<table>
|
122
|
+
<tr class="top-aligned-row context-row">
|
123
|
+
<td class="context-item-name">speed</td>
|
124
|
+
<td class="context-item-value"> [RW] </td>
|
125
|
+
<td class="context-item-desc">
|
126
|
+
The length of the <a href="Vector.html">Vector</a>.
|
127
|
+
|
128
|
+
</td>
|
129
|
+
</tr>
|
130
|
+
</table>
|
131
|
+
</div>
|
132
|
+
</div>
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
<!-- if method_list -->
|
137
|
+
<div id="methods">
|
138
|
+
<h3 class="section-bar">Public Class methods</h3>
|
139
|
+
|
140
|
+
<div id="method-M000006" class="method-detail">
|
141
|
+
<a name="M000006"></a>
|
142
|
+
|
143
|
+
<div class="method-heading">
|
144
|
+
<a href="Vector.src/M000006.html" target="Code" class="method-signature"
|
145
|
+
onclick="popupCode('Vector.src/M000006.html');return false;">
|
146
|
+
<span class="method-name">new</span><span class="method-args">(speed = 0, pitch = 0)</span>
|
147
|
+
</a>
|
148
|
+
</div>
|
149
|
+
|
150
|
+
<div class="method-description">
|
151
|
+
</div>
|
152
|
+
</div>
|
153
|
+
|
154
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
155
|
+
|
156
|
+
<div id="method-M000013" class="method-detail">
|
157
|
+
<a name="M000013"></a>
|
158
|
+
|
159
|
+
<div class="method-heading">
|
160
|
+
<a href="Vector.src/M000013.html" target="Code" class="method-signature"
|
161
|
+
onclick="popupCode('Vector.src/M000013.html');return false;">
|
162
|
+
<span class="method-name">+</span><span class="method-args">(vector2)</span>
|
163
|
+
</a>
|
164
|
+
</div>
|
165
|
+
|
166
|
+
<div class="method-description">
|
167
|
+
<p>
|
168
|
+
Add this <a href="Vector.html">Vector</a> to vector2, returning a <a
|
169
|
+
href="Vector.html#M000006">new</a> <a href="Vector.html">Vector</a>. This
|
170
|
+
operation is useful when calculating the effect of wind or thrust on an
|
171
|
+
object‘s current heading.
|
172
|
+
</p>
|
173
|
+
</div>
|
174
|
+
</div>
|
175
|
+
|
176
|
+
<div id="method-M000007" class="method-detail">
|
177
|
+
<a name="M000007"></a>
|
178
|
+
|
179
|
+
<div class="method-heading">
|
180
|
+
<a href="Vector.src/M000007.html" target="Code" class="method-signature"
|
181
|
+
onclick="popupCode('Vector.src/M000007.html');return false;">
|
182
|
+
<span class="method-name">pitch</span><span class="method-args">()</span>
|
183
|
+
</a>
|
184
|
+
</div>
|
185
|
+
|
186
|
+
<div class="method-description">
|
187
|
+
<p>
|
188
|
+
The angle along the X/Y axes.
|
189
|
+
</p>
|
190
|
+
</div>
|
191
|
+
</div>
|
192
|
+
|
193
|
+
<div id="method-M000008" class="method-detail">
|
194
|
+
<a name="M000008"></a>
|
195
|
+
|
196
|
+
<div class="method-heading">
|
197
|
+
<a href="Vector.src/M000008.html" target="Code" class="method-signature"
|
198
|
+
onclick="popupCode('Vector.src/M000008.html');return false;">
|
199
|
+
<span class="method-name">pitch=</span><span class="method-args">(degrees)</span>
|
200
|
+
</a>
|
201
|
+
</div>
|
202
|
+
|
203
|
+
<div class="method-description">
|
204
|
+
</div>
|
205
|
+
</div>
|
206
|
+
|
207
|
+
<div id="method-M000009" class="method-detail">
|
208
|
+
<a name="M000009"></a>
|
209
|
+
|
210
|
+
<div class="method-heading">
|
211
|
+
<a href="Vector.src/M000009.html" target="Code" class="method-signature"
|
212
|
+
onclick="popupCode('Vector.src/M000009.html');return false;">
|
213
|
+
<span class="method-name">x</span><span class="method-args">()</span>
|
214
|
+
</a>
|
215
|
+
</div>
|
216
|
+
|
217
|
+
<div class="method-description">
|
218
|
+
<p>
|
219
|
+
The X component.
|
220
|
+
</p>
|
221
|
+
</div>
|
222
|
+
</div>
|
223
|
+
|
224
|
+
<div id="method-M000010" class="method-detail">
|
225
|
+
<a name="M000010"></a>
|
226
|
+
|
227
|
+
<div class="method-heading">
|
228
|
+
<a href="Vector.src/M000010.html" target="Code" class="method-signature"
|
229
|
+
onclick="popupCode('Vector.src/M000010.html');return false;">
|
230
|
+
<span class="method-name">x=</span><span class="method-args">(value)</span>
|
231
|
+
</a>
|
232
|
+
</div>
|
233
|
+
|
234
|
+
<div class="method-description">
|
235
|
+
</div>
|
236
|
+
</div>
|
237
|
+
|
238
|
+
<div id="method-M000011" class="method-detail">
|
239
|
+
<a name="M000011"></a>
|
240
|
+
|
241
|
+
<div class="method-heading">
|
242
|
+
<a href="Vector.src/M000011.html" target="Code" class="method-signature"
|
243
|
+
onclick="popupCode('Vector.src/M000011.html');return false;">
|
244
|
+
<span class="method-name">y</span><span class="method-args">()</span>
|
245
|
+
</a>
|
246
|
+
</div>
|
247
|
+
|
248
|
+
<div class="method-description">
|
249
|
+
<p>
|
250
|
+
The Y component.
|
251
|
+
</p>
|
252
|
+
</div>
|
253
|
+
</div>
|
254
|
+
|
255
|
+
<div id="method-M000012" class="method-detail">
|
256
|
+
<a name="M000012"></a>
|
257
|
+
|
258
|
+
<div class="method-heading">
|
259
|
+
<a href="Vector.src/M000012.html" target="Code" class="method-signature"
|
260
|
+
onclick="popupCode('Vector.src/M000012.html');return false;">
|
261
|
+
<span class="method-name">y=</span><span class="method-args">(value)</span>
|
262
|
+
</a>
|
263
|
+
</div>
|
264
|
+
|
265
|
+
<div class="method-description">
|
266
|
+
</div>
|
267
|
+
</div>
|
268
|
+
|
269
|
+
|
270
|
+
</div>
|
271
|
+
|
272
|
+
|
273
|
+
</div>
|
274
|
+
|
275
|
+
|
276
|
+
<div id="validator-badges">
|
277
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
278
|
+
</div>
|
279
|
+
|
280
|
+
</body>
|
281
|
+
</html>
|
@@ -0,0 +1,19 @@
|
|
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>new (Vector)</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 249</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span> (<span class="ruby-identifier">speed</span> = <span class="ruby-value">0</span>, <span class="ruby-identifier">pitch</span> = <span class="ruby-value">0</span>)
|
15
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">speed</span> = <span class="ruby-identifier">speed</span>
|
16
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">pitch</span> = <span class="ruby-identifier">pitch</span>
|
17
|
+
<span class="ruby-keyword kw">end</span></pre>
|
18
|
+
</body>
|
19
|
+
</html>
|
@@ -0,0 +1,16 @@
|
|
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>pitch (Vector)</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 255</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pitch</span>; <span class="ruby-constant">Utility</span>.<span class="ruby-identifier">to_degrees</span>(<span class="ruby-ivar">@pitch</span>); <span class="ruby-keyword kw">end</span></pre>
|
15
|
+
</body>
|
16
|
+
</html>
|
@@ -0,0 +1,21 @@
|
|
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>pitch= (Vector)</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 256</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pitch=</span>(<span class="ruby-identifier">degrees</span>)
|
15
|
+
<span class="ruby-comment cmt">#Constrain degrees to 0 to 360.</span>
|
16
|
+
<span class="ruby-identifier">value</span> = <span class="ruby-identifier">degrees</span> <span class="ruby-operator">%</span> <span class="ruby-value">360</span>
|
17
|
+
<span class="ruby-comment cmt">#Store as radians internally.</span>
|
18
|
+
<span class="ruby-ivar">@pitch</span> = <span class="ruby-constant">Utility</span>.<span class="ruby-identifier">to_radians</span>(<span class="ruby-identifier">value</span>)
|
19
|
+
<span class="ruby-keyword kw">end</span></pre>
|
20
|
+
</body>
|
21
|
+
</html>
|
@@ -0,0 +1,16 @@
|
|
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>x (Vector)</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 264</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">x</span>; <span class="ruby-ivar">@speed</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">*</span> <span class="ruby-constant">Math</span>.<span class="ruby-identifier">cos</span>(<span class="ruby-ivar">@pitch</span>); <span class="ruby-keyword kw">end</span></pre>
|
15
|
+
</body>
|
16
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
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>x= (Vector)</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 265</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">x=</span>(<span class="ruby-identifier">value</span>)
|
15
|
+
<span class="ruby-ivar">@speed</span>, <span class="ruby-ivar">@pitch</span> = <span class="ruby-constant">Math</span>.<span class="ruby-identifier">sqrt</span>(<span class="ruby-identifier">value</span> <span class="ruby-operator">**</span> <span class="ruby-value">2</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">y</span> <span class="ruby-operator">**</span> <span class="ruby-value">2</span>), <span class="ruby-constant">Math</span>.<span class="ruby-identifier">atan</span>(<span class="ruby-identifier">y</span> <span class="ruby-operator">/</span> <span class="ruby-identifier">value</span>)
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,16 @@
|
|
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>y (Vector)</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 269</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">y</span>; <span class="ruby-ivar">@speed</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">*</span> <span class="ruby-constant">Math</span>.<span class="ruby-identifier">sin</span>(<span class="ruby-ivar">@pitch</span>); <span class="ruby-keyword kw">end</span></pre>
|
15
|
+
</body>
|
16
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
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>y= (Vector)</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 270</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">y=</span>(<span class="ruby-identifier">value</span>)
|
15
|
+
<span class="ruby-ivar">@speed</span>, <span class="ruby-ivar">@pitch</span> = <span class="ruby-constant">Math</span>.<span class="ruby-identifier">sqrt</span>(<span class="ruby-identifier">x</span> <span class="ruby-operator">**</span> <span class="ruby-value">2</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">value</span> <span class="ruby-operator">**</span> <span class="ruby-value">2</span>), <span class="ruby-constant">Math</span>.<span class="ruby-identifier">atan</span>(<span class="ruby-identifier">value</span> <span class="ruby-operator">/</span> <span class="ruby-identifier">x</span>)
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,25 @@
|
|
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>+ (Vector)</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 276</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-operator">+</span>(<span class="ruby-identifier">vector2</span>)
|
15
|
+
<span class="ruby-comment cmt">#Get the x and y components of the new vector.</span>
|
16
|
+
<span class="ruby-identifier">new_x</span> = (<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">x</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">vector2</span>.<span class="ruby-identifier">x</span>)
|
17
|
+
<span class="ruby-identifier">new_y</span> = (<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">y</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">vector2</span>.<span class="ruby-identifier">y</span>)
|
18
|
+
<span class="ruby-identifier">new_length_squared</span> = <span class="ruby-identifier">new_x</span> <span class="ruby-operator">**</span> <span class="ruby-value">2</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">new_y</span> <span class="ruby-operator">**</span> <span class="ruby-value">2</span>
|
19
|
+
<span class="ruby-identifier">new_length</span> = (<span class="ruby-identifier">new_length_squared</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-operator">?</span> <span class="ruby-value">0</span> <span class="ruby-operator">:</span> <span class="ruby-constant">Math</span>.<span class="ruby-identifier">sqrt</span>(<span class="ruby-identifier">new_length_squared</span>))
|
20
|
+
<span class="ruby-identifier">new_angle</span> = (<span class="ruby-identifier">new_x</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-operator">?</span> <span class="ruby-value">0</span> <span class="ruby-operator">:</span> <span class="ruby-constant">Utility</span>.<span class="ruby-identifier">to_degrees</span>(<span class="ruby-constant">Math</span>.<span class="ruby-identifier">atan2</span>(<span class="ruby-identifier">new_y</span>, <span class="ruby-identifier">new_x</span>)))
|
21
|
+
<span class="ruby-comment cmt">#Calculate speed and angle of new vector with components.</span>
|
22
|
+
<span class="ruby-constant">Vector</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">new_length</span>, <span class="ruby-identifier">new_angle</span>)
|
23
|
+
<span class="ruby-keyword kw">end</span></pre>
|
24
|
+
</body>
|
25
|
+
</html>
|
data/doc/created.rid
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Thu Aug 16 13:42:47 -0700 2007
|