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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/Gemfile +3 -1
- data/README.md +11 -10
- data/Rakefile +10 -9
- data/bin/picrate +3 -1
- data/docs/_config.yml +1 -1
- data/docs/_editors/geany.md +1 -0
- data/docs/_gems/gems/gems.md +1 -1
- data/docs/_methods/alternative_methods.md +2 -1
- data/docs/_posts/2018-05-06-getting_started.md +4 -4
- data/docs/_posts/2018-05-06-install_jruby.md +5 -11
- data/docs/_posts/2018-05-11-arch-linux-arm.md +1 -11
- data/docs/_posts/2018-11-18-building-gem.md +2 -2
- data/docs/_posts/2018-11-27-getting_started_geany.md +1 -1
- data/docs/_posts/2019-11-11-getting_started_buster.md +4 -7
- data/docs/_posts/{2018-06-26-auto_install_picrate.md → 2020-03-09-auto_install_picrate.md} +9 -6
- data/docs/_posts/2020-05-11-getting_started_manjaro.md +94 -0
- data/docs/about.md +1 -1
- data/lib/picrate.rb +1 -1
- data/lib/picrate/app.rb +11 -3
- data/lib/picrate/creators/parameters.rb +8 -8
- data/lib/picrate/creators/sketch_factory.rb +5 -3
- data/lib/picrate/helper_methods.rb +21 -21
- data/lib/picrate/helpers/numeric.rb +2 -0
- data/lib/picrate/library.rb +5 -1
- data/lib/picrate/library_loader.rb +2 -0
- data/lib/picrate/native_folder.rb +2 -1
- data/lib/picrate/native_loader.rb +3 -0
- data/lib/picrate/runner.rb +1 -0
- data/lib/picrate/version.rb +1 -1
- data/library/boids/boids.rb +17 -8
- data/library/chooser/chooser.rb +10 -9
- data/library/color_group/color_group.rb +2 -0
- data/library/control_panel/control_panel.rb +7 -4
- data/library/dxf/dxf.rb +2 -0
- data/library/library_proxy/library_proxy.rb +2 -0
- data/library/net/net.rb +2 -0
- data/library/slider/slider.rb +24 -23
- data/library/vector_utils/vector_utils.rb +4 -0
- data/library/video_event/video_event.rb +2 -0
- data/picrate.gemspec +13 -14
- data/pom.rb +28 -26
- data/pom.xml +18 -6
- data/src/main/java/monkstone/ColorUtil.java +1 -1
- data/src/main/java/monkstone/MathToolModule.java +1 -1
- data/src/main/java/monkstone/PicrateLibrary.java +8 -8
- data/src/main/java/monkstone/fastmath/Deglut.java +16 -16
- data/src/main/java/monkstone/filechooser/Chooser.java +1 -1
- data/src/main/java/monkstone/noise/SimplexNoise.java +3 -3
- data/src/main/java/monkstone/slider/CustomHorizontalSlider.java +1 -1
- data/src/main/java/monkstone/slider/CustomVerticalSlider.java +1 -1
- data/src/main/java/monkstone/slider/SimpleHorizontalSlider.java +12 -12
- data/src/main/java/monkstone/slider/SimpleVerticalSlider.java +1 -1
- data/src/main/java/monkstone/slider/SliderBar.java +1 -1
- data/src/main/java/monkstone/slider/SliderGroup.java +1 -1
- data/src/main/java/monkstone/slider/WheelHandler.java +1 -1
- data/src/main/java/monkstone/vecmath/package-info.java +1 -1
- data/src/main/java/monkstone/vecmath/vec2/Vec2.java +1 -1
- data/src/main/java/monkstone/vecmath/vec3/Vec3.java +1 -1
- data/src/main/java/monkstone/videoevent/CaptureEvent.java +1 -1
- data/src/main/java/monkstone/videoevent/MovieEvent.java +1 -1
- data/src/main/java/monkstone/videoevent/package-info.java +1 -1
- data/src/main/java/processing/awt/PGraphicsJava2D.java +33 -36
- data/src/main/java/processing/awt/PImageAWT.java +377 -0
- data/src/main/java/processing/awt/PSurfaceAWT.java +0 -20
- data/src/main/java/processing/awt/ShimAWT.java +545 -0
- data/src/main/java/processing/core/PApplet.java +699 -1523
- data/src/main/java/processing/core/PConstants.java +180 -180
- data/src/main/java/processing/core/PFont.java +2 -2
- data/src/main/java/processing/core/PGraphics.java +190 -176
- data/src/main/java/processing/core/PImage.java +1536 -1721
- data/src/main/java/processing/core/PMatrix.java +39 -39
- data/src/main/java/processing/core/PSurface.java +69 -103
- data/src/main/java/processing/core/PSurfaceNone.java +29 -0
- data/src/main/java/processing/core/PVector.java +2 -2
- data/src/main/java/processing/data/FloatDict.java +251 -284
- data/src/main/java/processing/data/TableRow.java +32 -32
- data/src/main/java/processing/dxf/RawDXF.java +3 -3
- data/src/main/java/processing/net/Client.java +1 -1
- data/src/main/java/processing/opengl/PGL.java +1016 -4132
- data/src/main/java/processing/opengl/PGraphicsOpenGL.java +223 -184
- data/src/main/java/processing/opengl/PJOGL.java +374 -1526
- data/src/main/java/processing/opengl/PShapeOpenGL.java +5 -6
- data/src/main/java/processing/opengl/PSurfaceJOGL.java +262 -147
- data/test/color_group_test.rb +4 -4
- data/test/deglut_spec_test.rb +2 -0
- data/test/helper_methods_test.rb +41 -13
- data/test/math_tool_test.rb +46 -37
- data/test/respond_to_test.rb +5 -3
- data/test/sketches/key_event.rb +2 -2
- data/test/sketches/library/my_library/my_library.rb +3 -0
- data/test/test_helper.rb +2 -0
- data/test/vecmath_spec_test.rb +30 -19
- data/vendors/Rakefile +8 -5
- data/vendors/{picrate_sketches.geany → geany.rb} +32 -7
- metadata +25 -46
- data/src/main/java/processing/opengl/shaders/LightVert-brcm.glsl +0 -154
- data/src/main/java/processing/opengl/shaders/LightVert-vc4.glsl +0 -154
- data/src/main/java/processing/opengl/shaders/TexLightVert-brcm.glsl +0 -160
- data/src/main/java/processing/opengl/shaders/TexLightVert-vc4.glsl +0 -160
data/library/dxf/dxf.rb
CHANGED
data/library/net/net.rb
CHANGED
data/library/slider/slider.rb
CHANGED
@@ -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-
|
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
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
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
|
data/picrate.gemspec
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
#
|
2
|
-
|
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
|
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 =
|
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 =
|
19
|
-
gem.files
|
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
|
-
|
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
|
-
|
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.
|
34
|
-
gem.add_runtime_dependency '
|
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 ==
|
37
|
+
gem.requirements << 'java runtime == 11'
|
39
38
|
end
|
data/pom.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
-
|
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.
|
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
|
-
|
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.
|
43
|
-
plugin(
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
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.
|
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.
|
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.
|
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>
|
132
|
+
<release>11</release>
|
133
133
|
</configuration>
|
134
134
|
</plugin>
|
135
135
|
<plugin>
|
136
136
|
<artifactId>maven-javadoc-plugin</artifactId>
|
137
|
-
<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.
|
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-
|
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-
|
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)
|
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-
|
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
|
}
|