jruby_art 1.4.4 → 1.4.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 98b49db60a56abae0320a91468c009961ae28966d51c9915db011293ec919c35
4
- data.tar.gz: 182e5c42153bacaaff1fef1491281ba3628c4871b36bb6ddde22801dbc63d859
3
+ metadata.gz: b9a9b5241ee5d1814e103d6287d0d21525b58433551c8c4eb8b8209ac5e9a16d
4
+ data.tar.gz: bec90e1ced95245355f9b5404f5f68e7eedffb9e8489204de9f3dabba7210040
5
5
  SHA512:
6
- metadata.gz: 479667f201a3db4a30f0b7b3bb00204e17edd31ff911fa2a4d73a5861d7d08f57a0a79c56b42eeb6edffece43412204d26d34b3806dceb1b48e00b7a4ef8e8f1
7
- data.tar.gz: 496f84c634b14bc79ccfd59995afd64f98fcc071e322784609ad05711191b4e34e31879ae80a5b0de487e163125b8209069e65e430fbeef7d86bcf075e1ce8c5
6
+ metadata.gz: 482b3dcf6896f86af82710622d69ff42752da26cf6f26608d69126230e4091d827fb2a3b03e0c26e9d98444376db448b7486a43f7ca65afbd5167abd662a648f
7
+ data.tar.gz: ad3ddf8d652eac4ba42f209552c1c39abb8b13f905b91776b4063f86751364415bef9b854cc5084c03540a1a54747f4cdbf5de739b86400e4383adf9c4cd619c
@@ -8,7 +8,7 @@ module Processing
8
8
  config_path = "#{ENV['HOME']}/.jruby_art/config.yml"
9
9
  begin
10
10
  CONFIG_FILE_PATH = File.expand_path(config_path)
11
- RP_CONFIG = YAML.load_file(CONFIG_FILE_PATH)
11
+ RP_CONFIG = YAML.safe_load(File.read(CONFIG_FILE_PATH))
12
12
  rescue
13
13
  warn(format('WARN: you need to set PROCESSING_ROOT in %s', config_path))
14
14
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  # A wrapper for version
3
3
  module JRubyArt
4
- VERSION = '1.4.4'.freeze
4
+ VERSION = '1.4.5'.freeze
5
5
  end
Binary file
@@ -0,0 +1,69 @@
1
+ PHI ||= (1 + Math.sqrt(5)) / 2 # golden ratio
2
+ GA = PHI * 2 * Math::PI # golden angle
3
+
4
+ # Useful Vector Utiliies
5
+ module VectorUtil
6
+ def self.rotate_vec2d(vectors: [], angle: 0)
7
+ vectors.map { |vector| vector.rotate(angle) }
8
+ end
9
+
10
+ def self.vogel_layout(number:, node_size:)
11
+ (0..number).map do |i|
12
+ r = Math.sqrt(i)
13
+ theta = i * ((2 * Math::PI) / (PHI * PHI))
14
+ x = Math.cos(theta) * r * node_size
15
+ y = Math.sin(theta) * r * node_size
16
+ Vec2D.new(x, y)
17
+ end
18
+ end
19
+
20
+ def self.fibonacci_sphere(number:, radius:)
21
+ (0..number).map do |i|
22
+ lon = GA * i
23
+ lon /= 2 * Math::PI
24
+ lon -= lon.floor
25
+ lon *= 2 * Math::PI
26
+ lon -= 2 * Math::PI if lon > Math::PI
27
+ lat = Math.asin(-1 + 2 * i / number.to_f)
28
+ x = radius * Math.cos(lat) * Math.cos(lon)
29
+ y = radius * Math.cos(lat) * Math.sin(lon)
30
+ z = radius * Math.sin(lat)
31
+ Vec3D.new(x, y, z)
32
+ end
33
+ end
34
+
35
+ def self.spiral_layout(number:, radius:, resolution:, spacing:, inc:)
36
+ n = 0
37
+ angle = nil
38
+ (0..number).map do
39
+ angle = n * resolution
40
+ n += inc
41
+ radius -= angle * spacing
42
+ x = Math.cos(angle) * radius
43
+ y = Math.sin(angle) * radius
44
+ Vec2D.new(x, y)
45
+ end
46
+ end
47
+
48
+ def self.cartesian_to_polar(vec:)
49
+ res = Vec3D.new(vec.mag, 0, 0)
50
+ return Vec3D.new unless res.x > 0
51
+ res.y = -Math.atan2(vec.z, vec.x)
52
+ res.z = Math.asin(vec.y / res.x)
53
+ res
54
+ end
55
+
56
+ def self.to_cartesian(lat:, long:, radius:)
57
+ latitude = lat
58
+ longitude = long
59
+ x = radius * Math.cos(latitude) * Math.cos(longitude)
60
+ y = radius * Math.cos(latitude) * Math.sin(longitude)
61
+ z = radius * Math.sin(latitude)
62
+ Vec3D.new(x, y, z)
63
+ end
64
+
65
+ def self.polar_to_cartesian(vec:)
66
+ return Vec3D.new if vec.mag <= 0
67
+ Vec3D.new(Math.asin(vec.y / vec.mag), vec.mag, -Math.atan2(vec.z, vec.x))
68
+ end
69
+ end
@@ -11,7 +11,7 @@ EOS
11
11
 
