picrate 0.4.0-java → 0.4.1-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/Rakefile +2 -1
- data/docs/_posts/2018-05-06-getting_started.md +1 -1
- data/lib/picrate/version.rb +1 -1
- data/library/boids/boids.rb +1 -1
- data/picrate.gemspec +2 -2
- data/pom.rb +3 -3
- data/pom.xml +3 -3
- data/src/main/java/monkstone/vecmath/vec2/Vec2.java +61 -16
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25ae4432e0880eeea609a15cbd902db4141cc7ac295eb19e0683bcdd63455979
|
4
|
+
data.tar.gz: 69a516953444d646916d662469b66b4741b64ade197380889b29a0e0edabab95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7c0f1e869a86480fd6fdbea6b344a39b8e0a9e2ace90ed86e7443078377a4eff7746a80123a994be71b0ebaa497225fce76adb44b8e2718c4c366624a4d8297
|
7
|
+
data.tar.gz: 1a0a367a70d033c4d0b5f79fb55d6c3a646fe804cb27ac6acf63fb513ac50986291b5d727d02fd4afc7495976b669b2d9abcccecc0b3c74d3ad7647e265712a8
|
data/Rakefile
CHANGED
@@ -18,6 +18,7 @@ desc 'Create Manifest and Copy Jars'
|
|
18
18
|
task :init do
|
19
19
|
create_manifest
|
20
20
|
processing_root = File.dirname(`readlink -f $(which processing)`)
|
21
|
+
# processing_root = '/home/tux/processing-3.4'
|
21
22
|
jar_dir = File.join(processing_root, 'core', 'library')
|
22
23
|
opengl = Dir.entries(jar_dir).grep(/amd64|armv6hf/).select { |jar| jar =~ /linux/ }
|
23
24
|
opengl.concat %w[jogl-all.jar gluegen-rt.jar]
|
@@ -28,7 +29,7 @@ end
|
|
28
29
|
|
29
30
|
desc 'Install'
|
30
31
|
task :install do
|
31
|
-
sh 'mv target/picrate-0.4.
|
32
|
+
sh 'mv target/picrate-0.4.1.jar lib'
|
32
33
|
end
|
33
34
|
|
34
35
|
desc 'Gem'
|
data/lib/picrate/version.rb
CHANGED
data/library/boids/boids.rb
CHANGED
data/picrate.gemspec
CHANGED
@@ -12,10 +12,10 @@ Gem::Specification.new do |gem|
|
|
12
12
|
gem.description = <<-EOS
|
13
13
|
A batteries included version of processing in ruby, for raspberrypi and linux.
|
14
14
|
EOS
|
15
|
-
gem.summary = %q{ruby wrapper for processing-3.
|
15
|
+
gem.summary = %q{ruby wrapper for processing-3.4 on raspberrypi and linux64}
|
16
16
|
gem.homepage = 'https://ruby-processing.github.io/PiCrate/'
|
17
17
|
gem.files = `git ls-files`.split($/)
|
18
|
-
gem.files << 'lib/picrate-0.4.
|
18
|
+
gem.files << 'lib/picrate-0.4.1.jar'
|
19
19
|
gem.files << 'lib/gluegen-rt.jar'
|
20
20
|
gem.files << 'lib/jogl-all.jar'
|
21
21
|
gem.files << 'lib/gluegen-rt-natives-linux-amd64.jar'
|
data/pom.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
project 'picrate', 'http://maven.apache.org' do
|
2
2
|
|
3
3
|
model_version '4.0.0'
|
4
|
-
id 'ruby-processing:picrate:0.4.
|
4
|
+
id 'ruby-processing:picrate:0.4.1'
|
5
5
|
packaging 'jar'
|
6
6
|
|
7
7
|
description 'An integrated processing-core (somewhat hacked), with additional java code for a jruby version of processing.'
|
@@ -31,8 +31,8 @@ project 'picrate', 'http://maven.apache.org' do
|
|
31
31
|
'project.build.sourceEncoding' => 'utf-8',
|
32
32
|
'polyglot.dump.pom' => 'pom.xml',
|
33
33
|
'maven.compiler.source' => '1.8' )
|
34
|
-
pom 'org.jruby:jruby:9.
|
35
|
-
jar 'org.processing:video:3.
|
34
|
+
pom 'org.jruby:jruby:9.2.0.0'
|
35
|
+
jar 'org.processing:video:3.2.3'
|
36
36
|
jar 'org.jogamp.jogl:jogl-all:${jogl.version}'
|
37
37
|
jar 'org.jogamp.gluegen:gluegen-rt-main:${jogl.version}'
|
38
38
|
end
|
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>0.4.
|
14
|
+
<version>0.4.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>
|
@@ -78,13 +78,13 @@ DO NOT MODIFIY - GENERATED CODE
|
|
78
78
|
<dependency>
|
79
79
|
<groupId>org.jruby</groupId>
|
80
80
|
<artifactId>jruby</artifactId>
|
81
|
-
<version>9.
|
81
|
+
<version>9.2.0.0</version>
|
82
82
|
<type>pom</type>
|
83
83
|
</dependency>
|
84
84
|
<dependency>
|
85
85
|
<groupId>org.processing</groupId>
|
86
86
|
<artifactId>video</artifactId>
|
87
|
-
<version>3.
|
87
|
+
<version>3.2.3</version>
|
88
88
|
</dependency>
|
89
89
|
<dependency>
|
90
90
|
<groupId>org.jogamp.jogl</groupId>
|
@@ -1,12 +1,12 @@
|
|
1
1
|
package monkstone.vecmath.vec2;
|
2
2
|
|
3
3
|
/*
|
4
|
-
* Copyright (c)
|
4
|
+
* Copyright (c) 2015-18 Martin Prout
|
5
5
|
*
|
6
6
|
* This library is free software; you can redistribute it and/or
|
7
|
-
* modify it under the terms of the GNU General Public
|
7
|
+
* modify it under the terms of the GNU Lesser General Public
|
8
8
|
* License as published by the Free Software Foundation; either
|
9
|
-
* version
|
9
|
+
* version 2.1 of the License, or (at your option) any later version.
|
10
10
|
*
|
11
11
|
* http://creativecommons.org/licenses/LGPL/2.1/
|
12
12
|
*
|
@@ -15,10 +15,12 @@ package monkstone.vecmath.vec2;
|
|
15
15
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
16
16
|
* Lesser General Public License for more details.
|
17
17
|
*
|
18
|
-
* You should have received a copy of the GNU General Public
|
18
|
+
* You should have received a copy of the GNU Lesser General Public
|
19
19
|
* License along with this library; if not, write to the Free Software
|
20
20
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
-
|
21
|
+
*
|
22
|
+
* fastAtan2 algorithm from https://github.com/libgdx/libgdx (Apache 2.0 license)
|
23
|
+
*/
|
22
24
|
import org.jruby.Ruby;
|
23
25
|
import org.jruby.RubyArray;
|
24
26
|
import org.jruby.RubyClass;
|
@@ -35,7 +37,7 @@ import monkstone.vecmath.JRender;
|
|
35
37
|
|
36
38
|
/**
|
37
39
|
*
|
38
|
-
*
|
40
|
+
* @author Martin Prout
|
39
41
|
*/
|
40
42
|
@JRubyClass(name = "Vec2D")
|
41
43
|
public class Vec2 extends RubyObject {
|
@@ -55,18 +57,10 @@ public class Vec2 extends RubyObject {
|
|
55
57
|
vec2Cls.defineAnnotatedMethods(Vec2.class);
|
56
58
|
}
|
57
59
|
|
58
|
-
/**
|
59
|
-
*
|
60
|
-
* @return
|
61
|
-
*/
|
62
60
|
public double javax() {
|
63
61
|
return jx;
|
64
62
|
}
|
65
63
|
|
66
|
-
/**
|
67
|
-
*
|
68
|
-
* @return
|
69
|
-
*/
|
70
64
|
public double javay() {
|
71
65
|
return jy;
|
72
66
|
}
|
@@ -361,6 +355,16 @@ public class Vec2 extends RubyObject {
|
|
361
355
|
return context.runtime.newFloat(Math.atan2(jy, jx));
|
362
356
|
}
|
363
357
|
|
358
|
+
/**
|
359
|
+
*
|
360
|
+
* @param context ThreadContext
|
361
|
+
* @return heading IRubyObject radians
|
362
|
+
*/
|
363
|
+
@JRubyMethod(name = "fast_heading")
|
364
|
+
public IRubyObject fastHeading(ThreadContext context) {
|
365
|
+
return context.runtime.newFloat(fastAtan2(jy, jx));
|
366
|
+
}
|
367
|
+
|
364
368
|
/**
|
365
369
|
*
|
366
370
|
* @param context ThreadContext
|
@@ -448,7 +452,7 @@ public class Vec2 extends RubyObject {
|
|
448
452
|
/**
|
449
453
|
*
|
450
454
|
* @param context ThreadContext
|
451
|
-
* @return new normalized
|
455
|
+
* @return new normalized Vec2D object (ruby)
|
452
456
|
*/
|
453
457
|
@JRubyMethod(name = "normalize")
|
454
458
|
|
@@ -589,7 +593,7 @@ public class Vec2 extends RubyObject {
|
|
589
593
|
/**
|
590
594
|
*
|
591
595
|
* @param context ThreadContext
|
592
|
-
* @param other IRubyObject another
|
596
|
+
* @param other IRubyObject another Vec2D
|
593
597
|
* @return angle IRubyObject in radians
|
594
598
|
*/
|
595
599
|
@JRubyMethod(name = "angle_between")
|
@@ -605,6 +609,25 @@ public class Vec2 extends RubyObject {
|
|
605
609
|
return runtime.newFloat(Math.atan2(jx - vec.jx, jy - vec.jy));
|
606
610
|
}
|
607
611
|
|
612
|
+
/**
|
613
|
+
*
|
614
|
+
* @param context ThreadContext
|
615
|
+
* @param other IRubyObject another Vec2D
|
616
|
+
* @return angle IRubyObject in radians
|
617
|
+
*/
|
618
|
+
@JRubyMethod(name = "fast_angle_between")
|
619
|
+
|
620
|
+
public IRubyObject fastAngleBetween(ThreadContext context, IRubyObject other) {
|
621
|
+
Vec2 vec = null;
|
622
|
+
Ruby runtime = context.runtime;
|
623
|
+
if (other instanceof Vec2) {
|
624
|
+
vec = (Vec2) other.toJava(Vec2.class);
|
625
|
+
} else {
|
626
|
+
throw runtime.newTypeError("argument should be Vec2D");
|
627
|
+
}
|
628
|
+
return runtime.newFloat(fastAtan2(jx - vec.jx, jy - vec.jy));
|
629
|
+
}
|
630
|
+
|
608
631
|
/**
|
609
632
|
*
|
610
633
|
* @param context ThreadContext
|
@@ -673,6 +696,28 @@ public class Vec2 extends RubyObject {
|
|
673
696
|
return context.runtime.newString(String.format("Vec2D(x = %4.4f, y = %4.4f)", jx, jy));
|
674
697
|
}
|
675
698
|
|
699
|
+
private double fastAtan2(double y, double x) {
|
700
|
+
if (x == 0) {
|
701
|
+
if (y > 0) {
|
702
|
+
return Math.PI / 2;
|
703
|
+
}
|
704
|
+
if (y == 0) {
|
705
|
+
return 0;
|
706
|
+
}
|
707
|
+
return -Math.PI / 2;
|
708
|
+
}
|
709
|
+
final double atan, z = y / x;
|
710
|
+
if (Math.abs(z) < 1) {
|
711
|
+
atan = z / (1 + 0.28 * z * z);
|
712
|
+
if (x < 0) {
|
713
|
+
return atan + (y < 0 ? -Math.PI : Math.PI);
|
714
|
+
}
|
715
|
+
return atan;
|
716
|
+
}
|
717
|
+
atan = Math.PI / 2 - z / (z * z + 0.28);
|
718
|
+
return y < 0 ? atan - Math.PI : atan;
|
719
|
+
}
|
720
|
+
|
676
721
|
/**
|
677
722
|
*
|
678
723
|
* @return hash int
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: picrate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- monkstone
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -168,7 +168,7 @@ files:
|
|
168
168
|
- lib/jogl-all-natives-linux-amd64.jar
|
169
169
|
- lib/jogl-all-natives-linux-armv6hf.jar
|
170
170
|
- lib/jogl-all.jar
|
171
|
-
- lib/picrate-0.4.
|
171
|
+
- lib/picrate-0.4.1.jar
|
172
172
|
- lib/picrate.rb
|
173
173
|
- lib/picrate/app.rb
|
174
174
|
- lib/picrate/creators/sketch_class.rb
|
@@ -343,7 +343,7 @@ rubyforge_project:
|
|
343
343
|
rubygems_version: 2.7.7
|
344
344
|
signing_key:
|
345
345
|
specification_version: 4
|
346
|
-
summary: ruby wrapper for processing-3.
|
346
|
+
summary: ruby wrapper for processing-3.4 on raspberrypi and linux64
|
347
347
|
test_files:
|
348
348
|
- test/color_group_test.rb
|
349
349
|
- test/create_test.rb
|