jruby_art 1.2.4 → 1.2.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 +4 -4
- data/lib/jruby_art/version.rb +1 -1
- data/lib/rpextras.jar +0 -0
- data/library/boids/boids.rb +15 -7
- data/library/library_proxy/library_proxy.rb +5 -3
- data/vendors/Rakefile +1 -1
- metadata +7 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1b91cea8de9bdd46bff4b9d7f87eb566d37db6a
|
4
|
+
data.tar.gz: 5acbc932e3a7b9ba2fc4dbbe11a83145eec1aa18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2dee4798bfb73b5c99c2884747bb855fc38cbd22a67b5fe9200d695229e85509841b2d6f06c276e434c9e1ed50d2171711a42c5a04258c674e396afd8df65ae6
|
7
|
+
data.tar.gz: 60ca9549ffa124cdf2d695f7539e7aaf2709986f715f303c2ddae395fc5a45b4728af4e3c10c5f49f891058d77c6aee56f20f1a05108fec0c0e44e8dd1db5c5a
|
data/lib/jruby_art/version.rb
CHANGED
data/lib/rpextras.jar
CHANGED
Binary file
|
data/library/boids/boids.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# Boids -- after Tom de Smedt.
|
2
3
|
# See his Python version: http://nodebox.net/code/index.php/Boids
|
3
4
|
# This is an example of how a pure-Ruby library can work. Original for
|
4
5
|
# ruby-processing Jeremy Ashkenas. Reworked, re-factored for JRubyArt 0.9+
|
5
6
|
# by Martin Prout, features forwardable, keyword args, Vec3D and Vec2D.
|
6
7
|
class Boid
|
7
|
-
|
8
|
-
|
8
|
+
attr_reader :boids
|
9
|
+
attr_accessor :vel, :pos, :is_perching, :perch_time
|
9
10
|
def initialize(boids, pos)
|
10
11
|
@boids, @flock = boids, boids
|
11
12
|
@pos = pos
|
@@ -83,7 +84,7 @@ class Boids
|
|
83
84
|
|
84
85
|
def self.flock(n:, x:, y:, w:, h:)
|
85
86
|
flock = Boids.new.setup(n, x, y, w, h)
|
86
|
-
flock.
|
87
|
+
flock.reset_goal(Vec3D.new(w / 2, h / 2, 0))
|
87
88
|
end
|
88
89
|
|
89
90
|
def setup(n, x, y, w, h)
|
@@ -125,7 +126,14 @@ class Boids
|
|
125
126
|
@perch = 0.0
|
126
127
|
end
|
127
128
|
|
128
|
-
def
|
129
|
+
def reset_goal(target)
|
130
|
+
@has_goal = true
|
131
|
+
@flee = false
|
132
|
+
@goal = target
|
133
|
+
self
|
134
|
+
end
|
135
|
+
|
136
|
+
def goal(target:, flee:)
|
129
137
|
@has_goal = true
|
130
138
|
@flee = flee
|
131
139
|
@goal = target
|
@@ -141,14 +149,14 @@ class Boids
|
|
141
149
|
dx, dy = @w * 0.1, @h * 0.1
|
142
150
|
each do |b|
|
143
151
|
b.vel.x += rand(dx) if b.pos.x < @x - dx
|
144
|
-
b.vel.
|
152
|
+
b.vel.y += rand(dy) if b.pos.y < @y - dy
|
145
153
|
b.vel.x -= rand(dx) if b.pos.x > @x + @w + dx
|
146
154
|
b.vel.y -= rand(dy) if b.pos.y > @y + @h + dy
|
147
155
|
b.vel.z += 10.0 if b.pos.z < 0.0
|
148
156
|
b.vel.z -= 10.0 if b.pos.z > 100.0
|
149
157
|
next unless b.pos.y > perch_y && rand < perch
|
150
158
|
b.pos.y = perch_y
|
151
|
-
b.vel.y =
|
159
|
+
b.vel.y = b.vel.y.abs * -0.2
|
152
160
|
b.is_perching = true
|
153
161
|
b.perch_time = perch_tm.respond_to?(:call) ? perch_tm.call : perch_tm
|
154
162
|
end
|
@@ -166,7 +174,7 @@ class Boids
|
|
166
174
|
m2 = 1.0 # separation
|
167
175
|
m3 = 1.0 # alignment
|
168
176
|
m4 = 1.0 # goal
|
169
|
-
@scattered = true if
|
177
|
+
@scattered = true if !@scattered && rand < @scatter
|
170
178
|
if @scattered
|
171
179
|
m1 = -m1
|
172
180
|
m3 *= 0.25
|
@@ -1,12 +1,14 @@
|
|
1
1
|
# require 'rpextras'
|
2
|
-
#@todo fix how we call
|
2
|
+
#@todo fix how we call Library Proxy
|
3
3
|
java_import Java::MonkstoneCore::LibraryProxy
|
4
4
|
|
5
5
|
|
6
6
|
# classes that inherit from Library are expected to implement
|
7
|
-
# the abstract methods of
|
7
|
+
# the abstract methods of monkstone.core.LibraryProxy
|
8
8
|
# def pre...
|
9
9
|
# def draw...
|
10
10
|
# def post...
|
11
|
+
# def keyPressed...
|
12
|
+
# def mousePressed...
|
11
13
|
# NOOP is fine...
|
12
|
-
# `app` can be called to get PApplet instance
|
14
|
+
# `app` can be called to get PApplet instance
|
data/vendors/Rakefile
CHANGED
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.2.
|
4
|
+
version: 1.2.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: 2016-
|
13
|
+
date: 2016-10-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake
|
@@ -40,12 +40,11 @@ dependencies:
|
|
40
40
|
- - "~>"
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: '5.8'
|
43
|
-
description:
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
instance\n variables and hundreds of worked examples to get you started...\n"
|
43
|
+
description: |2
|
44
|
+
JRubyArt is a ruby wrapper for the processing art framework.
|
45
|
+
Use both processing libraries and ruby gems in your sketches. Features
|
46
|
+
create/run/watch/live modes. The "--watch" mode, provides a nice REPL-ish
|
47
|
+
way to work on your processing sketches. NB: See homepage for documentation.
|
49
48
|
email: mamba2928@yahoo.co.uk
|
50
49
|
executables:
|
51
50
|
- k9
|