propane 3.11.0-java → 4.0.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/.mvn/extensions.xml +1 -1
  3. data/CHANGELOG.md +2 -0
  4. data/README.md +5 -5
  5. data/Rakefile +1 -1
  6. data/lib/propane/app.rb +2 -2
  7. data/lib/propane/version.rb +1 -1
  8. data/lib/propane-4.0.0.jar +0 -0
  9. data/library/slider/slider.rb +1 -1
  10. data/pom.rb +8 -8
  11. data/pom.xml +8 -8
  12. data/propane.gemspec +3 -3
  13. data/src/main/java/monkstone/ColorUtil.java +1 -1
  14. data/src/main/java/monkstone/MathToolModule.java +1 -1
  15. data/src/main/java/monkstone/PropaneLibrary.java +1 -1
  16. data/src/main/java/monkstone/fastmath/DegLutTables.java +10 -11
  17. data/src/main/java/monkstone/fastmath/Deglut.java +1 -1
  18. data/src/main/java/monkstone/filechooser/Chooser.java +1 -1
  19. data/src/main/java/monkstone/noise/LICENSE +121 -0
  20. data/src/main/java/monkstone/slider/CustomHorizontalSlider.java +1 -1
  21. data/src/main/java/monkstone/slider/CustomVerticalSlider.java +1 -1
  22. data/src/main/java/monkstone/slider/SimpleHorizontalSlider.java +1 -1
  23. data/src/main/java/monkstone/slider/SimpleVerticalSlider.java +1 -1
  24. data/src/main/java/monkstone/slider/SliderBar.java +1 -1
  25. data/src/main/java/monkstone/slider/SliderGroup.java +1 -1
  26. data/src/main/java/monkstone/slider/WheelHandler.java +1 -1
  27. data/src/main/java/monkstone/vecmath/package-info.java +1 -1
  28. data/src/main/java/monkstone/vecmath/vec2/Vec2.java +92 -68
  29. data/src/main/java/monkstone/vecmath/vec3/Vec3.java +1 -1
  30. data/src/main/java/monkstone/videoevent/CaptureEvent.java +1 -1
  31. data/src/main/java/monkstone/videoevent/MovieEvent.java +1 -1
  32. data/src/main/java/monkstone/videoevent/package-info.java +1 -1
  33. data/src/main/java/processing/awt/PGraphicsJava2D.java +0 -1
  34. data/src/main/java/processing/awt/PImageAWT.java +2 -4
  35. data/src/main/java/processing/core/PApplet.java +4 -4
  36. data/src/main/java/processing/core/PImage.java +3025 -3047
  37. data/src/main/java/processing/core/PMatrix.java +5 -2
  38. data/src/main/java/processing/data/DoubleDict.java +72 -43
  39. data/src/main/java/processing/data/DoubleList.java +6 -2
  40. data/src/main/java/processing/data/FloatDict.java +744 -756
  41. data/src/main/java/processing/data/FloatList.java +68 -26
  42. data/src/main/java/processing/data/IntDict.java +72 -45
  43. data/src/main/java/processing/data/IntList.java +63 -26
  44. data/src/main/java/processing/data/JSONArray.java +892 -931
  45. data/src/main/java/processing/data/JSONObject.java +1169 -1262
  46. data/src/main/java/processing/data/JSONTokener.java +30 -49
  47. data/src/main/java/processing/data/LongDict.java +699 -712
  48. data/src/main/java/processing/data/LongList.java +676 -700
  49. data/src/main/java/processing/data/Sort.java +1 -0
  50. data/src/main/java/processing/data/Table.java +4040 -3661
  51. data/src/main/java/processing/data/TableRow.java +16 -0
  52. data/src/main/java/processing/data/XML.java +1041 -956
  53. data/src/main/java/processing/event/TouchEvent.java +1 -1
  54. data/src/main/java/processing/opengl/FontTexture.java +2 -2
  55. data/src/main/java/processing/opengl/PGraphicsOpenGL.java +15 -18
  56. data/src/main/java/processing/opengl/PJOGL.java +2 -2
  57. data/src/main/java/processing/opengl/PShapeOpenGL.java +23 -24
  58. data/test/vecmath_spec_test.rb +14 -3
  59. data/vendors/Rakefile +1 -1
  60. metadata +9 -8
  61. data/lib/propane-3.11.0.jar +0 -0
