fractals 1.2.0
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 +66 -0
- data/Rakefile +65 -0
- data/doc/classes/Fractals.html +169 -0
- data/doc/classes/Fractals/Algorithms.html +125 -0
- data/doc/classes/Fractals/BurningShip.html +172 -0
- data/doc/classes/Fractals/Fractal.html +261 -0
- data/doc/classes/Fractals/Julia.html +171 -0
- data/doc/classes/Fractals/Mandelbrot.html +172 -0
- data/doc/classes/Fractals/Newton.html +173 -0
- data/doc/classes/Fractals/Renderers.html +118 -0
- data/doc/classes/Fractals/Renderers/Base.html +496 -0
- data/doc/classes/Fractals/Renderers/JRubyRenderer.html +178 -0
- data/doc/classes/Fractals/Renderers/PNGRenderer.html +202 -0
- data/doc/classes/Fractals/Renderers/RMagickRenderer.html +210 -0
- data/doc/classes/Fractals/Themes.html +131 -0
- data/doc/created.rid +1 -0
- data/doc/files/README.html +180 -0
- data/doc/files/examples_rb.html +122 -0
- data/doc/files/gpl-2_0_txt.html +522 -0
- data/doc/files/lib/fractals/algorithms_rb.html +90 -0
- data/doc/files/lib/fractals/renderers_rb.html +104 -0
- data/doc/files/lib/fractals/themes_rb.html +90 -0
- data/doc/files/lib/fractals_rb.html +114 -0
- data/doc/fr_class_index.html +49 -0
- data/doc/fr_file_index.html +37 -0
- data/doc/fr_method_index.html +57 -0
- data/doc/index.html +21 -0
- data/doc/rdoc-style.css +299 -0
- data/examples.rb +101 -0
- data/gpl-2.0.txt +339 -0
- data/lib/fractals.rb +105 -0
- data/lib/fractals/algorithms.rb +35 -0
- data/lib/fractals/renderers.rb +169 -0
- data/lib/fractals/themes.rb +48 -0
- data/test/burning_ship_test.rb +19 -0
- data/test/julia_test.rb +20 -0
- data/test/mandelbrot_test.rb +19 -0
- data/test/newton_test.rb +20 -0
- data/test/renderer_test.rb +21 -0
- metadata +104 -0
@@ -0,0 +1,173 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<title>Class: Fractals::Newton [Ruby Fractal Library - 1.2.0]</title>
|
6
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
7
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
8
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
9
|
+
<script type="text/javascript">
|
10
|
+
// <![CDATA[
|
11
|
+
|
12
|
+
function popupCode( url ) {
|
13
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
14
|
+
}
|
15
|
+
|
16
|
+
function toggleCode( id ) {
|
17
|
+
if ( document.getElementById )
|
18
|
+
elem = document.getElementById( id );
|
19
|
+
else if ( document.all )
|
20
|
+
elem = eval( "document.all." + id );
|
21
|
+
else
|
22
|
+
return false;
|
23
|
+
|
24
|
+
elemStyle = elem.style;
|
25
|
+
|
26
|
+
if ( elemStyle.display != "block" ) {
|
27
|
+
elemStyle.display = "block"
|
28
|
+
} else {
|
29
|
+
elemStyle.display = "none"
|
30
|
+
}
|
31
|
+
|
32
|
+
return true;
|
33
|
+
}
|
34
|
+
|
35
|
+
// Make codeblocks hidden by default
|
36
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }<\/style>" )
|
37
|
+
|
38
|
+
// ]]>
|
39
|
+
</script>
|
40
|
+
|
41
|
+
</head>
|
42
|
+
<body>
|
43
|
+
|
44
|
+
|
45
|
+
<div id="classHeader">
|
46
|
+
<table class="header-table">
|
47
|
+
<tr class="top-aligned-row">
|
48
|
+
<td><strong>Class</strong></td>
|
49
|
+
<td class="class-name-in-header">Fractals::Newton</td>
|
50
|
+
</tr>
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>In:</strong></td>
|
53
|
+
<td>
|
54
|
+
|
55
|
+
|
56
|
+
<a href="../../files/lib/fractals_rb.html">
|
57
|
+
|
58
|
+
lib/fractals.rb
|
59
|
+
|
60
|
+
</a>
|
61
|
+
|
62
|
+
|
63
|
+
<br />
|
64
|
+
|
65
|
+
</td>
|
66
|
+
</tr>
|
67
|
+
|
68
|
+
|
69
|
+
<tr class="top-aligned-row">
|
70
|
+
<td><strong>Parent:</strong></td>
|
71
|
+
<td>
|
72
|
+
|
73
|
+
<a href="Fractal.html">
|
74
|
+
|
75
|
+
Fractals::Fractal
|
76
|
+
|
77
|
+
</a>
|
78
|
+
|
79
|
+
</td>
|
80
|
+
</tr>
|
81
|
+
|
82
|
+
</table>
|
83
|
+
</div>
|
84
|
+
<!-- banner header -->
|
85
|
+
|
86
|
+
<div id="bodyContent">
|
87
|
+
|
88
|
+
<div id="contextContent">
|
89
|
+
|
90
|
+
<div id="description">
|
91
|
+
<p>
|
92
|
+
The <a href="Newton.html">Newton</a> fractal.
|
93
|
+
</p>
|
94
|
+
|
95
|
+
</div>
|
96
|
+
|
97
|
+
</div>
|
98
|
+
|
99
|
+
|
100
|
+
<div id="method-list">
|
101
|
+
<h3 class="section-bar">Methods</h3>
|
102
|
+
|
103
|
+
<div class="name-list">
|
104
|
+
|
105
|
+
<a href="#M000017">new</a>
|
106
|
+
|
107
|
+
</div>
|
108
|
+
</div>
|
109
|
+
|
110
|
+
</div>
|
111
|
+
|
112
|
+
<!-- if includes -->
|
113
|
+
|
114
|
+
<div id="section">
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
<!-- if method_list -->
|
120
|
+
|
121
|
+
<div id="methods">
|
122
|
+
|
123
|
+
<h3 class="section-bar">Public Class methods</h3>
|
124
|
+
|
125
|
+
|
126
|
+
<div id="method-M000017" class="method-detail">
|
127
|
+
<a name="M000017"></a>
|
128
|
+
|
129
|
+
<div class="method-heading">
|
130
|
+
|
131
|
+
<a href="#M000017" class="method-signature">
|
132
|
+
|
133
|
+
<span class="method-name">new</span><span class="method-args">(c=Complex(0.0, 0.0))</span>
|
134
|
+
|
135
|
+
</a>
|
136
|
+
|
137
|
+
</div>
|
138
|
+
|
139
|
+
<div class="method-description">
|
140
|
+
|
141
|
+
<p><a class="source-toggle" href="#"
|
142
|
+
onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
|
143
|
+
<div class="method-source-code" id="M000017-source">
|
144
|
+
<pre>
|
145
|
+
<span class="ruby-comment cmt"># File lib/fractals.rb, line 92</span>
|
146
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">c</span>=<span class="ruby-constant">Complex</span>(<span class="ruby-value">0</span><span class="ruby-value">.0</span>, <span class="ruby-value">0</span><span class="ruby-value">.0</span>))
|
147
|
+
<span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">c</span>, {<span class="ruby-identifier">:a</span> =<span class="ruby-operator">></span> <span class="ruby-value">1</span>, <span class="ruby-identifier">:pz</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">lambda</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">z</span><span class="ruby-operator">|</span> <span class="ruby-identifier">z</span><span class="ruby-operator">**</span><span class="ruby-value">3</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span> }}) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">args</span><span class="ruby-operator">|</span>
|
148
|
+
<span class="ruby-identifier">dx_pz</span> = <span class="ruby-identifier">derivative</span>(<span class="ruby-value">0</span><span class="ruby-value">.0001</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:pz</span>].<span class="ruby-identifier">call</span>(<span class="ruby-identifier">x</span>) }
|
149
|
+
<span class="ruby-identifier">args</span>[<span class="ruby-identifier">:z</span>] = <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:z</span>] <span class="ruby-operator">-</span> <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:a</span>] <span class="ruby-operator">*</span>
|
150
|
+
(<span class="ruby-identifier">args</span>[<span class="ruby-identifier">:pz</span>].<span class="ruby-identifier">call</span>(<span class="ruby-identifier">args</span>[<span class="ruby-identifier">:z</span>]) <span class="ruby-operator">/</span> (<span class="ruby-identifier">dx_pz</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">args</span>[<span class="ruby-identifier">:z</span>])))
|
151
|
+
<span class="ruby-keyword kw">end</span>
|
152
|
+
<span class="ruby-keyword kw">end</span>
|
153
|
+
</pre>
|
154
|
+
</div>
|
155
|
+
|
156
|
+
</div>
|
157
|
+
</div>
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
</div>
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
</div>
|
167
|
+
|
168
|
+
<div id="validator-badges">
|
169
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
170
|
+
</div>
|
171
|
+
|
172
|
+
</body>
|
173
|
+
</html>
|
@@ -0,0 +1,118 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<title>Module: Fractals::Renderers [Ruby Fractal Library - 1.2.0]</title>
|
6
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
7
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
8
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
9
|
+
<script type="text/javascript">
|
10
|
+
// <![CDATA[
|
11
|
+
|
12
|
+
function popupCode( url ) {
|
13
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
14
|
+
}
|
15
|
+
|
16
|
+
function toggleCode( id ) {
|
17
|
+
if ( document.getElementById )
|
18
|
+
elem = document.getElementById( id );
|
19
|
+
else if ( document.all )
|
20
|
+
elem = eval( "document.all." + id );
|
21
|
+
else
|
22
|
+
return false;
|
23
|
+
|
24
|
+
elemStyle = elem.style;
|
25
|
+
|
26
|
+
if ( elemStyle.display != "block" ) {
|
27
|
+
elemStyle.display = "block"
|
28
|
+
} else {
|
29
|
+
elemStyle.display = "none"
|
30
|
+
}
|
31
|
+
|
32
|
+
return true;
|
33
|
+
}
|
34
|
+
|
35
|
+
// Make codeblocks hidden by default
|
36
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }<\/style>" )
|
37
|
+
|
38
|
+
// ]]>
|
39
|
+
</script>
|
40
|
+
|
41
|
+
</head>
|
42
|
+
<body>
|
43
|
+
|
44
|
+
|
45
|
+
<div id="classHeader">
|
46
|
+
<table class="header-table">
|
47
|
+
<tr class="top-aligned-row">
|
48
|
+
<td><strong>Module</strong></td>
|
49
|
+
<td class="class-name-in-header">Fractals::Renderers</td>
|
50
|
+
</tr>
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>In:</strong></td>
|
53
|
+
<td>
|
54
|
+
|
55
|
+
|
56
|
+
<a href="../../files/lib/fractals/renderers_rb.html">
|
57
|
+
|
58
|
+
lib/fractals/renderers.rb
|
59
|
+
|
60
|
+
</a>
|
61
|
+
|
62
|
+
|
63
|
+
<br />
|
64
|
+
|
65
|
+
</td>
|
66
|
+
</tr>
|
67
|
+
|
68
|
+
|
69
|
+
</table>
|
70
|
+
</div>
|
71
|
+
<!-- banner header -->
|
72
|
+
|
73
|
+
<div id="bodyContent">
|
74
|
+
|
75
|
+
<div id="contextContent">
|
76
|
+
|
77
|
+
<div id="description">
|
78
|
+
<p>
|
79
|
+
Rendering modules for the PNG and RMagick libraries and JRuby.
|
80
|
+
</p>
|
81
|
+
|
82
|
+
</div>
|
83
|
+
|
84
|
+
</div>
|
85
|
+
|
86
|
+
|
87
|
+
</div>
|
88
|
+
|
89
|
+
<!-- if includes -->
|
90
|
+
|
91
|
+
<div id="section">
|
92
|
+
|
93
|
+
<div id="class-list">
|
94
|
+
<h3 class="section-bar">Classes and Modules</h3>
|
95
|
+
|
96
|
+
Module <a href="Renderers/JRubyRenderer.html" class="link">Fractals::Renderers::JRubyRenderer</a><br />
|
97
|
+
Module <a href="Renderers/PNGRenderer.html" class="link">Fractals::Renderers::PNGRenderer</a><br />
|
98
|
+
Module <a href="Renderers/RMagickRenderer.html" class="link">Fractals::Renderers::RMagickRenderer</a><br />
|
99
|
+
Class <a href="Renderers/Base.html" class="link">Fractals::Renderers::Base</a><br />
|
100
|
+
|
101
|
+
</div>
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
<!-- if method_list -->
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
</div>
|
112
|
+
|
113
|
+
<div id="validator-badges">
|
114
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
115
|
+
</div>
|
116
|
+
|
117
|
+
</body>
|
118
|
+
</html>
|
@@ -0,0 +1,496 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<title>Class: Fractals::Renderers::Base [Ruby Fractal Library - 1.2.0]</title>
|
6
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
7
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
8
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
9
|
+
<script type="text/javascript">
|
10
|
+
// <![CDATA[
|
11
|
+
|
12
|
+
function popupCode( url ) {
|
13
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
14
|
+
}
|
15
|
+
|
16
|
+
function toggleCode( id ) {
|
17
|
+
if ( document.getElementById )
|
18
|
+
elem = document.getElementById( id );
|
19
|
+
else if ( document.all )
|
20
|
+
elem = eval( "document.all." + id );
|
21
|
+
else
|
22
|
+
return false;
|
23
|
+
|
24
|
+
elemStyle = elem.style;
|
25
|
+
|
26
|
+
if ( elemStyle.display != "block" ) {
|
27
|
+
elemStyle.display = "block"
|
28
|
+
} else {
|
29
|
+
elemStyle.display = "none"
|
30
|
+
}
|
31
|
+
|
32
|
+
return true;
|
33
|
+
}
|
34
|
+
|
35
|
+
// Make codeblocks hidden by default
|
36
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }<\/style>" )
|
37
|
+
|
38
|
+
// ]]>
|
39
|
+
</script>
|
40
|
+
|
41
|
+
</head>
|
42
|
+
<body>
|
43
|
+
|
44
|
+
|
45
|
+
<div id="classHeader">
|
46
|
+
<table class="header-table">
|
47
|
+
<tr class="top-aligned-row">
|
48
|
+
<td><strong>Class</strong></td>
|
49
|
+
<td class="class-name-in-header">Fractals::Renderers::Base</td>
|
50
|
+
</tr>
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>In:</strong></td>
|
53
|
+
<td>
|
54
|
+
|
55
|
+
|
56
|
+
<a href="../../../files/lib/fractals/renderers_rb.html">
|
57
|
+
|
58
|
+
lib/fractals/renderers.rb
|
59
|
+
|
60
|
+
</a>
|
61
|
+
|
62
|
+
|
63
|
+
<br />
|
64
|
+
|
65
|
+
</td>
|
66
|
+
</tr>
|
67
|
+
|
68
|
+
|
69
|
+
<tr class="top-aligned-row">
|
70
|
+
<td><strong>Parent:</strong></td>
|
71
|
+
<td>
|
72
|
+
|
73
|
+
Object
|
74
|
+
|
75
|
+
</td>
|
76
|
+
</tr>
|
77
|
+
|
78
|
+
</table>
|
79
|
+
</div>
|
80
|
+
<!-- banner header -->
|
81
|
+
|
82
|
+
<div id="bodyContent">
|
83
|
+
|
84
|
+
<div id="contextContent">
|
85
|
+
|
86
|
+
<div id="description">
|
87
|
+
<p>
|
88
|
+
Inherited by <a href="../Fractal.html">Fractal</a>, <a
|
89
|
+
href="Base.html">Renderers::Base</a> includes traits common to each of the
|
90
|
+
rendering modules.
|
91
|
+
</p>
|
92
|
+
|
93
|
+
</div>
|
94
|
+
|
95
|
+
</div>
|
96
|
+
|
97
|
+
|
98
|
+
<div id="method-list">
|
99
|
+
<h3 class="section-bar">Methods</h3>
|
100
|
+
|
101
|
+
<div class="name-list">
|
102
|
+
|
103
|
+
<a href="#M000010">acts_as_renderer</a>
|
104
|
+
|
105
|
+
<a href="#M000007">in_set?</a>
|
106
|
+
|
107
|
+
<a href="#M000006">new</a>
|
108
|
+
|
109
|
+
<a href="#M000008">render</a>
|
110
|
+
|
111
|
+
<a href="#M000009">renderer=</a>
|
112
|
+
|
113
|
+
<a href="#M000011">where_is?</a>
|
114
|
+
|
115
|
+
</div>
|
116
|
+
</div>
|
117
|
+
|
118
|
+
</div>
|
119
|
+
|
120
|
+
<!-- if includes -->
|
121
|
+
|
122
|
+
<div id="section">
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
<div id="attribute-list">
|
127
|
+
<h3 class="section-bar">Attributes</h3>
|
128
|
+
|
129
|
+
<div class="name-list">
|
130
|
+
<table>
|
131
|
+
|
132
|
+
<tr class="top-aligned-row context-row">
|
133
|
+
<td class="context-item-name">algorithm</td>
|
134
|
+
|
135
|
+
<td class="context-item-value"> [RW] </td>
|
136
|
+
|
137
|
+
<td class="context-item-desc">
|
138
|
+
The renderer’s coloring algorithm.
|
139
|
+
|
140
|
+
</td>
|
141
|
+
</tr>
|
142
|
+
|
143
|
+
<tr class="top-aligned-row context-row">
|
144
|
+
<td class="context-item-name">bailout</td>
|
145
|
+
|
146
|
+
<td class="context-item-value"> [RW] </td>
|
147
|
+
|
148
|
+
<td class="context-item-desc">
|
149
|
+
The number that determines if an iteration is approaching inifinity.
|
150
|
+
|
151
|
+
</td>
|
152
|
+
</tr>
|
153
|
+
|
154
|
+
<tr class="top-aligned-row context-row">
|
155
|
+
<td class="context-item-name">height</td>
|
156
|
+
|
157
|
+
<td class="context-item-value"> [RW] </td>
|
158
|
+
|
159
|
+
<td class="context-item-desc">
|
160
|
+
The height of the fractal image.
|
161
|
+
|
162
|
+
</td>
|
163
|
+
</tr>
|
164
|
+
|
165
|
+
<tr class="top-aligned-row context-row">
|
166
|
+
<td class="context-item-name">last_iteration</td>
|
167
|
+
|
168
|
+
<td class="context-item-value"> [RW] </td>
|
169
|
+
|
170
|
+
<td class="context-item-desc">
|
171
|
+
The last iteration number of a complex coordinate. Determined by the
|
172
|
+
in_set? method.
|
173
|
+
|
174
|
+
</td>
|
175
|
+
</tr>
|
176
|
+
|
177
|
+
<tr class="top-aligned-row context-row">
|
178
|
+
<td class="context-item-name">magnification</td>
|
179
|
+
|
180
|
+
<td class="context-item-value"> [RW] </td>
|
181
|
+
|
182
|
+
<td class="context-item-desc">
|
183
|
+
The magnification level of the fractal in powers of 100.
|
184
|
+
|
185
|
+
</td>
|
186
|
+
</tr>
|
187
|
+
|
188
|
+
<tr class="top-aligned-row context-row">
|
189
|
+
<td class="context-item-name">max_iterations</td>
|
190
|
+
|
191
|
+
<td class="context-item-value"> [RW] </td>
|
192
|
+
|
193
|
+
<td class="context-item-desc">
|
194
|
+
The maximum number of iterations to perform on an expression.
|
195
|
+
|
196
|
+
</td>
|
197
|
+
</tr>
|
198
|
+
|
199
|
+
<tr class="top-aligned-row context-row">
|
200
|
+
<td class="context-item-name">set_color</td>
|
201
|
+
|
202
|
+
<td class="context-item-value"> [RW] </td>
|
203
|
+
|
204
|
+
<td class="context-item-desc">
|
205
|
+
The color of complex coordinates inside the fractal set. Expects an array
|
206
|
+
of RGB values [R, G, B].
|
207
|
+
|
208
|
+
</td>
|
209
|
+
</tr>
|
210
|
+
|
211
|
+
<tr class="top-aligned-row context-row">
|
212
|
+
<td class="context-item-name">theme</td>
|
213
|
+
|
214
|
+
<td class="context-item-value"> [RW] </td>
|
215
|
+
|
216
|
+
<td class="context-item-desc">
|
217
|
+
The coloring theme applied to complex coordinates that lie outside of the
|
218
|
+
fractal set.
|
219
|
+
|
220
|
+
</td>
|
221
|
+
</tr>
|
222
|
+
|
223
|
+
<tr class="top-aligned-row context-row">
|
224
|
+
<td class="context-item-name">width</td>
|
225
|
+
|
226
|
+
<td class="context-item-value"> [RW] </td>
|
227
|
+
|
228
|
+
<td class="context-item-desc">
|
229
|
+
The width of the fractal image.
|
230
|
+
|
231
|
+
</td>
|
232
|
+
</tr>
|
233
|
+
|
234
|
+
</table>
|
235
|
+
</div>
|
236
|
+
</div>
|
237
|
+
|
238
|
+
|
239
|
+
<!-- if method_list -->
|
240
|
+
|
241
|
+
<div id="methods">
|
242
|
+
|
243
|
+
<h3 class="section-bar">Public Class methods</h3>
|
244
|
+
|
245
|
+
|
246
|
+
<div id="method-M000010" class="method-detail">
|
247
|
+
<a name="M000010"></a>
|
248
|
+
|
249
|
+
<div class="method-heading">
|
250
|
+
|
251
|
+
<a href="#M000010" class="method-signature">
|
252
|
+
|
253
|
+
<span class="method-name">acts_as_renderer</span><span class="method-args">(renderer)</span>
|
254
|
+
|
255
|
+
</a>
|
256
|
+
|
257
|
+
</div>
|
258
|
+
|
259
|
+
<div class="method-description">
|
260
|
+
|
261
|
+
<p>
|
262
|
+
Includes the provided module. Use the renderer= method for setting the
|
263
|
+
renderer at runtime.
|
264
|
+
</p>
|
265
|
+
|
266
|
+
<p><a class="source-toggle" href="#"
|
267
|
+
onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
|
268
|
+
<div class="method-source-code" id="M000010-source">
|
269
|
+
<pre>
|
270
|
+
<span class="ruby-comment cmt"># File lib/fractals/renderers.rb, line 81</span>
|
271
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">acts_as_renderer</span>(<span class="ruby-identifier">renderer</span>)
|
272
|
+
<span class="ruby-identifier">include</span> <span class="ruby-identifier">renderer</span>
|
273
|
+
<span class="ruby-keyword kw">end</span>
|
274
|
+
</pre>
|
275
|
+
</div>
|
276
|
+
|
277
|
+
</div>
|
278
|
+
</div>
|
279
|
+
|
280
|
+
|
281
|
+
<div id="method-M000006" class="method-detail">
|
282
|
+
<a name="M000006"></a>
|
283
|
+
|
284
|
+
<div class="method-heading">
|
285
|
+
|
286
|
+
<a href="#M000006" class="method-signature">
|
287
|
+
|
288
|
+
<span class="method-name">new</span><span class="method-args">(bailout=2, max_iterations=50, algorithm=Algorithms::EscapeTime)</span>
|
289
|
+
|
290
|
+
</a>
|
291
|
+
|
292
|
+
</div>
|
293
|
+
|
294
|
+
<div class="method-description">
|
295
|
+
|
296
|
+
<p>
|
297
|
+
Sets the default property values.
|
298
|
+
</p>
|
299
|
+
|
300
|
+
<p><a class="source-toggle" href="#"
|
301
|
+
onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
|
302
|
+
<div class="method-source-code" id="M000006-source">
|
303
|
+
<pre>
|
304
|
+
<span class="ruby-comment cmt"># File lib/fractals/renderers.rb, line 36</span>
|
305
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">bailout</span>=<span class="ruby-value">2</span>, <span class="ruby-identifier">max_iterations</span>=<span class="ruby-value">50</span>, <span class="ruby-identifier">algorithm</span>=<span class="ruby-constant">Algorithms</span><span class="ruby-operator">::</span><span class="ruby-constant">EscapeTime</span>)
|
306
|
+
<span class="ruby-ivar">@bailout</span>, <span class="ruby-ivar">@max_iterations</span> = <span class="ruby-identifier">bailout</span>, <span class="ruby-identifier">max_iterations</span>
|
307
|
+
<span class="ruby-ivar">@algorithm</span> = <span class="ruby-identifier">algorithm</span>
|
308
|
+
<span class="ruby-ivar">@width</span>, <span class="ruby-ivar">@height</span> = <span class="ruby-value">300</span>, <span class="ruby-value">300</span>
|
309
|
+
<span class="ruby-ivar">@magnification</span> = <span class="ruby-value">1.0</span>
|
310
|
+
<span class="ruby-ivar">@theme</span>, <span class="ruby-ivar">@set_color</span> = <span class="ruby-constant">Themes</span><span class="ruby-operator">::</span><span class="ruby-constant">Fire</span>, [<span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>]
|
311
|
+
<span class="ruby-keyword kw">end</span>
|
312
|
+
</pre>
|
313
|
+
</div>
|
314
|
+
|
315
|
+
</div>
|
316
|
+
</div>
|
317
|
+
|
318
|
+
|
319
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
320
|
+
|
321
|
+
|
322
|
+
<div id="method-M000007" class="method-detail">
|
323
|
+
<a name="M000007"></a>
|
324
|
+
|
325
|
+
<div class="method-heading">
|
326
|
+
|
327
|
+
<a href="#M000007" class="method-signature">
|
328
|
+
|
329
|
+
<span class="method-name">in_set?</span><span class="method-args">(c)</span>
|
330
|
+
|
331
|
+
</a>
|
332
|
+
|
333
|
+
</div>
|
334
|
+
|
335
|
+
<div class="method-description">
|
336
|
+
|
337
|
+
<p>
|
338
|
+
Determines if a complex coordinate lies within the fractal’s set.
|
339
|
+
</p>
|
340
|
+
|
341
|
+
<p><a class="source-toggle" href="#"
|
342
|
+
onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
|
343
|
+
<div class="method-source-code" id="M000007-source">
|
344
|
+
<pre>
|
345
|
+
<span class="ruby-comment cmt"># File lib/fractals/renderers.rb, line 45</span>
|
346
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">in_set?</span>(<span class="ruby-identifier">c</span>)
|
347
|
+
<span class="ruby-ivar">@args</span>[<span class="ruby-identifier">:c</span>] = <span class="ruby-identifier">c</span>
|
348
|
+
<span class="ruby-identifier">iterate</span>(<span class="ruby-ivar">@max_iterations</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span>, <span class="ruby-identifier">z</span><span class="ruby-operator">|</span>
|
349
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">z</span>.<span class="ruby-identifier">abs</span> <span class="ruby-operator">></span> <span class="ruby-ivar">@bailout</span> <span class="ruby-keyword kw">then</span>
|
350
|
+
<span class="ruby-ivar">@last_iteration</span> = <span class="ruby-identifier">i</span>
|
351
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
|
352
|
+
<span class="ruby-keyword kw">end</span>
|
353
|
+
<span class="ruby-keyword kw">end</span>
|
354
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
|
355
|
+
<span class="ruby-keyword kw">end</span>
|
356
|
+
</pre>
|
357
|
+
</div>
|
358
|
+
|
359
|
+
</div>
|
360
|
+
</div>
|
361
|
+
|
362
|
+
|
363
|
+
<div id="method-M000008" class="method-detail">
|
364
|
+
<a name="M000008"></a>
|
365
|
+
|
366
|
+
<div class="method-heading">
|
367
|
+
|
368
|
+
<a href="#M000008" class="method-signature">
|
369
|
+
|
370
|
+
<span class="method-name">render</span><span class="method-args">() {|x, y, @theme.call(@algorithm.call(self))| ...}</span>
|
371
|
+
|
372
|
+
</a>
|
373
|
+
|
374
|
+
</div>
|
375
|
+
|
376
|
+
<div class="method-description">
|
377
|
+
|
378
|
+
<p>
|
379
|
+
Loops through each x, y value pair yielding the pair and its RGB color
|
380
|
+
value as an array [R, G, B].
|
381
|
+
</p>
|
382
|
+
|
383
|
+
<p><a class="source-toggle" href="#"
|
384
|
+
onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
|
385
|
+
<div class="method-source-code" id="M000008-source">
|
386
|
+
<pre>
|
387
|
+
<span class="ruby-comment cmt"># File lib/fractals/renderers.rb, line 58</span>
|
388
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">render</span>
|
389
|
+
(<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-ivar">@width</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span>
|
390
|
+
(<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-ivar">@height</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">y</span><span class="ruby-operator">|</span>
|
391
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">in_set?</span>(<span class="ruby-identifier">where_is?</span>(<span class="ruby-identifier">x</span>, <span class="ruby-identifier">y</span>)) <span class="ruby-keyword kw">then</span>
|
392
|
+
<span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">x</span>, <span class="ruby-identifier">y</span>, <span class="ruby-ivar">@theme</span>.<span class="ruby-identifier">call</span>(<span class="ruby-ivar">@algorithm</span>.<span class="ruby-identifier">call</span>(<span class="ruby-keyword kw">self</span>))
|
393
|
+
<span class="ruby-keyword kw">else</span>
|
394
|
+
<span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">x</span>, <span class="ruby-identifier">y</span>, <span class="ruby-ivar">@set_color</span>
|
395
|
+
<span class="ruby-keyword kw">end</span>
|
396
|
+
<span class="ruby-keyword kw">end</span>
|
397
|
+
<span class="ruby-keyword kw">end</span>
|
398
|
+
<span class="ruby-keyword kw">end</span>
|
399
|
+
</pre>
|
400
|
+
</div>
|
401
|
+
|
402
|
+
</div>
|
403
|
+
</div>
|
404
|
+
|
405
|
+
|
406
|
+
<div id="method-M000009" class="method-detail">
|
407
|
+
<a name="M000009"></a>
|
408
|
+
|
409
|
+
<div class="method-heading">
|
410
|
+
|
411
|
+
<a href="#M000009" class="method-signature">
|
412
|
+
|
413
|
+
<span class="method-name">renderer=</span><span class="method-args">(renderer)</span>
|
414
|
+
|
415
|
+
</a>
|
416
|
+
|
417
|
+
</div>
|
418
|
+
|
419
|
+
<div class="method-description">
|
420
|
+
|
421
|
+
<p>
|
422
|
+
Extends the <a href="Base.html">Renderers::Base</a> class with the provided
|
423
|
+
module.
|
424
|
+
</p>
|
425
|
+
<h1>Example:</h1>
|
426
|
+
<p>
|
427
|
+
mandelbrot = <a href="../Mandelbrot.html#M000016">Mandelbrot.new</a><br />
|
428
|
+
mandelbrot.<b>renderer =</b> <a
|
429
|
+
href="RMagickRenderer.html">Renderers::RMagickRenderer</a>
|
430
|
+
</p>
|
431
|
+
|
432
|
+
<p><a class="source-toggle" href="#"
|
433
|
+
onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
|
434
|
+
<div class="method-source-code" id="M000009-source">
|
435
|
+
<pre>
|
436
|
+
<span class="ruby-comment cmt"># File lib/fractals/renderers.rb, line 75</span>
|
437
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">renderer=</span>(<span class="ruby-identifier">renderer</span>)
|
438
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">extend</span> <span class="ruby-identifier">renderer</span>
|
439
|
+
<span class="ruby-keyword kw">end</span>
|
440
|
+
</pre>
|
441
|
+
</div>
|
442
|
+
|
443
|
+
</div>
|
444
|
+
</div>
|
445
|
+
|
446
|
+
|
447
|
+
<div id="method-M000011" class="method-detail">
|
448
|
+
<a name="M000011"></a>
|
449
|
+
|
450
|
+
<div class="method-heading">
|
451
|
+
|
452
|
+
<a href="#M000011" class="method-signature">
|
453
|
+
|
454
|
+
<span class="method-name">where_is?</span><span class="method-args">(x, y)</span>
|
455
|
+
|
456
|
+
</a>
|
457
|
+
|
458
|
+
</div>
|
459
|
+
|
460
|
+
<div class="method-description">
|
461
|
+
|
462
|
+
<p>
|
463
|
+
Determines the location of an x, y value pair on the complex coordinate
|
464
|
+
plane.
|
465
|
+
</p>
|
466
|
+
|
467
|
+
<p><a class="source-toggle" href="#"
|
468
|
+
onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
|
469
|
+
<div class="method-source-code" id="M000011-source">
|
470
|
+
<pre>
|
471
|
+
<span class="ruby-comment cmt"># File lib/fractals/renderers.rb, line 87</span>
|
472
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">where_is?</span>(<span class="ruby-identifier">x</span>, <span class="ruby-identifier">y</span>)
|
473
|
+
<span class="ruby-constant">Complex</span>(<span class="ruby-ivar">@c</span>.<span class="ruby-identifier">real</span> <span class="ruby-operator">-</span> (<span class="ruby-ivar">@width</span> <span class="ruby-operator">/</span> <span class="ruby-value">2</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">scale</span>) <span class="ruby-operator">+</span> (<span class="ruby-identifier">x</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">scale</span>),
|
474
|
+
<span class="ruby-ivar">@c</span>.<span class="ruby-identifier">image</span> <span class="ruby-operator">-</span> (<span class="ruby-ivar">@height</span> <span class="ruby-operator">/</span> <span class="ruby-value">2</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">scale</span>) <span class="ruby-operator">+</span> (<span class="ruby-identifier">y</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">scale</span>))
|
475
|
+
<span class="ruby-keyword kw">end</span>
|
476
|
+
</pre>
|
477
|
+
</div>
|
478
|
+
|
479
|
+
</div>
|
480
|
+
</div>
|
481
|
+
|
482
|
+
|
483
|
+
|
484
|
+
</div>
|
485
|
+
|
486
|
+
|
487
|
+
|
488
|
+
|
489
|
+
</div>
|
490
|
+
|
491
|
+
<div id="validator-badges">
|
492
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
493
|
+
</div>
|
494
|
+
|
495
|
+
</body>
|
496
|
+
</html>
|