picrate 1.2.4-java → 2.1.1-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/Gemfile +3 -1
  4. data/README.md +11 -10
  5. data/Rakefile +10 -9
  6. data/bin/picrate +3 -1
  7. data/docs/_config.yml +1 -1
  8. data/docs/_editors/geany.md +1 -0
  9. data/docs/_gems/gems/gems.md +1 -1
  10. data/docs/_methods/alternative_methods.md +2 -1
  11. data/docs/_posts/2018-05-06-getting_started.md +4 -4
  12. data/docs/_posts/2018-05-06-install_jruby.md +5 -11
  13. data/docs/_posts/2018-05-11-arch-linux-arm.md +1 -11
  14. data/docs/_posts/2018-11-18-building-gem.md +2 -2
  15. data/docs/_posts/2018-11-27-getting_started_geany.md +1 -1
  16. data/docs/_posts/2019-11-11-getting_started_buster.md +4 -7
  17. data/docs/_posts/{2018-06-26-auto_install_picrate.md → 2020-03-09-auto_install_picrate.md} +9 -6
  18. data/docs/_posts/2020-05-11-getting_started_manjaro.md +94 -0
  19. data/docs/about.md +1 -1
  20. data/lib/picrate.rb +1 -1
  21. data/lib/picrate/app.rb +11 -3
  22. data/lib/picrate/creators/parameters.rb +8 -8
  23. data/lib/picrate/creators/sketch_factory.rb +5 -3
  24. data/lib/picrate/helper_methods.rb +21 -21
  25. data/lib/picrate/helpers/numeric.rb +2 -0
  26. data/lib/picrate/library.rb +5 -1
  27. data/lib/picrate/library_loader.rb +2 -0
  28. data/lib/picrate/native_folder.rb +2 -1
  29. data/lib/picrate/native_loader.rb +3 -0
  30. data/lib/picrate/runner.rb +1 -0
  31. data/lib/picrate/version.rb +1 -1
  32. data/library/boids/boids.rb +17 -8
  33. data/library/chooser/chooser.rb +10 -9
  34. data/library/color_group/color_group.rb +2 -0
  35. data/library/control_panel/control_panel.rb +7 -4
  36. data/library/dxf/dxf.rb +2 -0
  37. data/library/library_proxy/library_proxy.rb +2 -0
  38. data/library/net/net.rb +2 -0
  39. data/library/slider/slider.rb +24 -23
  40. data/library/vector_utils/vector_utils.rb +4 -0
  41. data/library/video_event/video_event.rb +2 -0
  42. data/picrate.gemspec +13 -14
  43. data/pom.rb +28 -26
  44. data/pom.xml +18 -6
  45. data/src/main/java/monkstone/ColorUtil.java +1 -1
  46. data/src/main/java/monkstone/MathToolModule.java +1 -1
  47. data/src/main/java/monkstone/PicrateLibrary.java +8 -8
  48. data/src/main/java/monkstone/fastmath/Deglut.java +16 -16
  49. data/src/main/java/monkstone/filechooser/Chooser.java +1 -1
  50. data/src/main/java/monkstone/noise/SimplexNoise.java +3 -3
  51. data/src/main/java/monkstone/slider/CustomHorizontalSlider.java +1 -1
  52. data/src/main/java/monkstone/slider/CustomVerticalSlider.java +1 -1
  53. data/src/main/java/monkstone/slider/SimpleHorizontalSlider.java +12 -12
  54. data/src/main/java/monkstone/slider/SimpleVerticalSlider.java +1 -1
  55. data/src/main/java/monkstone/slider/SliderBar.java +1 -1
  56. data/src/main/java/monkstone/slider/SliderGroup.java +1 -1
  57. data/src/main/java/monkstone/slider/WheelHandler.java +1 -1
  58. data/src/main/java/monkstone/vecmath/package-info.java +1 -1
  59. data/src/main/java/monkstone/vecmath/vec2/Vec2.java +1 -1
  60. data/src/main/java/monkstone/vecmath/vec3/Vec3.java +1 -1
  61. data/src/main/java/monkstone/videoevent/CaptureEvent.java +1 -1
  62. data/src/main/java/monkstone/videoevent/MovieEvent.java +1 -1
  63. data/src/main/java/monkstone/videoevent/package-info.java +1 -1
  64. data/src/main/java/processing/awt/PGraphicsJava2D.java +33 -36
  65. data/src/main/java/processing/awt/PImageAWT.java +377 -0
  66. data/src/main/java/processing/awt/PSurfaceAWT.java +0 -20
  67. data/src/main/java/processing/awt/ShimAWT.java +545 -0
  68. data/src/main/java/processing/core/PApplet.java +699 -1523
  69. data/src/main/java/processing/core/PConstants.java +180 -180
  70. data/src/main/java/processing/core/PFont.java +2 -2
  71. data/src/main/java/processing/core/PGraphics.java +190 -176
  72. data/src/main/java/processing/core/PImage.java +1536 -1721
  73. data/src/main/java/processing/core/PMatrix.java +39 -39
  74. data/src/main/java/processing/core/PSurface.java +69 -103
  75. data/src/main/java/processing/core/PSurfaceNone.java +29 -0
  76. data/src/main/java/processing/core/PVector.java +2 -2
  77. data/src/main/java/processing/data/FloatDict.java +251 -284
  78. data/src/main/java/processing/data/TableRow.java +32 -32
  79. data/src/main/java/processing/dxf/RawDXF.java +3 -3
  80. data/src/main/java/processing/net/Client.java +1 -1
  81. data/src/main/java/processing/opengl/PGL.java +1016 -4132
  82. data/src/main/java/processing/opengl/PGraphicsOpenGL.java +223 -184
  83. data/src/main/java/processing/opengl/PJOGL.java +374 -1526
  84. data/src/main/java/processing/opengl/PShapeOpenGL.java +5 -6
  85. data/src/main/java/processing/opengl/PSurfaceJOGL.java +262 -147
  86. data/test/color_group_test.rb +4 -4
  87. data/test/deglut_spec_test.rb +2 -0
  88. data/test/helper_methods_test.rb +41 -13
  89. data/test/math_tool_test.rb +46 -37
  90. data/test/respond_to_test.rb +5 -3
  91. data/test/sketches/key_event.rb +2 -2
  92. data/test/sketches/library/my_library/my_library.rb +3 -0
  93. data/test/test_helper.rb +2 -0
  94. data/test/vecmath_spec_test.rb +30 -19
  95. data/vendors/Rakefile +8 -5
  96. data/vendors/{picrate_sketches.geany → geany.rb} +32 -7
  97. metadata +25 -46
  98. data/src/main/java/processing/opengl/shaders/LightVert-brcm.glsl +0 -154
  99. data/src/main/java/processing/opengl/shaders/LightVert-vc4.glsl +0 -154
  100. data/src/main/java/processing/opengl/shaders/TexLightVert-brcm.glsl +0 -160
  101. data/src/main/java/processing/opengl/shaders/TexLightVert-vc4.glsl +0 -160
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # @TODO usage
2
4
  class Processing::App
