picrate 2.4.2-java → 2.5.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -1
  3. data/Gemfile +1 -1
  4. data/README.md +2 -2
  5. data/Rakefile +1 -1
  6. data/docs/.gitignore +1 -0
  7. data/docs/_classes/{app_render → gfx_render}/app_render.md +5 -5
  8. data/docs/_methods/{noise_mode.md → noise_modes.md} +9 -21
  9. data/docs/_posts/2018-05-06-install_jruby.md +5 -5
  10. data/docs/_posts/2019-11-11-getting_started_buster.md +1 -1
  11. data/lib/picrate/app.rb +4 -4
  12. data/lib/picrate/version.rb +1 -1
  13. data/lib/{picrate-2.4.2.jar → picrate-2.5.0.jar} +0 -0
  14. data/picrate.gemspec +1 -1
  15. data/pom.rb +3 -2
  16. data/pom.xml +4 -4
  17. data/src/main/java/monkstone/vecmath/GfxRender.java +10 -11
  18. data/src/main/java/monkstone/vecmath/JRender.java +7 -7
  19. data/src/main/java/monkstone/vecmath/ShapeRender.java +3 -4
  20. data/src/main/java/monkstone/vecmath/vec2/Vec2.java +28 -40
  21. data/src/main/java/monkstone/vecmath/vec3/Vec3.java +30 -45
  22. data/src/main/java/processing/awt/PImageAWT.java +1 -1
  23. data/src/main/java/processing/awt/ShimAWT.java +1 -1
  24. data/src/main/java/processing/core/PImage.java +14 -14
  25. data/src/main/java/processing/opengl/PShader.java +0 -6
  26. data/test/noise_test.rb +17 -0
  27. metadata +10 -21
  28. data/src/main/java/japplemenubar/JAppleMenuBar.java +0 -96
  29. data/src/main/java/japplemenubar/libjAppleMenuBar.jnilib +0 -0
  30. data/src/main/java/monkstone/complex/JComplex.java +0 -252
  31. data/src/main/java/monkstone/vecmath/AppRender.java +0 -88
  32. data/src/main/java/monkstone/vecmath/package-info.java +0 -20
  33. data/src/main/java/monkstone/vecmath/vec2/package-info.java +0 -6
  34. data/src/main/java/monkstone/vecmath/vec3/package-info.java +0 -6
@@ -20,7 +20,7 @@ package monkstone.vecmath.vec2;
20
20
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
21
  *
22
22
  * fastAtan2 algorithm from https://github.com/libgdx/libgdx (Apache 2.0 license)
23
- */
23
+ */
24
24
  import org.jruby.Ruby;
25
25
  import org.jruby.RubyArray;
26
26
  import org.jruby.RubyClass;
@@ -40,7 +40,7 @@ import monkstone.vecmath.JRender;
40
40
  * @author Martin Prout
41
41
  */
42
42
  @JRubyClass(name = "Vec2D")
