jruby_art 2.2.2 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # @TODO usage
2
4
  class Processing::App
3
5
  java_import Java::ProcessingNet::Client
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # Here's a little library for quickly hooking up in sketch sliders.
3
- # Copyright (c) 2016-19 Martin Prout.
4
+ # Copyright (c) 2015-20 Martin Prout.
4
5
 
5
6
  java_import 'monkstone.slider.CustomHorizontalSlider'
6
7
  java_import 'monkstone.slider.CustomVerticalSlider'
@@ -8,34 +9,34 @@ java_import 'monkstone.slider.CustomVerticalSlider'
8
9
  module Slider
9
10
  def self.slider(app:, x:, y:, name:, **opts)
10
11
  options = default.merge opts
11
- if options[:vertical]
12
- slider = CustomVerticalSlider.new(
13
- app,
14
- x,
15
- y,
16
- options[:length],
17
- options[:range].first,
18
- options[:range].last,
19
- name
20
- )
21
- else
22
- slider = CustomHorizontalSlider.new(
23
- app,
24
- x,
25
- y,
26
- options[:length],
27
- options[:range].first,
28
- options[:range].last,
29
- name
30
- )
31
- end
12
+ slider = if options[:vertical]
13
+ CustomVerticalSlider.new(
14
+ app,
15
+ x,
16
+ y,
17
+ options[:length],
18
+ options[:range].first,
19
+ options[:range].last,
20
+ name
21
+ )
22
+ else
23
+ CustomHorizontalSlider.new(
24
+ app,
25
+ x,
26
+ y,
27
+ options[:length],
28
+ options[:range].first,
29
+ options[:range].last,
30
+ name
31
+ )
32
+ end
32
33
  unless opts.empty?
33
34
  slider.bar_width(opts.fetch(:bar_width, 10))
34
35
  slider.set_value(opts.fetch(:initial_value, 0))
35
36
  end
36
37
  slider
37
38
  end
38
-
39
+
39
40
  def self.default
40
41
  { length: 100, range: (0..100) }
41
42
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  PHI ||= (1 + Math.sqrt(5)) / 2 # golden ratio
2
4
  GA = PHI * 2 * Math::PI # golden angle
3
5
 
@@ -47,7 +49,8 @@ module VectorUtil
47
49
 
48
50
  def self.cartesian_to_polar(vec:)
49
51
  res = Vec3D.new(vec.mag, 0, 0)
50
- return Vec3D.new unless res.x > 0
52
+ return Vec3D.new unless res.x.positive?
53
+
51
54
  res.y = -Math.atan2(vec.z, vec.x)
52
55
  res.z = Math.asin(vec.y / res.x)
53
56
  res
@@ -64,6 +67,7 @@ module VectorUtil
64
67
 
65
68
  def self.polar_to_cartesian(vec:)
66
69
  return Vec3D.new if vec.mag <= 0
70
+
67
71
  Vec3D.new(Math.asin(vec.y / vec.mag), vec.mag, -Math.atan2(vec.z, vec.x))
68
72
  end
69
73
  end
@@ -1,3 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ # include interfaces
1
4
  class Processing::App
2
5
  include Java::MonkstoneVideoevent::MovieEvent
3
6
  include Java::MonkstoneVideoevent::CaptureEvent
@@ -11,21 +11,21 @@ WARNING = <<~WARN
11
11
 
12
12
  WARN
13
13
  # https://github.com/processing/processing-video/releases/download/r6-v2.0-beta4/video-2.0-beta4.zip
14
- JRUBYC_VERSION = '9.2.9.0'
14
+ JRUBYC_VERSION = '9.2.11.0'
15
15
  SOUND = 'sound.zip'
16
16
  SOUND_VERSION = 'v2.2.2'
17
17
  VIDEO = 'video-2.0-beta4.zip'
18
18
  VIDEO_VERSION = 'r6-v2.0-beta4'
19
- EXAMPLES = '3.5'
19
+ EXAMPLES = '3.6'
20
20
  HOME_DIR = ENV['HOME']