12
12
  JRUBYC_VERSION = '9.1.15.0'
13
13
 
14
- EXAMPLES = '2.6'
14
+ EXAMPLES = '2.7'
15
15
  HOME_DIR = ENV['HOME']
16
16
  MAC_OR_LINUX = /linux|mac|darwin/ =~ RbConfig::CONFIG['host_os']
17
17
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jruby_art
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.4
4
+ version: 1.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Ashkenas
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-12-08 00:00:00.000000000 Z
13
+ date: 2018-01-08 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
@@ -18,14 +18,14 @@ dependencies:
18
18
  requirements:
19
19
  - - "~>"
20
20
  - !ruby/object:Gem::Version
21
- version: '12'
21
+ version: '12.3'
22
22
  type: :development
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - "~>"
27
27
  - !ruby/object:Gem::Version
28
- version: '12'
28
+ version: '12.3'
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: minitest
31
31
  requirement: !ruby/object:Gem::Requirement
@@ -43,8 +43,8 @@ dependencies:
43
43
  description: |2
44
44
  JRubyArt is a ruby wrapper for the processing art framework, with enhanced
45
45
  functionality. Use both processing libraries and ruby gems in your sketches.
46
- Features create/run/watch/live modes. The current release features several
47
- PixelFlow glsl library examples, including a few shadertoy demos as sketches.
46
+ Features create/run/watch/live modes. The current release features may be the
47
+ last before we start supporting ruby-2.4 in sketches.
48
48
  email: mamba2928@yahoo.co.uk
49
49
  executables:
50
50
  - k9
@@ -81,6 +81,7 @@ files:
81
81
  - library/library_proxy/README.md
82
82
  - library/library_proxy/library_proxy.rb
83
83
  - library/slider/slider.rb
84
+ - library/vector_utils/vector_utils.rb
84
85
  - library/video_event/video_event.rb
85
86
  - vendors/Rakefile
86
87
  homepage: https://ruby-processing.github.io/JRubyArt/
@@ -104,10 +105,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
105
  version: '0'
105
106
  requirements:
106
107
  - A decent graphics card
107
- - java runtime >= 1.8.0_131+
108
+ - java runtime >= 1.8.0_151+
108
109
  - processing = 3.3.6
109
110
  rubyforge_project:
110
- rubygems_version: 2.7.2
111
+ rubygems_version: 2.7.3
111
112
  signing_key:
112
113
  specification_version: 4
113
114
  summary: Code as Art, Art as Code. Processing and Ruby are meant for each other.