43
- public class Vec2 extends RubyObject {
43
+ public final class Vec2 extends RubyObject {
44
44
 
45
45
  static final double EPSILON = 9.999999747378752e-05; // matches processing.org EPSILON
46
46
  private static final long serialVersionUID = -2950154560223211646L;
@@ -57,18 +57,10 @@ public class Vec2 extends RubyObject {
57
57
  vec2Cls.defineAnnotatedMethods(Vec2.class);
58
58
  }
59
59
 
60
- /**
61
- *
62
- * @return x value :double
63
- */
64
60
  public double javax() {
65
61
  return jx;
66
62
  }
67
63
 
68
- /**
69
- *
70
- * @return y value :double
71
- */
72
64
  public double javay() {
73
65
  return jy;
74
66
  }
@@ -81,7 +73,7 @@ public class Vec2 extends RubyObject {
81
73
  * @return new Vec2 object (ruby)
82
74
  */
83
75
  @JRubyMethod(name = "new", meta = true, rest = true)
84
- public static final IRubyObject rbNew(ThreadContext context, IRubyObject klazz, IRubyObject... args) {
76
+ public static IRubyObject rbNew(ThreadContext context, IRubyObject klazz, IRubyObject... args) {
85
77
  Vec2 vec2 = (Vec2) ((RubyClass) klazz).allocate();
86
78
  vec2.init(context, args);
87
79
  return vec2;
@@ -99,16 +91,16 @@ public class Vec2 extends RubyObject {
99
91
  void init(ThreadContext context, IRubyObject... args) {
100
92
  int count = args.length;
101
93
  if (count == 2) {
102
- jx = (args[0] instanceof RubyFloat) ? ((RubyFloat) args[0]).getValue() : ((RubyFixnum) args[0]).getDoubleValue();
103
- jy = (args[1] instanceof RubyFloat) ? ((RubyFloat) args[1]).getValue() : ((RubyFixnum) args[1]).getDoubleValue();
94
+ jx = args[0] instanceof RubyFloat ? ((RubyFloat) args[0]).getValue() : ((RubyFixnum) args[0]).getDoubleValue();
95
+ jy = args[1] instanceof RubyFloat ? ((RubyFloat) args[1]).getValue() : ((RubyFixnum) args[1]).getDoubleValue();
104
96
  } // allow ruby ducktyping in constructor
105
97
  if (count == 1) {
106
98
  if (!(args[0].respondsTo("x"))) {
107
99
  throw context.runtime.newTypeError(args[0].getType() + " doesn't respond_to :x & :y");
108
100
  }
109
- jx = ((args[0].callMethod(context, "x")) instanceof RubyFloat)
101
+ jx = args[0].callMethod(context, "x") instanceof RubyFloat
110
102
  ? ((RubyFloat) args[0].callMethod(context, "x")).getValue() : ((RubyFixnum) args[0].callMethod(context, "x")).getDoubleValue();
111
- jy = ((args[0].callMethod(context, "y")) instanceof RubyFloat)
103
+ jy = args[0].callMethod(context, "y") instanceof RubyFloat
112
104
  ? ((RubyFloat) args[0].callMethod(context, "y")).getValue() : ((RubyFixnum) args[0].callMethod(context, "y")).getDoubleValue();
113
105
  }
114
106
  }
@@ -170,10 +162,10 @@ public class Vec2 extends RubyObject {
170
162
  Ruby runtime = context.runtime;
171
163
  if (key instanceof RubySymbol) {
172
164
  if (key == RubySymbol.newSymbol(runtime, "x")) {
173
- jx = (value instanceof RubyFloat)
165
+ jx = value instanceof RubyFloat
174
166
  ? ((RubyFloat) value).getValue() : ((RubyFixnum) value).getDoubleValue();
175
167
  } else if (key == RubySymbol.newSymbol(runtime, "y")) {
176
- jy = (value instanceof RubyFloat)
168
+ jy = value instanceof RubyFloat
177
169
  ? ((RubyFloat) value).getValue() : ((RubyFixnum) value).getDoubleValue();
178
170
  }
179
171
  } else {
@@ -232,7 +224,7 @@ public class Vec2 extends RubyObject {
232
224
  } else {
233
225
  throw runtime.newTypeError("argument should be Vec2D");
234
226
  }
235
- double result = Math.hypot((jx - b.jx), (jy - b.jy));
227
+ double result = Math.hypot(jx - b.jx, jy - b.jy);
236
228
  return runtime.newFloat(result);
237
229
  }
238
230
 
@@ -326,7 +318,7 @@ public class Vec2 extends RubyObject {
326
318
 
327
319
  public IRubyObject op_mul(ThreadContext context, IRubyObject other) {
328
320
  Ruby runtime = context.runtime;
329
- double scalar = (other instanceof RubyFloat)
321
+ double scalar = other instanceof RubyFloat
330
322
  ? ((RubyFloat) other).getValue() : ((RubyFixnum) other).getDoubleValue();
331
323
  return Vec2.rbNew(context, this.getMetaClass(),
332
324
  new IRubyObject[]{runtime.newFloat(jx * scalar),
@@ -343,7 +335,7 @@ public class Vec2 extends RubyObject {
343
335
 
344
336
  public IRubyObject op_div(ThreadContext context, IRubyObject other) {
345
337
  Ruby runtime = context.runtime;
346
- double scalar = (other instanceof RubyFloat)
338
+ double scalar = other instanceof RubyFloat
347
339
  ? ((RubyFloat) other).getValue() : ((RubyFixnum) other).getDoubleValue();
348
340
  if (Math.abs(scalar) < Vec2.EPSILON) {
349
341
  return this;
@@ -408,10 +400,8 @@ public class Vec2 extends RubyObject {
408
400
 
409
401
  public IRubyObject set_mag(ThreadContext context, IRubyObject scalar, Block block) {
410
402
  double new_mag = scalar.toJava(Double.class);
411
- if (block.isGiven()) {
412
- if (!(boolean) block.yield(context, scalar).toJava(Boolean.class)) {
413
- return this;
414
- }
403
+ if (block.isGiven() && !block.yield(context, scalar).toJava(Boolean.class)) {
404
+ return this;
415
405
  }
416
406
  double current = 0;
417
407
  if (Math.abs(jx) > EPSILON && Math.abs(jy) > EPSILON) {
@@ -497,7 +487,7 @@ public class Vec2 extends RubyObject {
497
487
  @JRubyMethod(name = "from_angle", meta = true)
498
488
  public static IRubyObject from_angle(ThreadContext context, IRubyObject klazz, IRubyObject scalar) {
499
489
  Ruby runtime = context.runtime;
500
- double angle = (scalar instanceof RubyFloat)
490
+ double angle = scalar instanceof RubyFloat
501
491
  ? ((RubyFloat) scalar).getValue() : ((RubyFixnum) scalar).getDoubleValue();
502
492
  return Vec2.rbNew(context, klazz, new IRubyObject[]{
503
493
  runtime.newFloat(Math.cos(angle)),
@@ -528,10 +518,10 @@ public class Vec2 extends RubyObject {
528
518
  */
529
519
  @JRubyMethod(name = "rotate!")
530
520
  public IRubyObject rotate_bang(ThreadContext context, IRubyObject scalar) {
531
- double theta = (scalar instanceof RubyFloat)
521
+ double theta = scalar instanceof RubyFloat
532
522
  ? ((RubyFloat) scalar).getValue() : ((RubyFixnum) scalar).getDoubleValue();
533
- double x = (jx * Math.cos(theta) - jy * Math.sin(theta));
534
- double y = (jx * Math.sin(theta) + jy * Math.cos(theta));
523
+ double x = jx * Math.cos(theta) - jy * Math.sin(theta);
524
+ double y = jx * Math.sin(theta) + jy * Math.cos(theta);
535
525
  jx = x;
536
526
  jy = y;
537
527
  return this;
@@ -546,7 +536,7 @@ public class Vec2 extends RubyObject {
546
536
  @JRubyMethod(name = "rotate")
547
537
  public IRubyObject rotate(ThreadContext context, IRubyObject scalar) {
548
538
  Ruby runtime = context.runtime;
549
- double theta = (scalar instanceof RubyFloat)
539
+ double theta = scalar instanceof RubyFloat
550
540
  ? ((RubyFloat) scalar).getValue() : ((RubyFixnum) scalar).getDoubleValue();
551
541
  IRubyObject[] ary = new IRubyObject[]{
552
542
  runtime.newFloat(jx * Math.cos(theta) - jy * Math.sin(theta)),
@@ -567,9 +557,9 @@ public class Vec2 extends RubyObject {
567
557
  throw runtime.newSyntaxError("Check syntax");
568
558
  }
569
559
  Vec2 vec = (Vec2) args[0].toJava(Vec2.class);
570
- double scalar = (args[1] instanceof RubyFloat)
560
+ double scalar = args[1] instanceof RubyFloat
571
561
  ? ((RubyFloat) args[1]).getValue() : ((RubyFixnum) args[1]).getDoubleValue();
572
- assert (scalar >= 0 && scalar < 1.0) :
562
+ assert scalar >= 0 && scalar < 1.0 :
573
563
  "Lerp value " + scalar + " out of range 0..1.0";
574
564
  return Vec2.rbNew(context, this.getMetaClass(), new IRubyObject[]{
575
565
  runtime.newFloat(jx + (vec.jx - jx) * scalar),
@@ -589,9 +579,9 @@ public class Vec2 extends RubyObject {
589
579
  throw runtime.newSyntaxError("Check syntax");
590
580
  }
591
581
  Vec2 vec = (Vec2) args[0].toJava(Vec2.class);
592
- double scalar = (args[1] instanceof RubyFloat)
582
+ double scalar = args[1] instanceof RubyFloat
593
583
  ? ((RubyFloat) args[1]).getValue() : ((RubyFixnum) args[1]).getDoubleValue();
594
- assert (scalar >= 0 && scalar < 1.0) :
584
+ assert scalar >= 0 && scalar < 1.0 :
595
585
  "Lerp value " + scalar + " out of range 0..1.0";
596
586
  jx += (vec.jx - jx) * scalar;
597
587
  jy += (vec.jy - jy) * scalar;
@@ -752,10 +742,8 @@ public class Vec2 extends RubyObject {
752
742
  }
753
743
  if (obj instanceof Vec2) {
754
744
  final Vec2 other = (Vec2) obj;
755
- if ((Double.compare(jx, (Double) other.jx) == 0)
756
- && (Double.compare(jy, (Double) other.jy) == 0)) {
757
- return true;
758
- }
745
+ return Double.compare(jx, (Double) other.jx) == 0
746
+ && Double.compare(jy, (Double) other.jy) == 0;
759
747
  }
760
748
  return false;
761
749
  }
@@ -774,8 +762,8 @@ public class Vec2 extends RubyObject {
774
762
  }
775
763
  if (other instanceof Vec2) {
776
764
  Vec2 v = (Vec2) other.toJava(Vec2.class);
777
- if ((Double.compare(jx, (Double) v.jx) == 0)
778
- && (Double.compare(jy, (Double) v.jy) == 0)) {
765
+ if (Double.compare(jx, (Double) v.jx) == 0
766
+ && Double.compare(jy, (Double) v.jy) == 0) {
779
767
  return runtime.newBoolean(true);
780
768
  }
781
769
  }
@@ -801,7 +789,7 @@ public class Vec2 extends RubyObject {
801
789
  double diff = jx - v.jx;
802
790
  if ((diff < 0 ? -diff : diff) > Vec2.EPSILON) {
803
791
  return runtime.newBoolean(false);
804
- }
792
+ }
805
793
  diff = jy - v.jy;
806
794
  return runtime.newBoolean((diff < 0 ? -diff : diff) < Vec2.EPSILON);
807
795
  }
@@ -1,12 +1,12 @@
1
1
  package monkstone.vecmath.vec3;
2
2
 
3
3
  /*
4
- * Copyright (c) 2018-21 Martin Prout
4
+ * Copyright (c) 2015-20 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 3.0 of the License, or (at your option) any later 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,7 +15,7 @@ package monkstone.vecmath.vec3;
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
  */
@@ -35,7 +35,6 @@ import monkstone.vecmath.JRender;
35
35
  import monkstone.vecmath.vec2.Vec2;
36
36
 
37
37
  /**
38
- *
39
38
  *
40
39
  * @author Martin Prout
41
40
  */
@@ -66,7 +65,7 @@ public final class Vec3 extends RubyObject {
66
65
  * @return new Vec3 object (ruby)
67
66
  */
68
67
  @JRubyMethod(name = "new", meta = true, rest = true)
69
- public final static IRubyObject rbNew(ThreadContext context, IRubyObject klazz, IRubyObject... args) {
68
+ public static IRubyObject rbNew(ThreadContext context, IRubyObject klazz, IRubyObject... args) {
70
69
  Vec3 vec = (Vec3) ((RubyClass) klazz).allocate();
71
70
  vec.init(context, args);
72
71
  return vec;
@@ -84,27 +83,27 @@ public final class Vec3 extends RubyObject {
84
83
  void init(ThreadContext context, IRubyObject... args) {
85
84
  int count = args.length;
86
85
  if (count >= 2) {
87
- jx = (args[0] instanceof RubyFloat)
86
+ jx = args[0] instanceof RubyFloat
88
87
  ? ((RubyFloat) args[0]).getValue() : ((RubyFixnum) args[0]).getDoubleValue();
89
- jy = (args[1] instanceof RubyFloat)
88
+ jy = args[1] instanceof RubyFloat
90
89
  ? ((RubyFloat) args[1]).getValue() : ((RubyFixnum) args[1]).getDoubleValue();
91
90
  }
92
91
  if (count == 3) {
93
- jz = (args[2] instanceof RubyFloat)
92
+ jz = args[2] instanceof RubyFloat
94
93
  ? ((RubyFloat) args[2]).getValue() : ((RubyFixnum) args[2]).getDoubleValue();
95
94
  } // allow ruby ducktyping in constructor
96
95
  if (count == 1) {
97
96
  if (!(args[0].respondsTo("x"))) {
98
97
  throw context.runtime.newTypeError(args[0].getType() + " doesn't respond_to :x & :y");
99
98
  }
100
- jx = ((args[0].callMethod(context, "x")) instanceof RubyFloat)
99
+ jx = (args[0].callMethod(context, "x")) instanceof RubyFloat
101
100
  ? ((RubyFloat) args[0].callMethod(context, "x")).getValue() : ((RubyFixnum) args[0].callMethod(context, "x")).getDoubleValue();
102
- jy = ((args[0].callMethod(context, "y")) instanceof RubyFloat)
101
+ jy = (args[0].callMethod(context, "y")) instanceof RubyFloat
103
102
  ? ((RubyFloat) args[0].callMethod(context, "y")).getValue() : ((RubyFixnum) args[0].callMethod(context, "y")).getDoubleValue();
104
103
  if (!(args[0].respondsTo("z"))) {
105
104
  return;
106
105
  } // allow promotion from 2D to 3D, sets jz = 0
107
- jz = ((args[0].callMethod(context, "z")) instanceof RubyFloat) ? ((RubyFloat) args[0].callMethod(context, "z")).getValue() : ((RubyFixnum) args[0].callMethod(context, "z")).getDoubleValue();
106
+ jz = (args[0].callMethod(context, "z")) instanceof RubyFloat ? ((RubyFloat) args[0].callMethod(context, "z")).getValue() : ((RubyFixnum) args[0].callMethod(context, "z")).getDoubleValue();
108
107
  }
109
108
  }
110
109
 
@@ -148,11 +147,7 @@ public final class Vec3 extends RubyObject {
148
147
  */
149
148
  @JRubyMethod(name = "x=")
150
149
  public IRubyObject setX(ThreadContext context, IRubyObject other) {
151
- if (other instanceof RubyFloat) {
152
- jx = ((RubyFloat) other).getValue();
153
- } else {
154
- jx = ((RubyFixnum) other).getDoubleValue();
155
- }
150
+ jx = other instanceof RubyFloat ? ((RubyFloat) other).getValue() : ((RubyFixnum) other).getDoubleValue();
156
151
  return other;
157
152
  }
158
153
 
@@ -164,11 +159,7 @@ public final class Vec3 extends RubyObject {
164
159
  */
165
160
  @JRubyMethod(name = "y=")
166
161
  public IRubyObject setY(ThreadContext context, IRubyObject other) {
167
- if (other instanceof RubyFloat) {
168
- jy = ((RubyFloat) other).getValue();
169
- } else {
170
- jy = ((RubyFixnum) other).getDoubleValue();
171
- }
162
+ jy = other instanceof RubyFloat ? ((RubyFloat) other).getValue() : ((RubyFixnum) other).getDoubleValue();
172
163
  return other;
173
164
  }
174
165
 
@@ -180,11 +171,7 @@ public final class Vec3 extends RubyObject {
180
171
  */
181
172
  @JRubyMethod(name = "z=")
182
173
  public IRubyObject setZ(ThreadContext context, IRubyObject other) {
183
- if (other instanceof RubyFloat) {
184
- jz = ((RubyFloat) other).getValue();
185
- } else {
186
- jz = ((RubyFixnum) other).getDoubleValue();
187
- }
174
+ jz = other instanceof RubyFloat ? ((RubyFloat) other).getValue() : ((RubyFixnum) other).getDoubleValue();
188
175
  return other;
189
176
  }
190
177
 
@@ -223,13 +210,13 @@ public final class Vec3 extends RubyObject {
223
210
  Ruby runtime = context.runtime;
224
211
  if (key instanceof RubySymbol) {
225
212
  if (key == RubySymbol.newSymbol(runtime, "x")) {
226
- jx = (value instanceof RubyFloat)
213
+ jx = value instanceof RubyFloat
227
214
  ? ((RubyFloat) value).getValue() : ((RubyFixnum) value).getDoubleValue();
228
215
  } else if (key == RubySymbol.newSymbol(runtime, "y")) {
229
- jy = (value instanceof RubyFloat)
216
+ jy = value instanceof RubyFloat
230
217
  ? ((RubyFloat) value).getValue() : ((RubyFixnum) value).getDoubleValue();
231
218
  } else if (key == RubySymbol.newSymbol(runtime, "z")) {
232
- jz = (value instanceof RubyFloat)
219
+ jz = value instanceof RubyFloat
233
220
  ? ((RubyFloat) value).getValue() : ((RubyFixnum) value).getDoubleValue();
234
221
  } else {
235
222
  throw runtime.newIndexError("invalid key");
@@ -369,7 +356,7 @@ public final class Vec3 extends RubyObject {
369
356
  @JRubyMethod(name = "*", required = 1)
370
357
  public IRubyObject op_mul(ThreadContext context, IRubyObject scalar) {
371
358
  Ruby runtime = context.runtime;
372
- double multi = (scalar instanceof RubyFloat)
359
+ double multi = scalar instanceof RubyFloat
373
360
  ? ((RubyFloat) scalar).getValue() : ((RubyFixnum) scalar).getDoubleValue();
374
361
  return Vec3.rbNew(context, this.getMetaClass(), new IRubyObject[]{
375
362
  runtime.newFloat(jx * multi),
@@ -386,7 +373,7 @@ public final class Vec3 extends RubyObject {
386
373
  @JRubyMethod(name = "/", required = 1)
387
374
  public IRubyObject op_div(ThreadContext context, IRubyObject scalar) {
388
375
  Ruby runtime = context.runtime;
389
- double divisor = (scalar instanceof RubyFloat)
376
+ double divisor = scalar instanceof RubyFloat
390
377
  ? ((RubyFloat) scalar).getValue() : ((RubyFixnum) scalar).getDoubleValue();
391
378
  if (Math.abs(divisor) < Vec3.EPSILON) {
392
379
  return this;
@@ -428,12 +415,10 @@ public final class Vec3 extends RubyObject {
428
415
  */
429
416
  @JRubyMethod(name = "set_mag")
430
417
  public IRubyObject set_mag(ThreadContext context, IRubyObject scalar, Block block) {
431
- if (block.isGiven()) {
432
- if (!(boolean) block.yield(context, scalar).toJava(Boolean.class)) {
433
- return this;
434
- }
418
+ if (block.isGiven() && !block.yield(context, scalar).toJava(Boolean.class)) {
419
+ return this;
435
420
  }
436
- double new_mag = (scalar instanceof RubyFloat)
421
+ double new_mag = scalar instanceof RubyFloat
437
422
  ? ((RubyFloat) scalar).getValue() : ((RubyFixnum) scalar).getDoubleValue();
438
423
  double current = Math.sqrt(jx * jx + jy * jy + jz * jz);
439
424
  if (current > EPSILON) {
@@ -599,9 +584,9 @@ public final class Vec3 extends RubyObject {
599
584
  double u = 0;
600
585
  double v = 0;
601
586
  if (count == 3) {
602
- u = (args[1] instanceof RubyFloat)
587
+ u = args[1] instanceof RubyFloat
603
588
  ? ((RubyFloat) args[1]).getValue() : ((RubyFixnum) args[1]).getDoubleValue();
604
- v = (args[2] instanceof RubyFloat)
589
+ v = args[2] instanceof RubyFloat
605
590
  ? ((RubyFloat) args[2]).getValue() : ((RubyFixnum) args[2]).getDoubleValue();
606
591
  }
607
592
  if (count == 2) {
@@ -663,9 +648,9 @@ public final class Vec3 extends RubyObject {
663
648
  }
664
649
  if (obj instanceof Vec3) {
665
650
  final Vec3 other = (Vec3) obj;
666
- if ((Double.compare(jx, (Double) other.jx) == 0)
667
- && (Double.compare(jy, (Double) other.jy) == 0)
668
- && (Double.compare(jz, (Double) other.jz) == 0)) {
651
+ if (Double.compare(jx, (Double) other.jx) == 0
652
+ && Double.compare(jy, (Double) other.jy) == 0
653
+ && Double.compare(jz, (Double) other.jz) == 0) {
669
654
  return true;
670
655
  }
671
656
 
@@ -687,9 +672,9 @@ public final class Vec3 extends RubyObject {
687
672
  }
688
673
  if (other instanceof Vec3) {
689
674
  Vec3 v = (Vec3) other.toJava(Vec3.class);
690
- if ((Double.compare(jx, (Double) v.jx) == 0)
691
- && (Double.compare(jy, (Double) v.jy) == 0)
692
- && (Double.compare(jz, (Double) v.jz) == 0)) {
675
+ if (Double.compare(jx, (Double) v.jx) == 0
676
+ && Double.compare(jy, (Double) v.jy) == 0
677
+ && Double.compare(jz, (Double) v.jz) == 0) {
693
678
  return runtime.newBoolean(true);
694
679
  }
695
680
 
@@ -262,7 +262,7 @@ public class PImageAWT extends PImage {
262
262
  * Use ImageIO functions from Java 1.4 and later to handle image save.
263
263
  * Various formats are supported, typically jpeg, png, bmp, and wbmp.
264
264
  * To get a list of the supported formats for writing, use: <BR>
265
- * <TT>println(javax.imageio.ImageIO.getReaderFormatNames())</TT>
265
+ * <code>println(javax.imageio.ImageIO.getReaderFormatNames())</code>
266
266
  *
267
267
  * @path The path to which the file should be written.
268
268
  */
@@ -354,7 +354,7 @@ public class ShimAWT implements PConstants {
354
354
  * Use ImageIO functions from Java 1.4 and later to handle image save.
355
355
  * Various formats are supported, typically jpeg, png, bmp, and wbmp.
356
356
  * To get a list of the supported formats for writing, use: <BR>
357
- * <TT>println(javax.imageio.ImageIO.getReaderFormatNames())</TT>
357
+ * <code>println(javax.imageio.ImageIO.getReaderFormatNames())</code>
358
358
  */
359
359
  static protected boolean saveImageIO(PImage image, String path) throws IOException {
360
360
  try {
@@ -1523,24 +1523,24 @@ public class PImage implements PConstants, Cloneable {
1523
1523
  * Sometimes called "Normal" or "Copy" in other software.
1524
1524
  *
1525
1525
  * <LI>BLEND - linear interpolation of colours:
1526
- * <TT>C = A*factor + B</TT>
1526
+ * <code>C = A*factor + B</code>
1527
1527
  *
1528
1528
  * <LI>ADD - additive blending with white clip:
1529
- * <TT>C = min(A*factor + B, 255)</TT>.
1529
+ * <code>C = min(A*factor + B, 255)</code>.
1530
1530
  * Clipped to 0..255, Photoshop calls this "Linear Burn",
1531
1531
  * and Director calls it "Add Pin".
1532
1532
  *
1533
1533
  * <LI>SUBTRACT - subtractive blend with black clip:
1534
- * <TT>C = max(B - A*factor, 0)</TT>.
1534
+ * <code>C = max(B - A*factor, 0)</code>.
1535
1535
  * Clipped to 0..255, Photoshop calls this "Linear Dodge",
1536
1536
  * and Director calls it "Subtract Pin".
1537
1537
  *
1538
1538
  * <LI>DARKEST - only the darkest colour succeeds:
1539
- * <TT>C = min(A*factor, B)</TT>.
1539
+ * <code>C = min(A*factor, B)</code>.
1540
1540
  * Illustrator calls this "Darken".
1541
1541
  *
1542
1542
  * <LI>LIGHTEST - only the lightest colour succeeds:
1543
- * <TT>C = max(A*factor, B)</TT>.
1543
+ * <code>C = max(A*factor, B)</code>.
1544
1544
  * Illustrator calls this "Lighten".
1545
1545
  *
1546
1546
  * <LI>DIFFERENCE - subtract colors from underlying image.
@@ -1571,12 +1571,12 @@ public class PImage implements PConstants, Cloneable {
1571
1571
  * <P>It is important to note that Processing uses "fast" code, not
1572
1572
  * necessarily "correct" code. No biggie, most software does. A nitpicker
1573
1573
  * can find numerous "off by 1 division" problems in the blend code where
1574
- * <TT>&gt;&gt;8</TT> or <TT>&gt;&gt;7</TT> is used when strictly speaking
1575
- * <TT>/255.0</T> or <TT>/127.0</TT> should have been used.</P>
1574
+ * <code>&gt;&gt;8</code> or <code>&gt;&gt;7</code> is used when strictly speaking
1575
+ * <code>/255.0</T> or <code>/127.0</code> should have been used.</P>
1576
1576
  * <P>For instance, exclusion (not intended for real-time use) reads
1577
- * <TT>r1 + r2 - ((2 * r1 * r2) / 255)</TT> because <TT>255 == 1.0</TT>
1578
- * not <TT>256 == 1.0</TT>. In other words, <TT>(255*255)>>8</TT> is not
1579
- * the same as <TT>(255*255)/255</TT>. But for real-time use the shifts
1577
+ * <code>r1 + r2 - ((2 * r1 * r2) / 255)</code> because <code>255 == 1.0</code>
1578
+ * not <code>256 == 1.0</code>. In other words, <code>(255*255)>>8</code> is not
1579
+ * the same as <code>(255*255)/255</code>. But for real-time use the shifts
1580
1580
  * are preferable, and the difference is insignificant for applications
1581
1581
  * built with Processing.</P>
1582
1582
  *
@@ -3104,9 +3104,9 @@ int testFunction(int dst, int src) {
3104
3104
  * </p>
3105
3105
  * Starting with revision 0092, the format setting is taken into account:
3106
3106
  * <UL>
3107
- * <LI><TT>ALPHA</TT> images written as 8bit grayscale (uses lowest byte)
3108
- * <LI><TT>RGB</TT> &rarr; 24 bits
3109
- * <LI><TT>ARGB</TT> &rarr; 32 bits
3107
+ * <LI><code>ALPHA</code> images written as 8bit grayscale (uses lowest byte)
3108
+ * <LI><code>RGB</code> &rarr; 24 bits
3109
+ * <LI><code>ARGB</code> &rarr; 32 bits
3110
3110
  * </UL>
3111
3111
  * All versions are RLE compressed.
3112
3112
  * </p>
@@ -3278,7 +3278,7 @@ int testFunction(int dst, int src) {
3278
3278
  * and the extension used is supported (usually png, jpg, jpeg, bmp,
3279
3279
  * and tiff), then those methods will be used to write the image.
3280
3280
  * To get a list of the supported formats for writing, use: <BR>
3281
- * <TT>println(javax.imageio.ImageIO.getReaderFormatNames())</TT>
3281
+ * <code>println(javax.imageio.ImageIO.getReaderFormatNames())</code>
3282
3282
  * <p>
3283
3283
  * To use the original built-in image writers, use .tga or .tif as the
3284
3284
  * extension, or don't include an extension. When no extension is used,
@@ -1757,16 +1757,10 @@ public class PShader implements PConstants {
1757
1757
  colorLoc = getAttributeLoc("color");
1758
1758
  texCoordLoc = getAttributeLoc("texCoord");
1759
1759
  normalLoc = getAttributeLoc("normal");
1760
-
1761
1760
  ambientLoc = getAttributeLoc("ambient");
1762
1761
  specularLoc = getAttributeLoc("specular");
1763
1762
  emissiveLoc = getAttributeLoc("emissive");
1764
1763
  shininessLoc = getAttributeLoc("shininess");
1765
-
1766
- directionLoc = getAttributeLoc("direction");
1767
-
1768
- offsetLoc = getAttributeLoc("offset");
1769
-
1770
1764
  directionLoc = getAttributeLoc("direction");
1771
1765
  offsetLoc = getAttributeLoc("offset");
1772
1766
 
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'test_helper'
4
+
5
+ Java::Monkstone::PicrateLibrary.new.load(JRuby.runtime, false)
6
+
7
+ # include Processing::HelperMethods
8
+
9
+ Dir.chdir(File.dirname(__FILE__))
10
+ # Test processing map functions
11
+ class ProcessingNoiseTest < Minitest::Test
12
+ include NoiseModule
13
+ def test_noise1d
14
+ x = 0.5
15
+ assert_in_delta(noise(x), 0.5, 0.00001)
16
+ end
17
+ end
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: 2.4.2
4
+ version: 2.5.0
5
5
  platform: java
6
6
  authors:
7
7
  - monkstone
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-18 00:00:00.000000000 Z
11
+ date: 2021-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -43,10 +43,7 @@ dependencies:
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '1.1'
47
- - - ">="
48
- - !ruby/object:Gem::Version
49
- version: 1.1.1
46
+ version: '1.2'
50
47
  name: arcball
51
48
  prerelease: false
52
49
  type: :runtime
@@ -54,10 +51,7 @@ dependencies:
54
51
  requirements:
55
52
  - - "~>"
56
53
  - !ruby/object:Gem::Version
57
- version: '1.1'
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- version: 1.1.1
54
+ version: '1.2'
61
55
  description: |
62
56
  A batteries included version of processing in ruby, for raspberrypi and
63
57
  linux. Install samples to configures geany ide.
@@ -82,10 +76,10 @@ files:
82
76
  - docs/.gitignore
83
77
  - docs/_classes/aabb/aabb.md
84
78
  - docs/_classes/app/app.md
85
- - docs/_classes/app_render/app_render.md
86
79
  - docs/_classes/arc_ball/arc_ball.md
87
80
  - docs/_classes/chooser/chooser.md
88
81
  - docs/_classes/deglut/deglut.md
82
+ - docs/_classes/gfx_render/app_render.md
89
83
  - docs/_classes/library_proxy/library_proxy.md
90
84
  - docs/_classes/vec2d/vec2d.md
91
85
  - docs/_classes/vec3d/vec3d.md
@@ -130,7 +124,7 @@ files:
130
124
  - docs/_methods/map1d.md
131
125
  - docs/_methods/methods_summary.md
132
126
  - docs/_methods/mouse_pressed.md
133
- - docs/_methods/noise_mode.md
127
+ - docs/_methods/noise_modes.md
134
128
  - docs/_methods/post_initialize.md
135
129
  - docs/_methods/processing_api.md
136
130
  - docs/_methods/settings.md
@@ -191,7 +185,7 @@ files:
191
185
  - lib/jogl-all-natives-linux-amd64.jar
192
186
  - lib/jogl-all-natives-linux-armv6hf.jar
193
187
  - lib/jogl-all.jar
194
- - lib/picrate-2.4.2.jar
188
+ - lib/picrate-2.5.0.jar
195
189
  - lib/picrate.rb
196
190
  - lib/picrate/app.rb
197
191
  - lib/picrate/creators/parameters.rb
@@ -227,14 +221,11 @@ files:
227
221
  - picrate.gemspec
228
222
  - pom.rb
229
223
  - pom.xml
230
- - src/main/java/japplemenubar/JAppleMenuBar.java
231
- - src/main/java/japplemenubar/libjAppleMenuBar.jnilib
232
224
  - src/main/java/monkstone/ColorUtil.java
233
225
  - src/main/java/monkstone/FastNoiseModuleJava.java
234
226
  - src/main/java/monkstone/MathToolModule.java
235
227
  - src/main/java/monkstone/PicrateLibrary.java
236
228
  - src/main/java/monkstone/SmoothNoiseModuleJava.java
237
- - src/main/java/monkstone/complex/JComplex.java
238
229
  - src/main/java/monkstone/core/LibraryProxy.java
239
230
  - src/main/java/monkstone/fastmath/DegLutTables.java
240
231
  - src/main/java/monkstone/fastmath/Deglut.java
@@ -251,15 +242,11 @@ files:
251
242
  - src/main/java/monkstone/slider/SliderBar.java
252
243
  - src/main/java/monkstone/slider/SliderGroup.java
253
244
  - src/main/java/monkstone/slider/WheelHandler.java
254
- - src/main/java/monkstone/vecmath/AppRender.java
255
245
  - src/main/java/monkstone/vecmath/GfxRender.java
256
246
  - src/main/java/monkstone/vecmath/JRender.java
257
247
  - src/main/java/monkstone/vecmath/ShapeRender.java
258
- - src/main/java/monkstone/vecmath/package-info.java
259
248
  - src/main/java/monkstone/vecmath/vec2/Vec2.java
260
- - src/main/java/monkstone/vecmath/vec2/package-info.java
261
249
  - src/main/java/monkstone/vecmath/vec3/Vec3.java
262
- - src/main/java/monkstone/vecmath/vec3/package-info.java
263
250
  - src/main/java/monkstone/videoevent/CaptureEvent.java
264
251
  - src/main/java/monkstone/videoevent/MovieEvent.java
265
252
  - src/main/java/monkstone/videoevent/package-info.java
@@ -352,6 +339,7 @@ files:
352
339
  - test/deglut_spec_test.rb
353
340
  - test/helper_methods_test.rb
354
341
  - test/math_tool_test.rb
342
+ - test/noise_test.rb
355
343
  - test/respond_to_test.rb
356
344
  - test/sketches/key_event.rb
357
345
  - test/sketches/library/my_library/my_library.rb
@@ -381,7 +369,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
381
369
  version: '0'
382
370
  requirements:
383
371
  - java runtime == 11+
384
- rubygems_version: 3.1.6
372
+ rubygems_version: 3.2.14
385
373
  signing_key:
386
374
  specification_version: 4
387
375
  summary: ruby implementation of processing-3 on raspberrypi and linux64
@@ -390,6 +378,7 @@ test_files:
390
378
  - test/deglut_spec_test.rb
391
379
  - test/helper_methods_test.rb
392
380
  - test/math_tool_test.rb
381
+ - test/noise_test.rb
393
382
  - test/respond_to_test.rb
394
383
  - test/sketches/key_event.rb
395
384
  - test/sketches/library/my_library/my_library.rb