silicium 0.0.20 → 0.0.21
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.
- checksums.yaml +4 -4
- data/.codeclimate.yml +3 -3
- data/.gitignore +13 -13
- data/.rakeTasks +8 -0
- data/.travis.yml +28 -25
- data/CODE_OF_CONDUCT.md +74 -74
- data/Gemfile +8 -8
- data/LICENSE.txt +21 -21
- data/Makefile +269 -269
- data/README.md +588 -46
- data/Rakefile +16 -16
- data/bin/console +14 -14
- data/bin/setup +8 -8
- data/docs/Object.html +117 -117
- data/docs/README_md.html +142 -142
- data/docs/Silicium/Combinatorics.html +270 -270
- data/docs/Silicium/Dice/Polyhedron.html +315 -315
- data/docs/Silicium/Dice/PolyhedronSet.html +321 -321
- data/docs/Silicium/Dice.html +99 -99
- data/docs/Silicium/Error.html +106 -106
- data/docs/Silicium/Geometry/Line2dCanon.html +243 -243
- data/docs/Silicium/Geometry/VariablesOrderException.html +106 -106
- data/docs/Silicium/Geometry.html +940 -940
- data/docs/Silicium/GraphVisualizer.html +226 -0
- data/docs/Silicium/Graphs/GraphError.html +106 -106
- data/docs/Silicium/Graphs/OrientedGraph.html +901 -775
- data/docs/Silicium/Graphs/UnorientedGraph.html +237 -284
- data/docs/Silicium/Graphs.html +374 -164
- data/docs/Silicium/IntegralDoesntExistError.html +106 -106
- data/docs/Silicium/NumericalIntegration.html +521 -521
- data/docs/Silicium/Optimization.html +629 -639
- data/docs/Silicium/Plotter/Image.html +297 -297
- data/docs/Silicium/Plotter.html +186 -186
- data/docs/Silicium.html +101 -101
- data/docs/created.rid +9 -9
- data/docs/css/fonts.css +167 -167
- data/docs/css/rdoc.css +619 -619
- data/docs/index.html +134 -132
- data/docs/js/darkfish.js +84 -84
- data/docs/js/navigation.js +105 -105
- data/docs/js/search.js +110 -110
- data/docs/js/search_index.js +1 -1
- data/docs/js/search_index.js.gz +0 -0
- data/docs/js/searcher.js +229 -229
- data/docs/table_of_contents.html +697 -608
- data/lib/algebra.rb +452 -0
- data/lib/algebra_diff.rb +258 -0
- data/lib/geometry/figure.rb +62 -0
- data/lib/geometry.rb +290 -236
- data/lib/geometry3d.rb +270 -0
- data/lib/graph/dfs.rb +42 -0
- data/lib/graph/kruskal.rb +36 -0
- data/lib/graph/scc.rb +97 -0
- data/lib/graph.rb +350 -164
- data/lib/graph_visualizer.rb +287 -0
- data/lib/ml_algorithms.rb +181 -0
- data/lib/numerical_integration.rb +184 -147
- data/lib/optimization.rb +209 -144
- data/lib/plotter.rb +256 -96
- data/lib/polynomial_division.rb +132 -0
- data/lib/polynomial_interpolation.rb +94 -0
- data/lib/regression.rb +120 -0
- data/lib/silicium/adding.rb +37 -0
- data/lib/silicium/conversions.rb +23 -0
- data/lib/silicium/multi.rb +82 -0
- data/lib/silicium/sparse.rb +76 -0
- data/lib/silicium/sugar.rb +37 -0
- data/lib/silicium/trans.rb +26 -0
- data/lib/silicium/version.rb +3 -3
- data/lib/silicium.rb +5 -5
- data/lib/theory_of_probability.rb +240 -226
- data/lib/topological_sort.rb +50 -0
- data/oriented_graph.png +0 -0
- data/plot.png +0 -0
- data/silicium.gemspec +38 -39
- metadata +38 -16
data/docs/Silicium/Dice.html
CHANGED
@@ -1,99 +1,99 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
|
3
|
-
<html>
|
4
|
-
<head>
|
5
|
-
<meta charset="UTF-8">
|
6
|
-
|
7
|
-
<title>module Silicium::Dice - RDoc Documentation</title>
|
8
|
-
|
9
|
-
<script type="text/javascript">
|
10
|
-
var rdoc_rel_prefix = "../";
|
11
|
-
var index_rel_prefix = "../";
|
12
|
-
</script>
|
13
|
-
|
14
|
-
<script src="../js/navigation.js" defer></script>
|
15
|
-
<script src="../js/search.js" defer></script>
|
16
|
-
<script src="../js/search_index.js" defer></script>
|
17
|
-
<script src="../js/searcher.js" defer></script>
|
18
|
-
<script src="../js/darkfish.js" defer></script>
|
19
|
-
|
20
|
-
<link href="../css/fonts.css" rel="stylesheet">
|
21
|
-
<link href="../css/rdoc.css" rel="stylesheet">
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
<body id="top" role="document" class="module">
|
27
|
-
<nav role="navigation">
|
28
|
-
<div id="project-navigation">
|
29
|
-
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
30
|
-
<h2>
|
31
|
-
<a href="../index.html" rel="home">Home</a>
|
32
|
-
</h2>
|
33
|
-
|
34
|
-
<div id="table-of-contents-navigation">
|
35
|
-
<a href="../table_of_contents.html#pages">Pages</a>
|
36
|
-
<a href="../table_of_contents.html#classes">Classes</a>
|
37
|
-
<a href="../table_of_contents.html#methods">Methods</a>
|
38
|
-
</div>
|
39
|
-
</div>
|
40
|
-
|
41
|
-
<div id="search-section" role="search" class="project-section initially-hidden">
|
42
|
-
<form action="#" method="get" accept-charset="utf-8">
|
43
|
-
<div id="search-field-wrapper">
|
44
|
-
<input id="search-field" role="combobox" aria-label="Search"
|
45
|
-
aria-autocomplete="list" aria-controls="search-results"
|
46
|
-
type="text" name="search" placeholder="Search" spellcheck="false"
|
47
|
-
title="Type to search, Up and Down to navigate, Enter to load">
|
48
|
-
</div>
|
49
|
-
|
50
|
-
<ul id="search-results" aria-label="Search Results"
|
51
|
-
aria-busy="false" aria-expanded="false"
|
52
|
-
aria-atomic="false" class="initially-hidden"></ul>
|
53
|
-
</form>
|
54
|
-
</div>
|
55
|
-
|
56
|
-
</div>
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
<div id="class-metadata">
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
</div>
|
67
|
-
</nav>
|
68
|
-
|
69
|
-
<main role="main" aria-labelledby="module-Silicium::Dice">
|
70
|
-
<h1 id="module-Silicium::Dice" class="module">
|
71
|
-
module Silicium::Dice
|
72
|
-
</h1>
|
73
|
-
|
74
|
-
<section class="description">
|
75
|
-
|
76
|
-
</section>
|
77
|
-
|
78
|
-
|
79
|
-
<section id="5Buntitled-5D" class="documentation-section">
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
</section>
|
90
|
-
|
91
|
-
</main>
|
92
|
-
|
93
|
-
|
94
|
-
<footer id="validator-badges" role="contentinfo">
|
95
|
-
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
96
|
-
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.2.0.
|
97
|
-
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
98
|
-
</footer>
|
99
|
-
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>module Silicium::Dice - RDoc Documentation</title>
|
8
|
+
|
9
|
+
<script type="text/javascript">
|
10
|
+
var rdoc_rel_prefix = "../";
|
11
|
+
var index_rel_prefix = "../";
|
12
|
+
</script>
|
13
|
+
|
14
|
+
<script src="../js/navigation.js" defer></script>
|
15
|
+
<script src="../js/search.js" defer></script>
|
16
|
+
<script src="../js/search_index.js" defer></script>
|
17
|
+
<script src="../js/searcher.js" defer></script>
|
18
|
+
<script src="../js/darkfish.js" defer></script>
|
19
|
+
|
20
|
+
<link href="../css/fonts.css" rel="stylesheet">
|
21
|
+
<link href="../css/rdoc.css" rel="stylesheet">
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
<body id="top" role="document" class="module">
|
27
|
+
<nav role="navigation">
|
28
|
+
<div id="project-navigation">
|
29
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
30
|
+
<h2>
|
31
|
+
<a href="../index.html" rel="home">Home</a>
|
32
|
+
</h2>
|
33
|
+
|
34
|
+
<div id="table-of-contents-navigation">
|
35
|
+
<a href="../table_of_contents.html#pages">Pages</a>
|
36
|
+
<a href="../table_of_contents.html#classes">Classes</a>
|
37
|
+
<a href="../table_of_contents.html#methods">Methods</a>
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
42
|
+
<form action="#" method="get" accept-charset="utf-8">
|
43
|
+
<div id="search-field-wrapper">
|
44
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
45
|
+
aria-autocomplete="list" aria-controls="search-results"
|
46
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
47
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
48
|
+
</div>
|
49
|
+
|
50
|
+
<ul id="search-results" aria-label="Search Results"
|
51
|
+
aria-busy="false" aria-expanded="false"
|
52
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
53
|
+
</form>
|
54
|
+
</div>
|
55
|
+
|
56
|
+
</div>
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
<div id="class-metadata">
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</div>
|
67
|
+
</nav>
|
68
|
+
|
69
|
+
<main role="main" aria-labelledby="module-Silicium::Dice">
|
70
|
+
<h1 id="module-Silicium::Dice" class="module">
|
71
|
+
module Silicium::Dice
|
72
|
+
</h1>
|
73
|
+
|
74
|
+
<section class="description">
|
75
|
+
|
76
|
+
</section>
|
77
|
+
|
78
|
+
|
79
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
</section>
|
90
|
+
|
91
|
+
</main>
|
92
|
+
|
93
|
+
|
94
|
+
<footer id="validator-badges" role="contentinfo">
|
95
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
96
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.2.0.
|
97
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
98
|
+
</footer>
|
99
|
+
|
data/docs/Silicium/Error.html
CHANGED
@@ -1,106 +1,106 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
|
3
|
-
<html>
|
4
|
-
<head>
|
5
|
-
<meta charset="UTF-8">
|
6
|
-
|
7
|
-
<title>class Silicium::Error - RDoc Documentation</title>
|
8
|
-
|
9
|
-
<script type="text/javascript">
|
10
|
-
var rdoc_rel_prefix = "../";
|
11
|
-
var index_rel_prefix = "../";
|
12
|
-
</script>
|
13
|
-
|
14
|
-
<script src="../js/navigation.js" defer></script>
|
15
|
-
<script src="../js/search.js" defer></script>
|
16
|
-
<script src="../js/search_index.js" defer></script>
|
17
|
-
<script src="../js/searcher.js" defer></script>
|
18
|
-
<script src="../js/darkfish.js" defer></script>
|
19
|
-
|
20
|
-
<link href="../css/fonts.css" rel="stylesheet">
|
21
|
-
<link href="../css/rdoc.css" rel="stylesheet">
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
<body id="top" role="document" class="class">
|
27
|
-
<nav role="navigation">
|
28
|
-
<div id="project-navigation">
|
29
|
-
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
30
|
-
<h2>
|
31
|
-
<a href="../index.html" rel="home">Home</a>
|
32
|
-
</h2>
|
33
|
-
|
34
|
-
<div id="table-of-contents-navigation">
|
35
|
-
<a href="../table_of_contents.html#pages">Pages</a>
|
36
|
-
<a href="../table_of_contents.html#classes">Classes</a>
|
37
|
-
<a href="../table_of_contents.html#methods">Methods</a>
|
38
|
-
</div>
|
39
|
-
</div>
|
40
|
-
|
41
|
-
<div id="search-section" role="search" class="project-section initially-hidden">
|
42
|
-
<form action="#" method="get" accept-charset="utf-8">
|
43
|
-
<div id="search-field-wrapper">
|
44
|
-
<input id="search-field" role="combobox" aria-label="Search"
|
45
|
-
aria-autocomplete="list" aria-controls="search-results"
|
46
|
-
type="text" name="search" placeholder="Search" spellcheck="false"
|
47
|
-
title="Type to search, Up and Down to navigate, Enter to load">
|
48
|
-
</div>
|
49
|
-
|
50
|
-
<ul id="search-results" aria-label="Search Results"
|
51
|
-
aria-busy="false" aria-expanded="false"
|
52
|
-
aria-atomic="false" class="initially-hidden"></ul>
|
53
|
-
</form>
|
54
|
-
</div>
|
55
|
-
|
56
|
-
</div>
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
<div id="class-metadata">
|
61
|
-
|
62
|
-
<div id="parent-class-section" class="nav-section">
|
63
|
-
<h3>Parent</h3>
|
64
|
-
|
65
|
-
|
66
|
-
<p class="link">StandardError
|
67
|
-
|
68
|
-
</div>
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
</div>
|
74
|
-
</nav>
|
75
|
-
|
76
|
-
<main role="main" aria-labelledby="class-Silicium::Error">
|
77
|
-
<h1 id="class-Silicium::Error" class="class">
|
78
|
-
class Silicium::Error
|
79
|
-
</h1>
|
80
|
-
|
81
|
-
<section class="description">
|
82
|
-
|
83
|
-
</section>
|
84
|
-
|
85
|
-
|
86
|
-
<section id="5Buntitled-5D" class="documentation-section">
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
</section>
|
97
|
-
|
98
|
-
</main>
|
99
|
-
|
100
|
-
|
101
|
-
<footer id="validator-badges" role="contentinfo">
|
102
|
-
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
103
|
-
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.2.0.
|
104
|
-
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
105
|
-
</footer>
|
106
|
-
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>class Silicium::Error - RDoc Documentation</title>
|
8
|
+
|
9
|
+
<script type="text/javascript">
|
10
|
+
var rdoc_rel_prefix = "../";
|
11
|
+
var index_rel_prefix = "../";
|
12
|
+
</script>
|
13
|
+
|
14
|
+
<script src="../js/navigation.js" defer></script>
|
15
|
+
<script src="../js/search.js" defer></script>
|
16
|
+
<script src="../js/search_index.js" defer></script>
|
17
|
+
<script src="../js/searcher.js" defer></script>
|
18
|
+
<script src="../js/darkfish.js" defer></script>
|
19
|
+
|
20
|
+
<link href="../css/fonts.css" rel="stylesheet">
|
21
|
+
<link href="../css/rdoc.css" rel="stylesheet">
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
<body id="top" role="document" class="class">
|
27
|
+
<nav role="navigation">
|
28
|
+
<div id="project-navigation">
|
29
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
30
|
+
<h2>
|
31
|
+
<a href="../index.html" rel="home">Home</a>
|
32
|
+
</h2>
|
33
|
+
|
34
|
+
<div id="table-of-contents-navigation">
|
35
|
+
<a href="../table_of_contents.html#pages">Pages</a>
|
36
|
+
<a href="../table_of_contents.html#classes">Classes</a>
|
37
|
+
<a href="../table_of_contents.html#methods">Methods</a>
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
42
|
+
<form action="#" method="get" accept-charset="utf-8">
|
43
|
+
<div id="search-field-wrapper">
|
44
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
45
|
+
aria-autocomplete="list" aria-controls="search-results"
|
46
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
47
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
48
|
+
</div>
|
49
|
+
|
50
|
+
<ul id="search-results" aria-label="Search Results"
|
51
|
+
aria-busy="false" aria-expanded="false"
|
52
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
53
|
+
</form>
|
54
|
+
</div>
|
55
|
+
|
56
|
+
</div>
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
<div id="class-metadata">
|
61
|
+
|
62
|
+
<div id="parent-class-section" class="nav-section">
|
63
|
+
<h3>Parent</h3>
|
64
|
+
|
65
|
+
|
66
|
+
<p class="link">StandardError
|
67
|
+
|
68
|
+
</div>
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
</div>
|
74
|
+
</nav>
|
75
|
+
|
76
|
+
<main role="main" aria-labelledby="class-Silicium::Error">
|
77
|
+
<h1 id="class-Silicium::Error" class="class">
|
78
|
+
class Silicium::Error
|
79
|
+
</h1>
|
80
|
+
|
81
|
+
<section class="description">
|
82
|
+
|
83
|
+
</section>
|
84
|
+
|
85
|
+
|
86
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
</section>
|
97
|
+
|
98
|
+
</main>
|
99
|
+
|
100
|
+
|
101
|
+
<footer id="validator-badges" role="contentinfo">
|
102
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
103
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.2.0.
|
104
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
105
|
+
</footer>
|
106
|
+
|
@@ -1,243 +1,243 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
|
3
|
-
<html>
|
4
|
-
<head>
|
5
|
-
<meta charset="UTF-8">
|
6
|
-
|
7
|
-
<title>class Silicium::Geometry::Line2dCanon - RDoc Documentation</title>
|
8
|
-
|
9
|
-
<script type="text/javascript">
|
10
|
-
var rdoc_rel_prefix = "../../";
|
11
|
-
var index_rel_prefix = "../../";
|
12
|
-
</script>
|
13
|
-
|
14
|
-
<script src="../../js/navigation.js" defer></script>
|
15
|
-
<script src="../../js/search.js" defer></script>
|
16
|
-
<script src="../../js/search_index.js" defer></script>
|
17
|
-
<script src="../../js/searcher.js" defer></script>
|
18
|
-
<script src="../../js/darkfish.js" defer></script>
|
19
|
-
|
20
|
-
<link href="../../css/fonts.css" rel="stylesheet">
|
21
|
-
<link href="../../css/rdoc.css" rel="stylesheet">
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
<body id="top" role="document" class="class">
|
27
|
-
<nav role="navigation">
|
28
|
-
<div id="project-navigation">
|
29
|
-
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
30
|
-
<h2>
|
31
|
-
<a href="../../index.html" rel="home">Home</a>
|
32
|
-
</h2>
|
33
|
-
|
34
|
-
<div id="table-of-contents-navigation">
|
35
|
-
<a href="../../table_of_contents.html#pages">Pages</a>
|
36
|
-
<a href="../../table_of_contents.html#classes">Classes</a>
|
37
|
-
<a href="../../table_of_contents.html#methods">Methods</a>
|
38
|
-
</div>
|
39
|
-
</div>
|
40
|
-
|
41
|
-
<div id="search-section" role="search" class="project-section initially-hidden">
|
42
|
-
<form action="#" method="get" accept-charset="utf-8">
|
43
|
-
<div id="search-field-wrapper">
|
44
|
-
<input id="search-field" role="combobox" aria-label="Search"
|
45
|
-
aria-autocomplete="list" aria-controls="search-results"
|
46
|
-
type="text" name="search" placeholder="Search" spellcheck="false"
|
47
|
-
title="Type to search, Up and Down to navigate, Enter to load">
|
48
|
-
</div>
|
49
|
-
|
50
|
-
<ul id="search-results" aria-label="Search Results"
|
51
|
-
aria-busy="false" aria-expanded="false"
|
52
|
-
aria-atomic="false" class="initially-hidden"></ul>
|
53
|
-
</form>
|
54
|
-
</div>
|
55
|
-
|
56
|
-
</div>
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
<div id="class-metadata">
|
61
|
-
|
62
|
-
<div id="parent-class-section" class="nav-section">
|
63
|
-
<h3>Parent</h3>
|
64
|
-
|
65
|
-
|
66
|
-
<p class="link"><a href="../../Object.html">Object</a>
|
67
|
-
|
68
|
-
</div>
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
<!-- Method Quickref -->
|
73
|
-
<div id="method-list-section" class="nav-section">
|
74
|
-
<h3>Methods</h3>
|
75
|
-
|
76
|
-
<ul class="link-list" role="directory">
|
77
|
-
|
78
|
-
<li ><a href="#method-c-new">::new</a>
|
79
|
-
|
80
|
-
<li ><a href="#method-i-point_is_on_line-3F">#point_is_on_line?</a>
|
81
|
-
|
82
|
-
</ul>
|
83
|
-
</div>
|
84
|
-
|
85
|
-
</div>
|
86
|
-
</nav>
|
87
|
-
|
88
|
-
<main role="main" aria-labelledby="class-Silicium::Geometry::Line2dCanon">
|
89
|
-
<h1 id="class-Silicium::Geometry::Line2dCanon" class="class">
|
90
|
-
class Silicium::Geometry::Line2dCanon
|
91
|
-
</h1>
|
92
|
-
|
93
|
-
<section class="description">
|
94
|
-
|
95
|
-
<p>Class represents a line as equation y = k*x +b k - slope b - <a href="Line2dCanon.html#attribute-i-free_term"><code>free_term</code></a> in two-dimensional space</p>
|
96
|
-
|
97
|
-
</section>
|
98
|
-
|
99
|
-
|
100
|
-
<section id="5Buntitled-5D" class="documentation-section">
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
<section class="attribute-method-details" class="method-section">
|
109
|
-
<header>
|
110
|
-
<h3>Attributes</h3>
|
111
|
-
</header>
|
112
|
-
|
113
|
-
|
114
|
-
<div id="attribute-i-free_term" class="method-detail">
|
115
|
-
<div class="method-heading attribute-method-heading">
|
116
|
-
<span class="method-name">free_term</span><span
|
117
|
-
class="attribute-access-type">[R]</span>
|
118
|
-
</div>
|
119
|
-
|
120
|
-
<div class="method-description">
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
</div>
|
125
|
-
</div>
|
126
|
-
|
127
|
-
<div id="attribute-i-slope" class="method-detail">
|
128
|
-
<div class="method-heading attribute-method-heading">
|
129
|
-
<span class="method-name">slope</span><span
|
130
|
-
class="attribute-access-type">[R]</span>
|
131
|
-
</div>
|
132
|
-
|
133
|
-
<div class="method-description">
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
</div>
|
138
|
-
</div>
|
139
|
-
|
140
|
-
</section>
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
145
|
-
<header>
|
146
|
-
<h3>Public Class Methods</h3>
|
147
|
-
</header>
|
148
|
-
|
149
|
-
|
150
|
-
<div id="method-c-new" class="method-detail ">
|
151
|
-
|
152
|
-
<div class="method-heading">
|
153
|
-
<span class="method-name">new</span><span
|
154
|
-
class="method-args">(p1, p2)</span>
|
155
|
-
|
156
|
-
<span class="method-click-advice">click to toggle source</span>
|
157
|
-
|
158
|
-
</div>
|
159
|
-
|
160
|
-
|
161
|
-
<div class="method-description">
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
<div class="method-source-code" id="new-source">
|
169
|
-
<pre><span class="ruby-comment"># File lib/geometry.rb, line 31</span>
|
170
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">p1</span>, <span class="ruby-identifier">p2</span>)
|
171
|
-
<span class="ruby-keyword">if</span> (<span class="ruby-identifier">p1</span>.<span class="ruby-identifier">x</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">p2</span>.<span class="ruby-identifier">x</span>) <span class="ruby-operator">&&</span> (<span class="ruby-identifier">p1</span>.<span class="ruby-identifier">y</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">p2</span>.<span class="ruby-identifier">y</span>)
|
172
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-string">"You need 2 diffrent points"</span>
|
173
|
-
<span class="ruby-keyword">end</span>
|
174
|
-
<span class="ruby-keyword">if</span> (<span class="ruby-identifier">p1</span>.<span class="ruby-identifier">x</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">p2</span>.<span class="ruby-identifier">x</span>)
|
175
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-string">"The straight line equation cannot be written in canonical form"</span>
|
176
|
-
<span class="ruby-keyword">end</span>
|
177
|
-
<span class="ruby-ivar">@slope</span> = (<span class="ruby-identifier">p2</span>.<span class="ruby-identifier">y</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">p1</span>.<span class="ruby-identifier">y</span>) <span class="ruby-operator">/</span> (<span class="ruby-identifier">p2</span>.<span class="ruby-identifier">x</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">p1</span>.<span class="ruby-identifier">x</span>).<span class="ruby-identifier">to_f</span>
|
178
|
-
<span class="ruby-ivar">@free_term</span> = (<span class="ruby-identifier">p2</span>.<span class="ruby-identifier">x</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">p1</span>.<span class="ruby-identifier">y</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">p2</span>.<span class="ruby-identifier">y</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">p1</span>.<span class="ruby-identifier">x</span>) <span class="ruby-operator">/</span> (<span class="ruby-identifier">p2</span>.<span class="ruby-identifier">x</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">p1</span>.<span class="ruby-identifier">x</span>).<span class="ruby-identifier">to_f</span>
|
179
|
-
<span class="ruby-keyword">end</span></pre>
|
180
|
-
</div>
|
181
|
-
|
182
|
-
</div>
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
</div>
|
188
|
-
|
189
|
-
|
190
|
-
</section>
|
191
|
-
|
192
|
-
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
193
|
-
<header>
|
194
|
-
<h3>Public Instance Methods</h3>
|
195
|
-
</header>
|
196
|
-
|
197
|
-
|
198
|
-
<div id="method-i-point_is_on_line-3F" class="method-detail ">
|
199
|
-
|
200
|
-
<div class="method-heading">
|
201
|
-
<span class="method-name">point_is_on_line?</span><span
|
202
|
-
class="method-args">(p1)</span>
|
203
|
-
|
204
|
-
<span class="method-click-advice">click to toggle source</span>
|
205
|
-
|
206
|
-
</div>
|
207
|
-
|
208
|
-
|
209
|
-
<div class="method-description">
|
210
|
-
|
211
|
-
<p>Checks the point lies on the line or not</p>
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
<div class="method-source-code" id="point_is_on_line-3F-source">
|
217
|
-
<pre><span class="ruby-comment"># File lib/geometry.rb, line 44</span>
|
218
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">point_is_on_line?</span>(<span class="ruby-identifier">p1</span>)
|
219
|
-
<span class="ruby-identifier">p1</span>.<span class="ruby-identifier">y</span> <span class="ruby-operator">==</span> <span class="ruby-ivar">@slope</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">p1</span>.<span class="ruby-identifier">x</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@free_term</span>
|
220
|
-
<span class="ruby-keyword">end</span></pre>
|
221
|
-
</div>
|
222
|
-
|
223
|
-
</div>
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
</div>
|
229
|
-
|
230
|
-
|
231
|
-
</section>
|
232
|
-
|
233
|
-
</section>
|
234
|
-
|
235
|
-
</main>
|
236
|
-
|
237
|
-
|
238
|
-
<footer id="validator-badges" role="contentinfo">
|
239
|
-
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
240
|
-
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.2.0.
|
241
|
-
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
242
|
-
</footer>
|
243
|
-
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>class Silicium::Geometry::Line2dCanon - RDoc Documentation</title>
|
8
|
+
|
9
|
+
<script type="text/javascript">
|
10
|
+
var rdoc_rel_prefix = "../../";
|
11
|
+
var index_rel_prefix = "../../";
|
12
|
+
</script>
|
13
|
+
|
14
|
+
<script src="../../js/navigation.js" defer></script>
|
15
|
+
<script src="../../js/search.js" defer></script>
|
16
|
+
<script src="../../js/search_index.js" defer></script>
|
17
|
+
<script src="../../js/searcher.js" defer></script>
|
18
|
+
<script src="../../js/darkfish.js" defer></script>
|
19
|
+
|
20
|
+
<link href="../../css/fonts.css" rel="stylesheet">
|
21
|
+
<link href="../../css/rdoc.css" rel="stylesheet">
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
<body id="top" role="document" class="class">
|
27
|
+
<nav role="navigation">
|
28
|
+
<div id="project-navigation">
|
29
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
30
|
+
<h2>
|
31
|
+
<a href="../../index.html" rel="home">Home</a>
|
32
|
+
</h2>
|
33
|
+
|
34
|
+
<div id="table-of-contents-navigation">
|
35
|
+
<a href="../../table_of_contents.html#pages">Pages</a>
|
36
|
+
<a href="../../table_of_contents.html#classes">Classes</a>
|
37
|
+
<a href="../../table_of_contents.html#methods">Methods</a>
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
42
|
+
<form action="#" method="get" accept-charset="utf-8">
|
43
|
+
<div id="search-field-wrapper">
|
44
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
45
|
+
aria-autocomplete="list" aria-controls="search-results"
|
46
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
47
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
48
|
+
</div>
|
49
|
+
|
50
|
+
<ul id="search-results" aria-label="Search Results"
|
51
|
+
aria-busy="false" aria-expanded="false"
|
52
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
53
|
+
</form>
|
54
|
+
</div>
|
55
|
+
|
56
|
+
</div>
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
<div id="class-metadata">
|
61
|
+
|
62
|
+
<div id="parent-class-section" class="nav-section">
|
63
|
+
<h3>Parent</h3>
|
64
|
+
|
65
|
+
|
66
|
+
<p class="link"><a href="../../Object.html">Object</a>
|
67
|
+
|
68
|
+
</div>
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
<!-- Method Quickref -->
|
73
|
+
<div id="method-list-section" class="nav-section">
|
74
|
+
<h3>Methods</h3>
|
75
|
+
|
76
|
+
<ul class="link-list" role="directory">
|
77
|
+
|
78
|
+
<li ><a href="#method-c-new">::new</a>
|
79
|
+
|
80
|
+
<li ><a href="#method-i-point_is_on_line-3F">#point_is_on_line?</a>
|
81
|
+
|
82
|
+
</ul>
|
83
|
+
</div>
|
84
|
+
|
85
|
+
</div>
|
86
|
+
</nav>
|
87
|
+
|
88
|
+
<main role="main" aria-labelledby="class-Silicium::Geometry::Line2dCanon">
|
89
|
+
<h1 id="class-Silicium::Geometry::Line2dCanon" class="class">
|
90
|
+
class Silicium::Geometry::Line2dCanon
|
91
|
+
</h1>
|
92
|
+
|
93
|
+
<section class="description">
|
94
|
+
|
95
|
+
<p>Class represents a line as equation y = k*x +b k - slope b - <a href="Line2dCanon.html#attribute-i-free_term"><code>free_term</code></a> in two-dimensional space</p>
|
96
|
+
|
97
|
+
</section>
|
98
|
+
|
99
|
+
|
100
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
<section class="attribute-method-details" class="method-section">
|
109
|
+
<header>
|
110
|
+
<h3>Attributes</h3>
|
111
|
+
</header>
|
112
|
+
|
113
|
+
|
114
|
+
<div id="attribute-i-free_term" class="method-detail">
|
115
|
+
<div class="method-heading attribute-method-heading">
|
116
|
+
<span class="method-name">free_term</span><span
|
117
|
+
class="attribute-access-type">[R]</span>
|
118
|
+
</div>
|
119
|
+
|
120
|
+
<div class="method-description">
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
</div>
|
125
|
+
</div>
|
126
|
+
|
127
|
+
<div id="attribute-i-slope" class="method-detail">
|
128
|
+
<div class="method-heading attribute-method-heading">
|
129
|
+
<span class="method-name">slope</span><span
|
130
|
+
class="attribute-access-type">[R]</span>
|
131
|
+
</div>
|
132
|
+
|
133
|
+
<div class="method-description">
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
</div>
|
138
|
+
</div>
|
139
|
+
|
140
|
+
</section>
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
145
|
+
<header>
|
146
|
+
<h3>Public Class Methods</h3>
|
147
|
+
</header>
|
148
|
+
|
149
|
+
|
150
|
+
<div id="method-c-new" class="method-detail ">
|
151
|
+
|
152
|
+
<div class="method-heading">
|
153
|
+
<span class="method-name">new</span><span
|
154
|
+
class="method-args">(p1, p2)</span>
|
155
|
+
|
156
|
+
<span class="method-click-advice">click to toggle source</span>
|
157
|
+
|
158
|
+
</div>
|
159
|
+
|
160
|
+
|
161
|
+
<div class="method-description">
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
<div class="method-source-code" id="new-source">
|
169
|
+
<pre><span class="ruby-comment"># File lib/geometry.rb, line 31</span>
|
170
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">p1</span>, <span class="ruby-identifier">p2</span>)
|
171
|
+
<span class="ruby-keyword">if</span> (<span class="ruby-identifier">p1</span>.<span class="ruby-identifier">x</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">p2</span>.<span class="ruby-identifier">x</span>) <span class="ruby-operator">&&</span> (<span class="ruby-identifier">p1</span>.<span class="ruby-identifier">y</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">p2</span>.<span class="ruby-identifier">y</span>)
|
172
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-string">"You need 2 diffrent points"</span>
|
173
|
+
<span class="ruby-keyword">end</span>
|
174
|
+
<span class="ruby-keyword">if</span> (<span class="ruby-identifier">p1</span>.<span class="ruby-identifier">x</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">p2</span>.<span class="ruby-identifier">x</span>)
|
175
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-string">"The straight line equation cannot be written in canonical form"</span>
|
176
|
+
<span class="ruby-keyword">end</span>
|
177
|
+
<span class="ruby-ivar">@slope</span> = (<span class="ruby-identifier">p2</span>.<span class="ruby-identifier">y</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">p1</span>.<span class="ruby-identifier">y</span>) <span class="ruby-operator">/</span> (<span class="ruby-identifier">p2</span>.<span class="ruby-identifier">x</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">p1</span>.<span class="ruby-identifier">x</span>).<span class="ruby-identifier">to_f</span>
|
178
|
+
<span class="ruby-ivar">@free_term</span> = (<span class="ruby-identifier">p2</span>.<span class="ruby-identifier">x</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">p1</span>.<span class="ruby-identifier">y</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">p2</span>.<span class="ruby-identifier">y</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">p1</span>.<span class="ruby-identifier">x</span>) <span class="ruby-operator">/</span> (<span class="ruby-identifier">p2</span>.<span class="ruby-identifier">x</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">p1</span>.<span class="ruby-identifier">x</span>).<span class="ruby-identifier">to_f</span>
|
179
|
+
<span class="ruby-keyword">end</span></pre>
|
180
|
+
</div>
|
181
|
+
|
182
|
+
</div>
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
</div>
|
188
|
+
|
189
|
+
|
190
|
+
</section>
|
191
|
+
|
192
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
193
|
+
<header>
|
194
|
+
<h3>Public Instance Methods</h3>
|
195
|
+
</header>
|
196
|
+
|
197
|
+
|
198
|
+
<div id="method-i-point_is_on_line-3F" class="method-detail ">
|
199
|
+
|
200
|
+
<div class="method-heading">
|
201
|
+
<span class="method-name">point_is_on_line?</span><span
|
202
|
+
class="method-args">(p1)</span>
|
203
|
+
|
204
|
+
<span class="method-click-advice">click to toggle source</span>
|
205
|
+
|
206
|
+
</div>
|
207
|
+
|
208
|
+
|
209
|
+
<div class="method-description">
|
210
|
+
|
211
|
+
<p>Checks the point lies on the line or not</p>
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
<div class="method-source-code" id="point_is_on_line-3F-source">
|
217
|
+
<pre><span class="ruby-comment"># File lib/geometry.rb, line 44</span>
|
218
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">point_is_on_line?</span>(<span class="ruby-identifier">p1</span>)
|
219
|
+
<span class="ruby-identifier">p1</span>.<span class="ruby-identifier">y</span> <span class="ruby-operator">==</span> <span class="ruby-ivar">@slope</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">p1</span>.<span class="ruby-identifier">x</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@free_term</span>
|
220
|
+
<span class="ruby-keyword">end</span></pre>
|
221
|
+
</div>
|
222
|
+
|
223
|
+
</div>
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
</div>
|
229
|
+
|
230
|
+
|
231
|
+
</section>
|
232
|
+
|
233
|
+
</section>
|
234
|
+
|
235
|
+
</main>
|
236
|
+
|
237
|
+
|
238
|
+
<footer id="validator-badges" role="contentinfo">
|
239
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
240
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.2.0.
|
241
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
242
|
+
</footer>
|
243
|
+
|