3
5
  java_import Java::ProcessingDxf::RawDXF
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  java_import Java::MonkstoneCore::LibraryProxy
2
4
  java_import Java::ProcessingEvent::KeyEvent
3
5
  java_import Java::ProcessingEvent::MouseEvent
@@ -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-18 Martin Prout.
4
+ # Copyright (c) 2016-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
 
@@ -48,6 +50,7 @@ module VectorUtil
48
50
  def self.cartesian_to_polar(vec:)
49
51
  res = Vec3D.new(vec.mag, 0, 0)
50
52
  return Vec3D.new unless res.x > 0
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,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Processing::App
2
4
  include Java::MonkstoneVideoevent::MovieEvent
3
5
  include Java::MonkstoneVideoevent::CaptureEvent
@@ -1,5 +1,6 @@
1
- # -*- encoding: utf-8 -*-
2
- lib = File.expand_path('../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require 'picrate/version'
5
6
 
@@ -8,32 +9,30 @@ Gem::Specification.new do |gem|
8
9
  gem.version = PiCrate::VERSION
9
10
  gem.authors = ['monkstone']
10
11
  gem.email = ['mamba2928@yahoo.co.uk']
11
- gem.licenses = %w(GPL-3.0 LGPL-2.0)
12
+ gem.licenses = %w[GPL-3.0 LGPL-2.0]
12
13
  gem.description = <<~EOS
13
14
  A batteries included version of processing in ruby, for raspberrypi and
14
15
  linux. Install samples to configures geany ide.
15
16
  EOS
16
- gem.summary = %q{ruby implementation of processing-3 on raspberrypi and linux64}
17
+ gem.summary = 'ruby implementation of processing-3 on raspberrypi and linux64'
17
18
  gem.homepage = 'https://ruby-processing.github.io/PiCrate/'
18
- gem.post_install_message = %q{Use 'picrate --install' to config geany & install samples}
19
- gem.files = `git ls-files`.split($/)
19
+ gem.post_install_message = "Use 'picrate --install' to config geany & install samples"
20
+ gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
20
21
  gem.files << "lib/picrate-#{PiCrate::VERSION}.jar"
21
22
  gem.files << 'lib/gluegen-rt.jar'
22
23
  gem.files << 'lib/jogl-all.jar'
23
24
  gem.files << 'lib/gluegen-rt-natives-linux-amd64.jar'
24
25
  gem.files << 'lib/gluegen-rt-natives-linux-armv6hf.jar'
25
- # gem.files << 'lib/gluegen-rt-natives-linux-aarch64.jar'
26
+ gem.files << 'lib/gluegen-rt-natives-linux-aarch64.jar'
26
27
  gem.files << 'lib/jogl-all-natives-linux-amd64.jar'
27
28
  gem.files << 'lib/jogl-all-natives-linux-armv6hf.jar'
28
- # gem.files << 'lib/jogl-all-natives-linux-aarch64.jar'
29
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
29
+ gem.files << 'lib/jogl-all-natives-linux-aarch64.jar'
30
+ gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
30
31
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
31
- gem.add_development_dependency 'rake', '~> 12.3'
32
32
  gem.add_development_dependency 'minitest', '~> 5.10'
33
- gem.add_runtime_dependency 'arcball', '~> 1.0.1'
34
- gem.add_runtime_dependency 'geomerative', '~> 1.1'
35
- gem.add_runtime_dependency 'ruby_wordcram', '~> 2.0.4'
33
+ gem.add_development_dependency 'rake', '~> 12.3'
34
+ gem.add_runtime_dependency 'arcball', '~> 1.0', '>= 1.0.1'
36
35
  gem.require_paths = ['lib']
37
36
  gem.platform = 'java'
38
- gem.requirements << 'java runtime == 8'
37
+ gem.requirements << 'java runtime == 11'
39
38
  end
data/pom.rb CHANGED
@@ -1,7 +1,8 @@
1
- project 'picrate', 'http://maven.apache.org' do
1
+ # frozen_string_literal: true
2
2
 
3
+ project 'picrate', 'http://maven.apache.org' do
3
4
  model_version '4.0.0'
4
- id 'ruby-processing:picrate:1.2.4'
5
+ id 'ruby-processing:picrate:2.1.1'
5
6
  packaging 'jar'
6
7
 
7
8
  description 'An integrated processing-core (somewhat hacked), with additional java code for a jruby version of processing.'
@@ -21,17 +22,16 @@ project 'picrate', 'http://maven.apache.org' do
21
22
  license 'LGPL 2', 'https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html'
22
23
 
23
24
  issue_management 'https://github.com/ruby-processing/PiCrate/issues', 'Github'
25
+ # Need to update to jogl 2.4.1 as soon as available, then make a dependency
26
+ properties('jogl.version' => '2.3.2',
27
+ 'jruby.api' => 'http://jruby.org/apidocs/',
28
+ 'source.directory' => 'src',
29
+ 'processing.api' => 'http://processing.github.io/processing-javadocs/core/',
30
+ 'picrate.basedir' => '${project.basedir}',
31
+ 'project.build.sourceEncoding' => 'utf-8',
32
+ 'polyglot.dump.pom' => 'pom.xml')
24
33
 
25
- properties( 'jogl.version' => '2.3.2',
26
- 'jruby.api' => 'http://jruby.org/apidocs/',
27
- 'source.directory' => 'src',
28
- 'processing.api' => 'http://processing.github.io/processing-javadocs/core/',
29
- 'picrate.basedir' => '${project.basedir}',
30
- 'project.build.sourceEncoding' => 'utf-8',
31
- 'polyglot.dump.pom' => 'pom.xml'
32
- )
33
-
34
- pom 'org.jruby:jruby:9.2.9.0'
34
+ pom 'org.jruby:jruby:9.2.13.0'
35
35
  jar 'org.jogamp.jogl:jogl-all:${jogl.version}'
36
36
  jar 'org.jogamp.gluegen:gluegen-rt-main:${jogl.version}'
37
37
  jar 'org.processing:video:3.0.2'
@@ -39,20 +39,22 @@ end
39
39
 
40
40
  overrides do
41
41
  plugin :resources, '3.1.0'
42
- plugin :dependency, '3.1.1'
43
- plugin( :compiler, '3.8.1', 'release' => '8' )
44
- plugin(
45
- :javadoc,
46
- '3.1.1',
47
- 'detectOfflineLinks' => 'false',
48
- 'links' => [ '${processing.api}', '${jruby.api}' ]
49
- )
50
- plugin(
51
- :jar, '3.1.2',
52
- 'archive' => {
53
- 'manifestEntries' => { 'Class-Path' => 'gluegen-rt.jar jog-all.jar' }
54
- }
55
- )
42
+ plugin :dependency, '3.1.2'
43
+ plugin(:compiler, '3.8.1',
44
+ 'release' => '11')
45
+ plugin(:javadoc, '2.10.4',
46
+ 'detectOfflineLinks' => 'false',
47
+ 'links' => ['${processing.api}',
48
+ '${jruby.api}'])
49
+ plugin(:jar, '3.2.0',
50
+ 'archive' => {
51
+ 'manifestEntries' => {
52
+ 'Class-Path' => 'gluegen-rt.jar jog-all.jar'
53
+ }
54
+ })
55
+ plugin :jdeps, '3.1.2' do
56
+ execute_goals 'jdkinternals', 'test-jdkinternals'
57
+ end
56
58
  end
57
59
 
58
60
  build do
data/pom.xml CHANGED
@@ -11,7 +11,7 @@ DO NOT MODIFIY - GENERATED CODE
11
11
  <modelVersion>4.0.0</modelVersion>
12
12
  <groupId>ruby-processing</groupId>
13
13
  <artifactId>picrate</artifactId>
14
- <version>1.2.4</version>
14
+ <version>2.1.1</version>
15
15
  <name>picrate</name>
16
16
  <description>An integrated processing-core (somewhat hacked), with additional java code for a jruby version of processing.</description>
17
17
  <url>http://maven.apache.org</url>
@@ -76,7 +76,7 @@ DO NOT MODIFIY - GENERATED CODE
76
76
  <dependency>
77
77
  <groupId>org.jruby</groupId>
78
78
  <artifactId>jruby</artifactId>
79
- <version>9.2.9.0</version>
79
+ <version>9.2.13.0</version>
80
80
  <type>pom</type>
81
81
  </dependency>
82
82
  <dependency>
@@ -123,18 +123,18 @@ DO NOT MODIFIY - GENERATED CODE
123
123
  </plugin>
124
124
  <plugin>
125
125
  <artifactId>maven-dependency-plugin</artifactId>
126
- <version>3.1.1</version>
126
+ <version>3.1.2</version>
127
127
  </plugin>
128
128
  <plugin>
129
129
  <artifactId>maven-compiler-plugin</artifactId>
130
130
  <version>3.8.1</version>
131
131
  <configuration>
132
- <release>8</release>
132
+ <release>11</release>
133
133
  </configuration>
134
134
  </plugin>
135
135
  <plugin>
136
136
  <artifactId>maven-javadoc-plugin</artifactId>
137
- <version>3.1.1</version>
137
+ <version>2.10.4</version>
138
138
  <configuration>
139
139
  <detectOfflineLinks>false</detectOfflineLinks>
140
140
  <links>
@@ -145,7 +145,7 @@ DO NOT MODIFIY - GENERATED CODE
145
145
  </plugin>
146
146
  <plugin>
147
147
  <artifactId>maven-jar-plugin</artifactId>
148
- <version>3.1.2</version>
148
+ <version>3.2.0</version>
149
149
  <configuration>
150
150
  <archive>
151
151
  <manifestEntries>
@@ -154,6 +154,18 @@ DO NOT MODIFIY - GENERATED CODE
154
154
  </archive>
155
155
  </configuration>
156
156
  </plugin>
157
+ <plugin>
158
+ <artifactId>maven-jdeps-plugin</artifactId>
159
+ <version>3.1.2</version>
160
+ <executions>
161
+ <execution>
162
+ <goals>
163
+ <goal>jdkinternals</goal>
164
+ <goal>test-jdkinternals</goal>
165
+ </goals>
166
+ </execution>
167
+ </executions>
168
+ </plugin>
157
169
  </plugins>
158
170
  </pluginManagement>
159
171
  </build>
@@ -3,7 +3,7 @@
3
3
  * in their sketches. Includes a method to efficiently convert an cols of web
4
4
  * strings to an cols of color int, and another to convert an cols of p5 color
5
5
  * (int) to a string that can be used in ruby code (to generate web color cols).
6
- * Copyright (c) 2015-18 Martin Prout.
6
+ * Copyright (c) 2015-20 Martin Prout.
7
7
  * This utility is free software; you can redistribute it and/or modify
8
8
  * it under the terms of the GNU Lesser General Public License as published by
9
9
  * the Free Software Foundation; either version 2.1 of the License, or (at
@@ -2,7 +2,7 @@
2
2
  * The purpose of this tool is to allow JRubyArt users to use an alternative
3
3
  * to processing.org map, lerp and norm methods in their sketches and to implement
4
4
  * JRubyArt convenenience method grid(width, height, stepW, stepH) { |x, y| do stuff }
5
- * Copyright (c) 2015-19 Martin Prout. This tool is free software; you can
5
+ * Copyright (c) 2015-20 Martin Prout. This tool is free software; you can
6
6
  * redistribute it and/or modify it under the terms of the GNU Lesser General
7
7
  * Public License as published by the Free Software Foundation; either version
8
8
  * 2.1 of the License, or (at your option) any later version.
@@ -1,10 +1,10 @@
1
1
  /**
2
- * The purpose of this class is to load the MathTool into PiCrate runtime
3
- * Copyright (C) 18 Martin Prout. This code is free software; you can
2
+ * The purpose of this class is to load the MathTool into PiCrate runtime
3
+ * Copyright (C) 2018-20 Martin Prout. This code is free software; you can
4
4
  * redistribute it and/or modify it under the terms of the GNU Lesser General
5
- * Public License as published by the Free Software Foundation; either version
5
+ * Public License as published by the Free Software Foundation; either version
6
6
  * 2.1 of the License, or (at your option) any later version.
7
- *
7
+ *
8
8
  * Obtain a copy of the license at http://www.gnu.org/licenses/gpl-3.0-standalone.html
9
9
  */
10
10
 
@@ -23,7 +23,7 @@ import org.jruby.runtime.load.Library;
23
23
  * @author Martin Prout
24
24
  */
25
25
  public class PicrateLibrary implements Library{
26
-
26
+
27
27
  /**
28
28
  *
29
29
  * @param runtime
@@ -33,8 +33,8 @@ public class PicrateLibrary implements Library{
33
33
  Deglut.createDeglut(runtime);
34
34
  Vec2.createVec2(runtime);
35
35
  Vec3.createVec3(runtime);
36
- }
37
-
36
+ }
37
+
38
38
  /**
39
39
  *
40
40
  * @param runtime
@@ -44,5 +44,5 @@ public class PicrateLibrary implements Library{
44
44
  @Override
45
45
  public void load(final Ruby runtime, boolean wrap) throws IOException {
46
46
  load(runtime);
47
- }
47
+ }
48
48
  }
@@ -1,18 +1,18 @@
1
- /*
2
- * Copyright (c) 2018-19 Martin Prout
3
- *
1
+ /*
2
+ * Copyright (c) 2018-20 Martin Prout
3
+ *
4
4
  * This library is free software; you can redistribute it and/or
5
5
  * modify it under the terms of the GNU General Public
6
6
  * License as published by the Free Software Foundation; either
7
7
  * version 3.0 of the License, or (at your option) any later version.
8
- *
8
+ *
9
9
  * http://creativecommons.org/licenses/LGPL/2.1/
10
- *
10
+ *
11
11
  * This library is distributed in the hope that it will be useful,
12
12
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
13
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
14
  * Lesser General Public License for more details.
15
- *
15
+ *
16
16
  * You should have received a copy of the GNU General Public
17
17
  * License along with this library; if not, write to the Free Software
18
18
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
@@ -35,7 +35,7 @@ import org.jruby.runtime.builtin.IRubyObject;
35
35
  */
36
36
  @JRubyModule(name = "DegLut")
37
37
  public class Deglut {
38
-
38
+
39
39
  /**
40
40
  * Lookup table for degree cosine/sine, has a fixed precision 1.0
41
41
  * degrees Quite accurate but imprecise
@@ -49,11 +49,11 @@ public class Deglut {
49
49
  *
50
50
  */
51
51
  private static boolean initialized = false;
52
-
52
+
53
53
  private final static int NINETY = 90;
54
54
  private final static int FULL = 360;
55
55
  private static final long serialVersionUID = -1466528933765940101L;
56
-
56
+
57
57
  /**
58
58
  * Initialize sin table with values (first quadrant only)
59
59
  */
@@ -65,19 +65,19 @@ public class Deglut {
65
65
  initialized = true;
66
66
  }
67
67
  }
68
-
68
+
69
69
  /**
70
70
  *
71
71
  * @param runtime Ruby
72
72
  */
73
-
73
+
74
74
  public static void createDeglut(final Ruby runtime){
75
75
  RubyModule deglutModule = runtime.defineModule("DegLut");
76
76
  deglutModule.defineAnnotatedMethods(Deglut.class);
77
77
  Deglut.initTable();
78
78
  }
79
-
80
-
79
+
80
+
81
81
  /**
82
82
  *
83
83
  * @param context ThreadContext
@@ -86,7 +86,7 @@ public class Deglut {
86
86
  * @return sin IRubyObject
87
87
  */
88
88
  @JRubyMethod(name = "sin", module = true)
89
-
89
+
90
90
  public static IRubyObject sin(ThreadContext context, IRubyObject recv, IRubyObject other) {
91
91
  int thet = (int) ((RubyInteger)other).getLongValue();
92
92
  while (thet < 0) {
@@ -99,7 +99,7 @@ public class Deglut {
99
99
  ? -SIN_DEG_LUT[y] : -SIN_DEG_LUT[NINETY - y];
100
100
  return context.runtime.newFloat(result);
101
101
  }
102
-
102
+
103
103
  /**
104
104
  *
105
105
  * @param context ThreadContext
@@ -119,5 +119,5 @@ public class Deglut {
119
119
  ? -SIN_DEG_LUT[y] : (theta < 270)
120
120
  ? -SIN_DEG_LUT[NINETY - y] : SIN_DEG_LUT[y];
121
121
  return context.runtime.newFloat(result);
122
- }
122
+ }
123
123
  }