21
- MAC_OR_LINUX = /linux|mac|darwin/ =~ RbConfig::CONFIG['host_os']
21
+ MAC_OR_LINUX = /linux|mac|darwin/.match?(RbConfig::CONFIG['host_os'])
22
22
 
23
23
  CLOBBER << "jruby-complete-#{JRUBYC_VERSION}.jar"
24
24
  CLOBBER << "jruby-complete-#{JRUBYC_VERSION}.jar.sha256"
25
25
 
26
26
  desc 'dependency check'
27
27
  task :wget_check do
28
- WGET ||= `which wget`
28
+ WGET ||= `which wget`.freeze
29
29
  warn WARNING unless WGET
30
30
  end
31
31
 
@@ -105,7 +105,9 @@ end
105
105
  desc 'copy sound library'
106
106
  task copy_sound: SOUND do
107
107
  system "unzip #{SOUND}"
108
- FileUtils.rm_r "#{HOME_DIR}/.picrate/libraries/sound" if File.exist? "#{HOME_DIR}/.jruby_art/libraries/sound"
108
+ if File.exist? "#{HOME_DIR}/.jruby_art/libraries/sound"
109
+ FileUtils.rm_r "#{HOME_DIR}/.picrate/libraries/sound"
110
+ end
109
111
  FileUtils.cp_r 'sound', "#{HOME_DIR}/.jruby_art/libraries"
110
112
  FileUtils.rm_r 'sound'
111
113
  end
@@ -113,7 +115,9 @@ end
113
115
  desc 'copy video library'
114
116
  task copy_video: VIDEO do
115
117
  system "unzip #{VIDEO}"
116
- FileUtils.rm_r "#{HOME_DIR}/.picrate/libraries/video" if File.exist? "#{HOME_DIR}/.jruby_art/libraries/video"
118
+ if File.exist? "#{HOME_DIR}/.jruby_art/libraries/video"
119
+ FileUtils.rm_r "#{HOME_DIR}/.picrate/libraries/video"
120
+ end
117
121
  FileUtils.cp_r 'video', "#{HOME_DIR}/.jruby_art/libraries/video"
118
122
  FileUtils.rm_r 'video'
119
123
  end
@@ -139,7 +143,9 @@ task copy_examples: file_name do
139
143
  else
140
144
  system "tar xzvf #{EXAMPLES}.tar.gz"
141
145
  end
142
- FileUtils.rm_r("#{HOME_DIR}/k9_samples") if File.exist? "#{HOME_DIR}/k9_samples"
146
+ if File.exist? "#{HOME_DIR}/k9_samples"
147
+ FileUtils.rm_r("#{HOME_DIR}/k9_samples")
148
+ end
143
149
  FileUtils.cp_r("JRubyArt-examples-#{EXAMPLES}", "#{HOME_DIR}/k9_samples")
144
150
  FileUtils.rm_r("JRubyArt-examples-#{EXAMPLES}")
145
151
  end
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jruby_art
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Prout
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-22 00:00:00.000000000 Z
11
+ date: 2020-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rake
14
+ name: minitest
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '12.3'
19
+ version: '5.10'
20
20
  type: :development
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: '12.3'
26
+ version: '5.10'
27
27
  - !ruby/object:Gem::Dependency
28
- name: minitest
28
+ name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '5.10'
33
+ version: '12.3'
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: '5.10'
40
+ version: '12.3'
41
41
  description: |2
42
42
  JRubyArt-2.0+ is a ruby implementation of the processing art framework, with enhanced
43
43
  functionality. Processing libraries and ruby gems can be used in your sketches.
@@ -57,7 +57,7 @@ files:
57
57
  - lib/jogl-all-natives-macosx-universal.jar
58
58
  - lib/jogl-all-natives-windows-amd64.jar
59
59
  - lib/jogl-all.jar
60
- - lib/jruby_art-2.2.2.jar
60
+ - lib/jruby_art-2.3.0.jar
61
61
  - lib/jruby_art.rb
62
62
  - lib/jruby_art/app.rb
63
63
  - lib/jruby_art/config.rb
@@ -107,7 +107,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: '2.3'
110
+ version: '2.4'
111
111
  required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  requirements:
113
113
  - - ">="
Binary file