picrate 0.5.0-java → 0.6.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/.mvn/wrapper/maven-wrapper.properties +1 -1
  3. data/CHANGELOG.md +3 -1
  4. data/README.md +1 -1
  5. data/Rakefile +8 -6
  6. data/docs/_editors/geany.md +5 -4
  7. data/docs/_editors/vim.md +6 -0
  8. data/docs/_includes/head.html +1 -0
  9. data/docs/_libraries/control_panel.md +2 -2
  10. data/docs/_libraries/gl_video.md +21 -0
  11. data/docs/_posts/2018-05-06-getting_started.md +10 -9
  12. data/docs/_posts/2018-05-06-install_jruby.md +19 -2
  13. data/docs/_posts/2018-06-26-auto_install_picrate.md +19 -4
  14. data/docs/_posts/2018-11-18-building-gem.md +18 -0
  15. data/docs/_posts/2018-11-27-getting_started_geany.md +38 -0
  16. data/docs/about.md +21 -10
  17. data/docs/assets/android-chrome-192x192.png +0 -0
  18. data/docs/assets/android-chrome-512x512.png +0 -0
  19. data/docs/assets/favicon.ico +0 -0
  20. data/docs/assets/geany.png +0 -0
  21. data/docs/assets/jwishy_picrate.png +0 -0
  22. data/docs/assets/picrate.svg +251 -0
  23. data/docs/index.html +8 -14
  24. data/lib/picrate/runner.rb +6 -2
  25. data/lib/picrate/version.rb +1 -1
  26. data/library/boids/boids.rb +10 -13
  27. data/mvnw +234 -0
  28. data/picrate.gemspec +2 -1
  29. data/pom.rb +1 -1
  30. data/pom.xml +1 -1
  31. data/src/main/java/japplemenubar/JAppleMenuBar.java +10 -2
  32. data/src/main/java/monkstone/ColorUtil.java +11 -1
  33. data/src/main/java/monkstone/MathToolModule.java +1 -0
  34. data/src/main/java/monkstone/PicrateLibrary.java +1 -0
  35. data/src/main/java/monkstone/fastmath/Deglut.java +1 -0
  36. data/src/main/java/monkstone/noise/SimplexNoise.java +3 -3
  37. data/src/main/java/monkstone/slider/CustomHorizontalSlider.java +1 -1
  38. data/src/main/java/monkstone/slider/CustomVerticalSlider.java +1 -1
  39. data/src/main/java/monkstone/slider/SimpleHorizontalSlider.java +1 -1
  40. data/src/main/java/monkstone/slider/SimpleSlider.java +8 -8
  41. data/src/main/java/monkstone/slider/SimpleVerticalSlider.java +1 -1
  42. data/src/main/java/monkstone/slider/Slider.java +3 -3
  43. data/src/main/java/monkstone/slider/SliderBar.java +1 -1
  44. data/src/main/java/monkstone/slider/SliderGroup.java +1 -1
  45. data/src/main/java/monkstone/vecmath/AppRender.java +1 -0
  46. data/src/main/java/monkstone/vecmath/JRender.java +1 -0
  47. data/src/main/java/monkstone/vecmath/ShapeRender.java +1 -0
  48. data/src/main/java/monkstone/vecmath/vec2/Vec2.java +8 -0
  49. data/src/main/java/monkstone/vecmath/vec3/Vec3.java +1 -0
  50. data/src/main/java/processing/awt/PGraphicsJava2D.java +85 -16
  51. data/src/main/java/processing/awt/PSurfaceAWT.java +1 -1
  52. data/src/main/java/processing/core/PApplet.java +18 -12
  53. data/src/main/java/processing/core/PShape.java +1182 -305
  54. data/src/main/java/processing/core/PStyle.java +1 -1
  55. data/src/main/java/processing/core/PSurface.java +1 -1
  56. data/src/main/java/processing/data/FloatDict.java +196 -54
  57. data/src/main/java/processing/data/FloatList.java +167 -54
  58. data/src/main/java/processing/data/IntDict.java +211 -56
  59. data/src/main/java/processing/data/IntList.java +185 -52
  60. data/src/main/java/processing/data/JSONArray.java +69 -20
  61. data/src/main/java/processing/data/JSONObject.java +53 -12
  62. data/src/main/java/processing/data/Sort.java +40 -10
  63. data/src/main/java/processing/data/StringDict.java +159 -49
  64. data/src/main/java/processing/data/StringList.java +147 -42
  65. data/src/main/java/processing/data/Table.java +778 -223
  66. data/src/main/java/processing/data/TableRow.java +26 -2
  67. data/src/main/java/processing/data/XML.java +190 -50
  68. data/src/main/java/processing/event/Event.java +93 -0
  69. data/src/main/java/processing/event/KeyEvent.java +55 -13
  70. data/src/main/java/processing/event/MouseEvent.java +77 -1
  71. data/src/main/java/processing/event/TouchEvent.java +14 -1
  72. data/src/main/java/processing/javafx/PGraphicsFX2D.java +8 -0
  73. data/src/main/java/processing/opengl/FrameBuffer.java +228 -66
  74. data/src/main/java/processing/opengl/LinePath.java +131 -27
  75. data/src/main/java/processing/opengl/LineStroker.java +30 -5
  76. data/src/main/java/processing/opengl/PGL.java +4066 -865
  77. data/src/main/java/processing/opengl/PGraphics2D.java +38 -10
  78. data/src/main/java/processing/opengl/PGraphics3D.java +38 -6
  79. data/src/main/java/processing/opengl/PGraphicsOpenGL.java +1980 -474
  80. data/src/main/java/processing/opengl/PJOGL.java +1460 -248
  81. data/src/main/java/processing/opengl/PShader.java +904 -217
  82. data/src/main/java/processing/opengl/PShapeOpenGL.java +1811 -487
  83. data/src/main/java/processing/opengl/PSurfaceJOGL.java +278 -71
  84. data/src/main/java/processing/opengl/Texture.java +610 -135
  85. data/src/main/java/processing/opengl/VertexBuffer.java +45 -9
  86. data/src/main/resources/icon/icon-1024.png +0 -0
  87. data/src/main/resources/icon/icon-128.png +0 -0
  88. data/src/main/resources/icon/icon-16.png +0 -0
  89. data/src/main/resources/icon/icon-256.png +0 -0
  90. data/src/main/resources/icon/icon-32.png +0 -0
  91. data/src/main/resources/icon/icon-48.png +0 -0
  92. data/src/main/resources/icon/icon-512.png +0 -0
  93. data/src/main/resources/icon/icon-64.png +0 -0
  94. data/vendors/Rakefile +1 -1
  95. metadata +13 -6
  96. data/docs/assets/circle_collisions.png +0 -0
  97. data/docs/favicon.ico +0 -0
