math_demo 0.1.1-java → 0.2.0-java
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/lib/circles.rb +2 -2
- data/lib/math_demo/circumcircle.rb +5 -10
- data/lib/math_demo/version.rb +1 -1
- metadata +11 -14
- data/lib/math_demo/matrix_math.md +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a614497ed312619c49a17d3244e2036885b9038
|
4
|
+
data.tar.gz: 5f30488fbee2fc8910b7ecc2f9a2571704ce1459
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc643976976cf90b0a33980fb98111f18e84da2b4c5420ed9911ae44ef9b342b527eddc6b667eb9b1f1f4e811e4d4dfe81f50ebc22c8d7c7afe8655685db7214
|
7
|
+
data.tar.gz: 21756afc665ac76ecce61a2f4e0fef091b4969d4a5b8fd801829d68f3dca840debc8e8d80dbed0179902f6a2b392d41652cc9c67cad9c97e95d3a205d35fe07a
|
data/lib/circles.rb
CHANGED
@@ -7,11 +7,11 @@ require_relative 'math_demo/triangle_point'
|
|
7
7
|
class Circles < Propane::App
|
8
8
|
|
9
9
|
def settings
|
10
|
-
size(800, 600
|
10
|
+
size(800, 600)
|
11
11
|
end
|
12
12
|
|
13
13
|
def setup
|
14
|
-
sketch_title '
|
14
|
+
sketch_title 'Math Demo'
|
15
15
|
color_mode(HSB, 360, 100, 100, 100)
|
16
16
|
reset
|
17
17
|
ellipse_mode(RADIUS)
|
@@ -1,6 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
require 'matrix'
|
3
3
|
|
4
|
+
# Circumcircle from 3 points
|
4
5
|
class Circumcircle
|
5
6
|
attr_reader :center, :radius, :points
|
6
7
|
def initialize(points)
|
@@ -19,25 +20,19 @@ class Circumcircle
|
|
19
20
|
|
20
21
|
def am
|
21
22
|
2 * Matrix[
|
22
|
-
|
23
|
-
[points[1].x, points[1].y, 1],
|
24
|
-
[points[2].x, points[2].y, 1]
|
23
|
+
*points.map { |pt| [pt.x, pt.y, 1] }
|
25
24
|
].determinant
|
26
25
|
end
|
27
26
|
|
28
27
|
def bx
|
29
28
|
-Matrix[
|
30
|
-
|
31
|
-
[points[1].x * points[1].x + points[1].y * points[1].y, points[1].y, 1],
|
32
|
-
[points[2].x * points[2].x + points[2].y * points[2].y, points[2].y, 1]
|
29
|
+
*points.map { |pt| [pt.x * pt.x + pt.y * pt.y, pt.y, 1] }
|
33
30
|
].determinant
|
34
31
|
end
|
35
32
|
|
36
33
|
def by
|
37
34
|
Matrix[
|
38
|
-
|
39
|
-
[points[1].x * points[1].x + points[1].y * points[1].y, points[1].x, 1],
|
40
|
-
[points[2].x * points[2].x + points[2].y * points[2].y, points[2].x, 1]
|
35
|
+
*points.map { |pt| [pt.x * pt.x + pt.y * pt.y, pt.x, 1] }
|
41
36
|
].determinant
|
42
37
|
end
|
43
38
|
end
|
data/lib/math_demo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: math_demo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- monkstone
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-07-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: propane
|
@@ -16,42 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '2.
|
19
|
+
version: '2.3'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '2.
|
26
|
+
version: '2.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '12'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '12'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '5.
|
47
|
+
version: '5.10'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '5.
|
54
|
+
version: '5.10'
|
55
55
|
description: " Math Demo uses propane (a ruby wrapper for the processing art framework)\n"
|
56
56
|
email: mamba2928@yahoo.co.uk
|
57
57
|
executables:
|
@@ -62,7 +62,6 @@ files:
|
|
62
62
|
- bin/math_demo
|
63
63
|
- lib/circles.rb
|
64
64
|
- lib/math_demo/circumcircle.rb
|
65
|
-
- lib/math_demo/matrix_math.md
|
66
65
|
- lib/math_demo/t_points.rb
|
67
66
|
- lib/math_demo/triangle_point.rb
|
68
67
|
- lib/math_demo/version.rb
|
@@ -70,7 +69,7 @@ homepage: https://ruby-processing.github.io/propane/
|
|
70
69
|
licenses:
|
71
70
|
- GPL-3.0
|
72
71
|
metadata: {}
|
73
|
-
post_install_message:
|
72
|
+
post_install_message: Congratulations you've just installed a propane gem.
|
74
73
|
rdoc_options: []
|
75
74
|
require_paths:
|
76
75
|
- lib
|
@@ -84,11 +83,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
84
83
|
- - ">="
|
85
84
|
- !ruby/object:Gem::Version
|
86
85
|
version: '0'
|
87
|
-
requirements:
|
88
|
-
- A decent graphics card
|
89
|
-
- java runtime >= 1.8.0_111+
|
86
|
+
requirements: []
|
90
87
|
rubyforge_project:
|
91
|
-
rubygems_version: 2.
|
88
|
+
rubygems_version: 2.5.1
|
92
89
|
signing_key:
|
93
90
|
specification_version: 4
|
94
91
|
summary: Example of creating a propane app.
|
@@ -1,17 +0,0 @@
|
|
1
|
-
### Matrix Math ###
|
2
|
-
|
3
|
-
For detailed workings see [Circumcircle at Mathworld Wolfram.com][circumcircle]
|
4
|
-
|
5
|
-
|
6
|
-
a = {{x<sub>1</sub> y<sub>1</sub> 1}, {x<sub>2</sub> y<sub>2</sub> 1}, {x<sub>3</sub> y<sub>3</sub> 1}}
|
7
|
-
|
8
|
-
bx = -{{x<sub>1</sub><sup>2</sup> + y<sub>1</sub><sup>2</sup> y<sub>1</sub> 1}, {x<sub>2</sub><sup>2</sup> + y<sub>2</sub><sup>2</sup> y<sub>2</sub> 1}, {x<sub>3</sub><sup>2</sup> + y<sub>3</sub><sup>2</sup> y<sub>3</sub> 1}}
|
9
|
-
|
10
|
-
by = {{x<sub>1</sub><sup>2</sup> + y<sub>1</sub><sup>2</sup> x<sub>1</sub> 1}, {x<sub>2</sub><sup>2</sup> + y<sub>2</sub><sup>2</sup> x<sub>2</sub> 1}, {x<sub>3</sub><sup>2</sup> + y<sub>3</sub><sup>2</sup> x<sub>3</sub> 1}}
|
11
|
-
|
12
|
-
xo = -bx / 2 * a
|
13
|
-
|
14
|
-
yo = -by / 2 * a
|
15
|
-
|
16
|
-
|
17
|
-
[circumcircle]:http://mathworld.wolfram.com/Circumcircle.html
|