@@ -42,7 +42,7 @@ longpress
42
42
 
43
43
  W3C touch events
44
44
  http://www.w3.org/TR/touch-events/
45
- http://www.w3.org/TR/2011/WD-touch-events-20110913/
45
+ http://www.w3.org/TR/2011/WD-touch-events-22110913/
46
46
 
47
47
  Pointer and gesture events (Windows)
48
48
  http://msdn.microsoft.com/en-US/library/ie/hh673557.aspx
@@ -359,7 +359,7 @@ class FontTexture implements PConstants {
359
359
  }
360
360
 
361
361
 
362
- void updateUV() {
362
+ final void updateUV() {
363
363
  width = textures[texIndex].glWidth;
364
364
  height = textures[texIndex].glHeight;
365
365
 
@@ -370,7 +370,7 @@ class FontTexture implements PConstants {
370
370
  }
371
371
 
372
372
 
373
- void updateTex() {
373
+ final void updateTex() {
374
374
  textures[texIndex].setNative(pixels, crop[0] - 1, crop[1] + crop[3] - 1,
375
375
  crop[2] + 2, -crop[3] + 2);
376
376
  }
@@ -3851,12 +3851,10 @@ public class PGraphicsOpenGL extends PGraphics {
3851
3851
  float factor = 1;
3852
3852
 
3853
3853
  if (matrix != null) {
3854
- if (matrix instanceof PMatrix2D) {
3855
- PMatrix2D tr = (PMatrix2D)matrix;
3854
+ if (matrix instanceof PMatrix2D tr) {
3856
3855
  float areaScaleFactor = Math.abs(tr.m00 * tr.m11 - tr.m01 * tr.m10);
3857
3856
  factor = (float) Math.sqrt(areaScaleFactor);
3858
- } else if (matrix instanceof PMatrix3D) {
3859
- PMatrix3D tr = (PMatrix3D)matrix;
3857
+ } else if (matrix instanceof PMatrix3D tr) {
3860
3858
  float volumeScaleFactor =
3861
3859
  Math.abs(tr.m00 * (tr.m11 * tr.m22 - tr.m12 * tr.m21) +
3862
3860
  tr.m01 * (tr.m12 * tr.m20 - tr.m10 * tr.m22) +
@@ -10774,26 +10772,26 @@ public class PGraphicsOpenGL extends PGraphics {
10774
10772
  // Matrix transformations
10775
10773
 
10776
10774
  void applyMatrixOnPolyGeometry(PMatrix tr, int first, int last) {
10777
- if (tr instanceof PMatrix2D) {
10778
- applyMatrixOnPolyGeometry((PMatrix2D) tr, first, last);
10779
- } else if (tr instanceof PMatrix3D) {
10780
- applyMatrixOnPolyGeometry((PMatrix3D) tr, first, last);
10775
+ if (tr instanceof PMatrix2D matrix) {
10776
+ applyMatrixOnPolyGeometry(matrix, first, last);
10777
+ } else if (tr instanceof PMatrix3D matrix) {
10778
+ applyMatrixOnPolyGeometry(matrix, first, last);
10781
10779
  }
10782
10780
  }
10783
10781
 
10784
10782
  void applyMatrixOnLineGeometry(PMatrix tr, int first, int last) {
10785
- if (tr instanceof PMatrix2D) {
10786
- applyMatrixOnLineGeometry((PMatrix2D) tr, first, last);
10787
- } else if (tr instanceof PMatrix3D) {
10788
- applyMatrixOnLineGeometry((PMatrix3D) tr, first, last);
10783
+ if (tr instanceof PMatrix2D matrix) {
10784
+ applyMatrixOnLineGeometry(matrix, first, last);
10785
+ } else if (tr instanceof PMatrix3D matrix) {
10786
+ applyMatrixOnLineGeometry(matrix, first, last);
10789
10787
  }
10790
10788
  }
10791
10789
 
10792
10790
  void applyMatrixOnPointGeometry(PMatrix tr, int first, int last) {
10793
- if (tr instanceof PMatrix2D) {
10794
- applyMatrixOnPointGeometry((PMatrix2D) tr, first, last);
10795
- } else if (tr instanceof PMatrix3D) {
10796
- applyMatrixOnPointGeometry((PMatrix3D) tr, first, last);
10791
+ if (tr instanceof PMatrix2D matrix) {
10792
+ applyMatrixOnPointGeometry(matrix, first, last);
10793
+ } else if (tr instanceof PMatrix3D matrix) {
10794
+ applyMatrixOnPointGeometry(matrix, first, last);
10797
10795
  }
10798
10796
  }
10799
10797
 
@@ -13275,8 +13273,7 @@ public class PGraphicsOpenGL extends PGraphics {
13275
13273
 
13276
13274
  @Override
13277
13275
  public void vertex(Object data) {
13278
- if (data instanceof double[]) {
13279
- double[] d = (double[]) data;
13276
+ if (data instanceof double[] d) {
13280
13277
  int l = d.length;
13281
13278
  if (l < 25) {
13282
13279
  throw new RuntimeException("TessCallback vertex() data is " +
@@ -241,8 +241,8 @@ public class PJOGL extends PGL {
241
241
  PSurface surf = sketch.getSurface();
242
242
  if (surf == null) {
243
243
  return graphics.pixelDensity;
244
- } else if (surf instanceof PSurfaceJOGL) {
245
- return ((PSurfaceJOGL)surf).getPixelScale();
244
+ } else if (surf instanceof PSurfaceJOGL jogl) {
245
+ return jogl.getPixelScale();
246
246
  } else {
247
247
  throw new RuntimeException("Renderer cannot find a JOGL surface");
248
248
  }
@@ -413,9 +413,9 @@ public class PShapeOpenGL extends PShape {
413
413
 
414
414
  @Override
415
415
  public void addChild(PShape who) {
416
- if (who instanceof PShapeOpenGL) {
416
+ if (who instanceof PShapeOpenGL psogl) {
417
417
  if (family == GROUP) {
418
- PShapeOpenGL c3d = (PShapeOpenGL)who;
418
+ PShapeOpenGL c3d = psogl;
419
419
 
420
420
  super.addChild(c3d);
421
421
  c3d.updateRoot(root);
@@ -423,9 +423,9 @@ public class PShapeOpenGL extends PShape {
423
423
 
424
424
  if (c3d.family == GROUP) {
425
425
  if (c3d.textures != null) {
426
- for (PImage tex: c3d.textures) {
427
- addTexture(tex);
428
- }
426
+ c3d.textures.forEach(tex -> {
427
+ addTexture(tex);
428
+ });
429
429
  } else {
430
430
  untexChild(true);
431
431
  }
@@ -454,9 +454,9 @@ public class PShapeOpenGL extends PShape {
454
454
 
455
455
  @Override
456
456
  public void addChild(PShape who, int idx) {
457
- if (who instanceof PShapeOpenGL) {
457
+ if (who instanceof PShapeOpenGL psogl) {
458
458
  if (family == GROUP) {
459
- PShapeOpenGL c3d = (PShapeOpenGL)who;
459
+ PShapeOpenGL c3d = psogl;
460
460
 
461
461
  super.addChild(c3d, idx);
462
462
  c3d.updateRoot(root);
@@ -4636,36 +4636,36 @@ public class PShapeOpenGL extends PShape {
4636
4636
 
4637
4637
  @Override
4638
4638
  protected void styles(PGraphics g) {
4639
- if (g instanceof PGraphicsOpenGL) {
4640
- if (g.stroke) {
4639
+ if (g instanceof PGraphicsOpenGL pgl) {
4640
+ if (pgl.stroke) {
4641
4641
  setStroke(true);
4642
- setStroke(g.strokeColor);
4643
- setStrokeWeight(g.strokeWeight);
4644
- setStrokeCap(g.strokeCap);
4645
- setStrokeJoin(g.strokeJoin);
4642
+ setStroke(pgl.strokeColor);
4643
+ setStrokeWeight(pgl.strokeWeight);
4644
+ setStrokeCap(pgl.strokeCap);
4645
+ setStrokeJoin(pgl.strokeJoin);
4646
4646
  } else {
4647
4647
  setStroke(false);
4648
4648
  }
4649
4649
 
4650
- if (g.fill) {
4650
+ if (pgl.fill) {
4651
4651
  setFill(true);
4652
- setFill(g.fillColor);
4652
+ setFill(pgl.fillColor);
4653
4653
  } else {
4654
4654
  setFill(false);
4655
4655
  }
4656
4656
 
4657
- if (g.tint) {
4657
+ if (pgl.tint) {
4658
4658
  setTint(true);
4659
- setTint(g.tintColor);
4659
+ setTint(pgl.tintColor);
4660
4660
  }
4661
4661
 
4662
- setAmbient(g.ambientColor);
4663
- setSpecular(g.specularColor);
4664
- setEmissive(g.emissiveColor);
4665
- setShininess(g.shininess);
4662
+ setAmbient(pgl.ambientColor);
4663
+ setSpecular(pgl.specularColor);
4664
+ setEmissive(pgl.emissiveColor);
4665
+ setShininess(pgl.shininess);
4666
4666
 
4667
4667
  if (image != null) {
4668
- setTextureMode(g.textureMode);
4668
+ setTextureMode(pgl.textureMode);
4669
4669
  }
4670
4670
  } else {
4671
4671
  super.styles(g);
@@ -4689,8 +4689,7 @@ public class PShapeOpenGL extends PShape {
4689
4689
 
4690
4690
  @Override
4691
4691
  public void draw(PGraphics g) {
4692
- if (g instanceof PGraphicsOpenGL) {
4693
- PGraphicsOpenGL gl = (PGraphicsOpenGL)g;
4692
+ if (g instanceof PGraphicsOpenGL gl) {
4694
4693
  if (visible) {
4695
4694
  pre(gl);
4696
4695
 
@@ -277,17 +277,28 @@ class VecmathTest < Minitest::Test
277
277
  end
278
278
 
279
279
  def test_cross_area # NB: the sign might be negative
280
+ a = Vec2D.new(200, 0)
281
+ b = Vec2D.new(0, 200)
282
+ out, err = capture_subprocess_io do
283
+ # Expected result is an area, twice that of the triangle created by the vectors
284
+ a.cross(b)
285
+ end
286
+ assert_match %r%WARNING%, err
287
+ end
288
+
289
+ def test_wedge_area # NB: the sign might be negative
280
290
  a = Vec2D.new(200, 0)
281
291
  b = Vec2D.new(0, 200)
282
292
  # Expected result is an area, twice that of the triangle created by the vectors
283
- assert_equal(a.cross(b).abs, 40_000.0, 'Failed area test using 2D vector cross product')
293
+ assert_equal(a ^ b, 40_000.0, 'Failed area test using 2D vector cross product')
284
294
  end
285
295
 
286
296
  def test_cross_non_zero # Could be used to calculate area of triangle
287
297
  a = Vec2D.new(40, 40)
288
298
  b = Vec2D.new(40, 140)
289
299
  c = Vec2D.new(140, 40)
290
- assert_equal((a - b).cross(b - c).abs / 2, 5_000.0, 'Failed area calculation using 2D vector cross product')
300
+ assert_equal(-5_000.0, (a - b) ^ (b - c) / 2, 'Failed area calculation using 2D vector cross product')
301
+
291
302
  end
292
303
 
293
304
  def test_cross_zero # where a, b, c are collinear area == 0
@@ -295,7 +306,7 @@ class VecmathTest < Minitest::Test
295
306
  b = Vec2D.new(100, 100)
296
307
  c = Vec2D.new(200, 200)
297
308
  # see http://mathworld.wolfram.com/Collinear.html for details
298
- assert((a - b).cross(b - c).zero?, 'Failed collinearity test using 2D vector cross product')
309
+ assert(((a - b) ^ (b - c)).zero?, 'Failed collinearity test using 2D vector cross product')
299
310
  end
300
311
 
301
312
  def test_equals3
data/vendors/Rakefile CHANGED
@@ -11,7 +11,7 @@ PROCESSING_GITHUB = 'https://github.com/processing'
11
11
  PROPANE_EXAMPLES = 'https://github.com/ruby-processing/propane-examples'
12
12
  VIDEO = 'video.zip'
13
13
  DOWNLOAD = 'releases/download/latest'
14
- EXAMPLES = '3.4'
14
+ EXAMPLES = '3.5'
15
15
  HOME_DIR = ENV['HOME']
16
16
  LIBRARY = File.join(HOME_DIR, '.propane', 'libraries')
17
17
  MAC_OR_LINUX = /linux|mac|darwin/.match?(RbConfig::CONFIG['host_os'])
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: propane
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.11.0
4
+ version: 4.0.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-10-16 00:00:00.000000000 Z
11
+ date: 2022-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -35,7 +35,7 @@ dependencies:
35
35
  requirements:
36
36
  - - "~>"
37
37
  - !ruby/object:Gem::Version
38
- version: '5.14'
38
+ version: '5.15'
39
39
  name: minitest
40
40
  prerelease: false
41
41
  type: :development
@@ -43,7 +43,7 @@ dependencies:
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '5.14'
46
+ version: '5.15'
47
47
  - !ruby/object:Gem::Dependency
48
48
  requirement: !ruby/object:Gem::Requirement
49
49
  requirements:
@@ -105,7 +105,7 @@ files:
105
105
  - lib/jogl-all-natives-macosx-universal.jar
106
106
  - lib/jogl-all-natives-windows-amd64.jar
107
107
  - lib/jogl-all.jar
108
- - lib/propane-3.11.0.jar
108
+ - lib/propane-4.0.0.jar
109
109
  - lib/propane.rb
110
110
  - lib/propane/app.rb
111
111
  - lib/propane/creators/sketch_class.rb
@@ -154,6 +154,7 @@ files:
154
154
  - src/main/java/monkstone/fastmath/Deglut.java
155
155
  - src/main/java/monkstone/fastmath/package-info.java
156
156
  - src/main/java/monkstone/filechooser/Chooser.java
157
+ - src/main/java/monkstone/noise/LICENSE
157
158
  - src/main/java/monkstone/noise/OpenSimplex2F.java
158
159
  - src/main/java/monkstone/noise/OpenSimplex2S.java
159
160
  - src/main/java/monkstone/slider/CustomHorizontalSlider.java
@@ -299,12 +300,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
299
300
  - !ruby/object:Gem::Version
300
301
  version: '0'
301
302
  requirements:
302
- - java runtime >= 11.0.11+
303
+ - java runtime >= 17.0.1+
303
304
  rubygems_version: 3.2.29
304
305
  signing_key:
305
306
  specification_version: 4
306
- summary: ruby implementation of processing-4.0 on MacOS, linux and windows (64bit
307
- only)
307
+ summary: ruby implementation of processing-4.0 on linux and windows (64bit only),
308
+ might work MacOS, needs testing
308
309
  test_files:
309
310
  - test/create_test.rb
310
311
  - test/deglut_spec_test.rb
Binary file