@@ -23,13 +23,16 @@ public class FloatList implements Iterable<Float> {
23
23
  int count;
24
24
  float[] data;
25
25
 
26
-
27
- public FloatList() {
26
+ /**
27
+ *
28
+ */
29
+ public FloatList() {
28
30
  data = new float[10];
29
31
  }
30
32
 
31
33
 
32
34
  /**
35
+ * @param length
33
36
  * @nowebref
34
37
  */
35
38
  public FloatList(int length) {
@@ -38,6 +41,7 @@ public class FloatList implements Iterable<Float> {
38
41
 
39
42
 
40
43
  /**
44
+ * @param list
41
45
  * @nowebref
42
46
  */
43
47
  public FloatList(float[] list) {
@@ -48,9 +52,9 @@ public class FloatList implements Iterable<Float> {
48
52
 
49
53
 
50
54
  /**
51
- * Construct an FloatList from an iterable pile of objects.
52
- * For instance, a float array, an array of strings, who knows).
55
+ * Construct an FloatList from an iterable pile of objects.For instance, a float array, an array of strings, who knows).
53
56
  * Un-parseable or null values will be set to NaN.
57
+ * @param iter
54
58
  * @nowebref
55
59
  */
56
60
  public FloatList(Iterable<Object> iter) {
@@ -69,8 +73,8 @@ public class FloatList implements Iterable<Float> {
69
73
 
70
74
 
71
75
  /**
72
- * Construct an FloatList from a random pile of objects.
73
- * Un-parseable or null values will be set to NaN.
76
+ * Construct an FloatList from a random pile of objects.Un-parseable or null values will be set to NaN.
77
+ * @param items
74
78
  */
75
79
  public FloatList(Object... items) {
76
80
  // nuts, no good way to pass missingValue to this fn (varargs must be last)
@@ -109,6 +113,7 @@ public class FloatList implements Iterable<Float> {
109
113
  /**
110
114
  * Get the length of the list.
111
115
  *
116
+ * @return
112
117
  * @webref floatlist:method
113
118
  * @brief Get the length of the list
114
119
  */
@@ -116,8 +121,11 @@ public class FloatList implements Iterable<Float> {
116
121
  return count;
117
122
  }
118
123
 
119
-
120
- public void resize(int length) {
124
+ /**
125
+ *
126
+ * @param length
127
+ */
128
+ public void resize(int length) {
121
129
  if (length > data.length) {
122
130
  float[] temp = new float[length];
123
131
  System.arraycopy(data, 0, temp, 0, count);
@@ -144,6 +152,8 @@ public class FloatList implements Iterable<Float> {
144
152
  /**
145
153
  * Get an entry at a particular index.
146
154
  *
155
+ * @param index
156
+ * @return
147
157
  * @webref floatlist:method
148
158
  * @brief Get an entry at a particular index
149
159
  */
@@ -156,10 +166,12 @@ public class FloatList implements Iterable<Float> {
156
166
 
157
167
 
158
168
  /**
159
- * Set the entry at a particular index. If the index is past the length of
160
- * the list, it'll expand the list to accommodate, and fill the intermediate
161
- * entries with 0s.
169
+ * Set the entry at a particular index.If the index is past the length of
170
+ the list, it'll expand the list to accommodate, and fill the intermediate
171
+ entries with 0s.
162
172
  *
173
+ * @param index
174
+ * @param what
163
175
  * @webref floatlist:method
164
176
  * @brief Set the entry at a particular index
165
177
  */
@@ -175,13 +187,17 @@ public class FloatList implements Iterable<Float> {
175
187
  }
176
188
 
177
189
 
178
- /** Just an alias for append(), but matches pop() */
190
+ /** Just an alias for append(), but matches pop()
191
+ * @param value */
179
192
  public void push(float value) {
180
193
  append(value);
181
194
  }
182
195
 
183
-
184
- public float pop() {
196
+ /**
197
+ *
198
+ * @return
199
+ */
200
+ public float pop() {
185
201
  if (count == 0) {
186
202
  throw new RuntimeException("Can't call pop() on an empty list");
187
203
  }
@@ -194,6 +210,8 @@ public class FloatList implements Iterable<Float> {
194
210
  /**
195
211
  * Remove an element from the specified index.
196
212
  *
213
+ * @param index
214
+ * @return
197
215
  * @webref floatlist:method
198
216
  * @brief Remove an element from the specified index
199
217
  */
@@ -219,6 +237,12 @@ public class FloatList implements Iterable<Float> {
219
237
 
220
238
  // Remove the first instance of a particular value,
221
239
  // and return the index at which it was found.
240
+
241
+ /**
242
+ *
243
+ * @param value
244
+ * @return
245
+ */
222
246
  public int removeValue(int value) {
223
247
  int index = index(value);
224
248
  if (index != -1) {
@@ -231,6 +255,12 @@ public class FloatList implements Iterable<Float> {
231
255
 
232
256
  // Remove all instances of a particular value,
233
257
  // and return the number of values found and removed
258
+
259
+ /**
260
+ *
261
+ * @param value
262
+ * @return
263
+ */
234
264
  public int removeValues(int value) {
235
265
  int ii = 0;
236
266
  if (Float.isNaN(value)) {
@@ -252,7 +282,10 @@ public class FloatList implements Iterable<Float> {
252
282
  }
253
283
 
254
284
 
255
- /** Replace the first instance of a particular value */
285
+ /** Replace the first instance of a particular value
286
+ * @param value
287
+ * @param newValue
288
+ * @return */
256
289
  public boolean replaceValue(float value, float newValue) {
257
290
  if (Float.isNaN(value)) {
258
291
  for (int i = 0; i < count; i++) {
@@ -272,7 +305,10 @@ public class FloatList implements Iterable<Float> {
272
305
  }
273
306
 
274
307
 
275
- /** Replace all instances of a particular value */
308
+ /** Replace all instances of a particular value
309
+ * @param value
310
+ * @param newValue
311
+ * @return */
276
312
  public boolean replaceValues(float value, float newValue) {
277
313
  boolean changed = false;
278
314
  if (Float.isNaN(value)) {
@@ -298,6 +334,7 @@ public class FloatList implements Iterable<Float> {
298
334
  /**
299
335
  * Add a new entry to the list.
300
336
  *
337
+ * @param value
301
338
  * @webref floatlist:method
302
339
  * @brief Add a new entry to the list
303
340
  */
@@ -308,22 +345,29 @@ public class FloatList implements Iterable<Float> {
308
345
  data[count++] = value;
309
346
  }
310
347
 
311
-
312
- public void append(float[] values) {
348
+ /**
349
+ *
350
+ * @param values
351
+ */
352
+ public void append(float[] values) {
313
353
  for (float v : values) {
314
354
  append(v);
315
355
  }
316
356
  }
317
357
 
318
-
319
- public void append(FloatList list) {
358
+ /**
359
+ *
360
+ * @param list
361
+ */
362
+ public void append(FloatList list) {
320
363
  for (float v : list.values()) { // will concat the list...
321
364
  append(v);
322
365
  }
323
366
  }
324
367
 
325
368
 
326
- /** Add this value, but only if it's not already in the list. */
369
+ /** Add this value, but only if it's not already in the list.
370
+ * @param value */
327
371
  public void appendUnique(float value) {
328
372
  if (!hasValue(value)) {
329
373
  append(value);
@@ -360,6 +404,12 @@ public class FloatList implements Iterable<Float> {
360
404
  // }
361
405
  // }
362
406
 
407
+ /**
408
+ *
409
+ * @param index
410
+ * @param value
411
+ */
412
+
363
413
 
364
414
  public void insert(int index, float value) {
365
415
  insert(index, new float[] { value });
@@ -367,6 +417,12 @@ public class FloatList implements Iterable<Float> {
367
417
 
368
418
 
369
419
  // same as splice
420
+
421
+ /**
422
+ *
423
+ * @param index
424
+ * @param values
425
+ */
370
426
  public void insert(int index, float[] values) {
371
427
  if (index < 0) {
372
428
  throw new IllegalArgumentException("insert() index cannot be negative: it was " + index);
@@ -394,8 +450,12 @@ public class FloatList implements Iterable<Float> {
394
450
  data = temp;
395
451
  }
396
452
 
397
-
398
- public void insert(int index, FloatList list) {
453
+ /**
454
+ *
455
+ * @param index
456
+ * @param list
457
+ */
458
+ public void insert(int index, FloatList list) {
399
459
  insert(index, list.values());
400
460
  }
401
461
 
@@ -443,7 +503,9 @@ public class FloatList implements Iterable<Float> {
443
503
  // }
444
504
 
445
505
 
446
- /** Return the first index of a particular value. */
506
+ /** Return the first index of a particular value.
507
+ * @param what
508
+ * @return */
447
509
  public int index(float what) {
448
510
  /*
449
511
  if (indexCache != null) {
@@ -464,6 +526,8 @@ public class FloatList implements Iterable<Float> {
464
526
 
465
527
 
466
528
  /**
529
+ * @param value
530
+ * @return
467
531
  * @webref floatlist:method
468
532
  * @brief Check if a number is a part of the list
469
533
  */
@@ -493,6 +557,8 @@ public class FloatList implements Iterable<Float> {
493
557
 
494
558
 
495
559
  /**
560
+ * @param index
561
+ * @param amount
496
562
  * @webref floatlist:method
497
563
  * @brief Add to a value
498
564
  */
@@ -506,6 +572,8 @@ public class FloatList implements Iterable<Float> {
506
572
 
507
573
 
508
574
  /**
575
+ * @param index
576
+ * @param amount
509
577
  * @webref floatlist:method
510
578
  * @brief Subtract from a value
511
579
  */
@@ -519,6 +587,8 @@ public class FloatList implements Iterable<Float> {
519
587
 
520
588
 
521
589
  /**
590
+ * @param index
591
+ * @param amount
522
592
  * @webref floatlist:method
523
593
  * @brief Multiply a value
524
594
  */
@@ -532,6 +602,8 @@ public class FloatList implements Iterable<Float> {
532
602
 
533
603
 
534
604
  /**
605
+ * @param index
606
+ * @param amount
535
607
  * @webref floatlist:method
536
608
  * @brief Divide a value
537
609
  */
@@ -555,6 +627,7 @@ public class FloatList implements Iterable<Float> {
555
627
 
556
628
 
557
629
  /**
630
+ * @return
558
631
  * @webref floatlist:method
559
632
  * @brief Return the smallest value
560
633
  */
@@ -564,8 +637,11 @@ public class FloatList implements Iterable<Float> {
564
637
  return index == -1 ? Float.NaN : data[index];
565
638
  }
566
639
 
567
-
568
- public int minIndex() {
640
+ /**
641
+ *
642
+ * @return
643
+ */
644
+ public int minIndex() {
569
645
  checkMinMax("minIndex");
570
646
  float m = Float.NaN;
571
647
  int mi = -1;
@@ -591,6 +667,7 @@ public class FloatList implements Iterable<Float> {
591
667
 
592
668
 
593
669
  /**
670
+ * @return
594
671
  * @webref floatlist:method
595
672
  * @brief Return the largest value
596
673
  */
@@ -600,8 +677,11 @@ public class FloatList implements Iterable<Float> {
600
677
  return index == -1 ? Float.NaN : data[index];
601
678
  }
602
679
 
603
-
604
- public int maxIndex() {
680
+ /**
681
+ *
682
+ * @return
683
+ */
684
+ public int maxIndex() {
605
685
  checkMinMax("maxIndex");
606
686
  float m = Float.NaN;
607
687
  int mi = -1;
@@ -625,8 +705,11 @@ public class FloatList implements Iterable<Float> {
625
705
  return mi;
626
706
  }
627
707
 
628
-
629
- public float sum() {
708
+ /**
709
+ *
710
+ * @return
711
+ */
712
+ public float sum() {
630
713
  double amount = sumDouble();
631
714
  if (amount > Float.MAX_VALUE) {
632
715
  throw new RuntimeException("sum() exceeds " + Float.MAX_VALUE + ", use sumDouble()");
@@ -637,8 +720,11 @@ public class FloatList implements Iterable<Float> {
637
720
  return (float) amount;
638
721
  }
639
722
 
640
-
641
- public double sumDouble() {
723
+ /**
724
+ *
725
+ * @return
726
+ */
727
+ public double sumDouble() {
642
728
  double sum = 0;
643
729
  for (int i = 0; i < count; i++) {
644
730
  sum += data[i];
@@ -762,6 +848,7 @@ public class FloatList implements Iterable<Float> {
762
848
  /**
763
849
  * Randomize the list order using the random() function from the specified
764
850
  * sketch, allowing shuffle() to use its current randomSeed() setting.
851
+ * @param sketch
765
852
  */
766
853
  public void shuffle(PApplet sketch) {
767
854
  int num = count;
@@ -774,8 +861,11 @@ public class FloatList implements Iterable<Float> {
774
861
  }
775
862
  }
776
863
 
777
-
778
- public FloatList copy() {
864
+ /**
865
+ *
866
+ * @return
867
+ */
868
+ public FloatList copy() {
779
869
  FloatList outgoing = new FloatList(data);
780
870
  outgoing.count = count;
781
871
  return outgoing;
@@ -783,9 +873,10 @@ public class FloatList implements Iterable<Float> {
783
873
 
784
874
 
785
875
  /**
786
- * Returns the actual array being used to store the data. For advanced users,
787
- * this is the fastest way to access a large list. Suitable for iterating
788
- * with a for() loop, but modifying the list will have terrible consequences.
876
+ * Returns the actual array being used to store the data.For advanced users,
877
+ this is the fastest way to access a large list. Suitable for iterating
878
+ with a for() loop, but modifying the list will have terrible consequences.
879
+ * @return
789
880
  */
790
881
  public float[] values() {
791
882
  crop();
@@ -793,7 +884,8 @@ public class FloatList implements Iterable<Float> {
793
884
  }
794
885
 
795
886
 
796
- /** Implemented this way so that we can use a FloatList in a for loop. */
887
+ /** Implemented this way so that we can use a FloatList in a for loop.
888
+ * @return */
797
889
  @Override
798
890
  public Iterator<Float> iterator() {
799
891
  // }
@@ -831,9 +923,10 @@ public class FloatList implements Iterable<Float> {
831
923
 
832
924
 
833
925
  /**
834
- * Copy values into the specified array. If the specified array is null or
835
- * not the same size, a new array will be allocated.
926
+ * Copy values into the specified array.If the specified array is null or
927
+ not the same size, a new array will be allocated.
836
928
  * @param array
929
+ * @return
837
930
  */
838
931
  public float[] array(float[] array) {
839
932
  if (array == null || array.length != count) {
@@ -845,10 +938,11 @@ public class FloatList implements Iterable<Float> {
845
938
 
846
939
 
847
940
  /**
848
- * Returns a normalized version of this array. Called getPercent() for
849
- * consistency with the Dict classes. It's a getter method because it needs
850
- * to returns a new list (because IntList/Dict can't do percentages or
851
- * normalization in place on int values).
941
+ * Returns a normalized version of this array.Called getPercent() for
942
+ consistency with the Dict classes. It's a getter method because it needs
943
+ to returns a new list (because IntList/Dict can't do percentages or
944
+ normalization in place on int values).
945
+ * @return
852
946
  */
853
947
  public FloatList getPercent() {
854
948
  double sum = 0;
@@ -863,20 +957,33 @@ public class FloatList implements Iterable<Float> {
863
957
  return outgoing;
864
958
  }
865
959
 
866
-
867
- public FloatList getSubset(int start) {
960
+ /**
961
+ *
962
+ * @param start
963
+ * @return
964
+ */
965
+ public FloatList getSubset(int start) {
868
966
  return getSubset(start, count - start);
869
967
  }
870
968
 
871
-
872
- public FloatList getSubset(int start, int num) {
969
+ /**
970
+ *
971
+ * @param start
972
+ * @param num
973
+ * @return
974
+ */
975
+ public FloatList getSubset(int start, int num) {
873
976
  float[] subset = new float[num];
874
977
  System.arraycopy(data, start, subset, 0, num);
875
978
  return new FloatList(subset);
876
979
  }
877
980
 
878
-
879
- public String join(String separator) {
981
+ /**
982
+ *
983
+ * @param separator
984
+ * @return
985
+ */
986
+ public String join(String separator) {
880
987
  if (count == 0) {
881
988
  return "";
882
989
  }
@@ -889,8 +996,10 @@ public class FloatList implements Iterable<Float> {
889
996
  return sb.toString();
890
997
  }
891
998
 
892
-
893
- public void print() {
999
+ /**
1000
+ *
1001
+ */
1002
+ public void print() {
894
1003
  for (int i = 0; i < count; i++) {
895
1004
  System.out.format("[%d] %f%n", i, data[i]);
896
1005
  }
@@ -899,13 +1008,17 @@ public class FloatList implements Iterable<Float> {
899
1008
 
900
1009
  /**
901
1010
  * Return this dictionary as a String in JSON format.
1011
+ * @return
902
1012
  */
903
1013
  public String toJSON() {
904
1014
  return "[ " + join(", ") + " ]";
905
1015
  }
906
1016
 
907
-
908
- @Override
1017
+ /**
1018
+ *
1019
+ * @return
1020
+ */
1021
+ @Override
909
1022
  public String toString() {
910
1023
  return getClass().getSimpleName() + " size=" + size() + " " + toJSON();
911
1024
  }