propane 3.7.1-java → 3.11.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/.mvn/extensions.xml +1 -1
  3. data/.mvn/wrapper/maven-wrapper.properties +1 -1
  4. data/.travis.yml +1 -1
  5. data/CHANGELOG.md +7 -1
  6. data/README.md +8 -15
  7. data/Rakefile +6 -5
  8. data/lib/propane/app.rb +11 -15
  9. data/lib/propane/helper_methods.rb +6 -6
  10. data/lib/propane/version.rb +1 -1
  11. data/lib/{propane-3.7.1.jar → propane-3.11.0.jar} +0 -0
  12. data/library/pdf/itextpdf-5.5.13.2.jar +0 -0
  13. data/library/pdf/pdf.rb +7 -0
  14. data/library/svg/batik-all-1.14.jar +0 -0
  15. data/library/svg/svg.rb +7 -0
  16. data/mvnw +3 -3
  17. data/mvnw.cmd +2 -2
  18. data/pom.rb +32 -5
  19. data/pom.xml +58 -7
  20. data/propane.gemspec +9 -5
  21. data/src/main/java/monkstone/FastNoiseModuleJava.java +127 -0
  22. data/src/main/java/monkstone/MathToolModule.java +30 -30
  23. data/src/main/java/monkstone/PropaneLibrary.java +2 -0
  24. data/src/main/java/monkstone/SmoothNoiseModuleJava.java +127 -0
  25. data/src/main/java/monkstone/fastmath/DegLutTables.java +111 -0
  26. data/src/main/java/monkstone/fastmath/Deglut.java +6 -56
  27. data/src/main/java/monkstone/filechooser/Chooser.java +1 -1
  28. data/src/main/java/monkstone/noise/OpenSimplex2F.java +914 -0
  29. data/src/main/java/monkstone/noise/OpenSimplex2S.java +1138 -0
  30. data/src/main/java/monkstone/slider/WheelHandler.java +1 -1
  31. data/src/main/java/monkstone/vecmath/JRender.java +6 -6
  32. data/src/main/java/monkstone/vecmath/vec2/Vec2.java +27 -31
  33. data/src/main/java/monkstone/vecmath/vec3/Vec3.java +26 -40
  34. data/src/main/java/processing/awt/PGraphicsJava2D.java +11 -3
  35. data/src/main/java/processing/awt/PImageAWT.java +6 -4
  36. data/src/main/java/processing/core/PApplet.java +13259 -13379
  37. data/src/main/java/processing/core/PConstants.java +155 -163
  38. data/src/main/java/processing/core/PGraphics.java +118 -111
  39. data/src/main/java/processing/core/PImage.java +14 -14
  40. data/src/main/java/processing/opengl/PGraphicsOpenGL.java +13 -13
  41. data/src/main/java/processing/opengl/PJOGL.java +6 -5
  42. data/src/main/java/processing/opengl/PShader.java +1 -6
  43. data/src/main/java/processing/opengl/PSurfaceJOGL.java +6 -6
  44. data/src/main/java/processing/pdf/PGraphicsPDF.java +581 -0
  45. data/src/main/java/processing/svg/PGraphicsSVG.java +378 -0
  46. data/src/main/{java/processing/opengl → resources}/cursors/arrow.png +0 -0
  47. data/src/main/{java/processing/opengl → resources}/cursors/cross.png +0 -0
  48. data/src/main/{java/processing/opengl → resources}/cursors/hand.png +0 -0
  49. data/src/main/{java/processing/opengl → resources}/cursors/license.txt +0 -0
  50. data/src/main/{java/processing/opengl → resources}/cursors/move.png +0 -0
  51. data/src/main/{java/processing/opengl → resources}/cursors/text.png +0 -0
  52. data/src/main/{java/processing/opengl → resources}/cursors/wait.png +0 -0
  53. data/src/main/{java/processing/opengl → resources}/shaders/ColorFrag.glsl +0 -0
  54. data/src/main/{java/processing/opengl → resources}/shaders/ColorVert.glsl +0 -0
  55. data/src/main/{java/processing/opengl → resources}/shaders/LightFrag.glsl +0 -0
  56. data/src/main/{java/processing/opengl → resources}/shaders/LightVert.glsl +0 -0
  57. data/src/main/{java/processing/opengl → resources}/shaders/LineFrag.glsl +0 -0
  58. data/src/main/{java/processing/opengl → resources}/shaders/LineVert.glsl +0 -0
  59. data/src/main/{java/processing/opengl → resources}/shaders/MaskFrag.glsl +0 -0
  60. data/src/main/{java/processing/opengl → resources}/shaders/PointFrag.glsl +0 -0
  61. data/src/main/{java/processing/opengl → resources}/shaders/PointVert.glsl +0 -0
  62. data/src/main/{java/processing/opengl → resources}/shaders/TexFrag.glsl +0 -0
  63. data/src/main/{java/processing/opengl → resources}/shaders/TexLightFrag.glsl +0 -0
  64. data/src/main/{java/processing/opengl → resources}/shaders/TexLightVert.glsl +0 -0
  65. data/src/main/{java/processing/opengl → resources}/shaders/TexVert.glsl +0 -0
  66. data/test/deglut_spec_test.rb +2 -2
  67. data/test/test_helper.rb +1 -0
  68. data/vendors/Rakefile +1 -1
  69. metadata +49 -46
  70. data/library/simplex_noise/simplex_noise.rb +0 -5
  71. data/src/main/java/monkstone/noise/SimplexNoise.java +0 -436
@@ -31,5 +31,5 @@ public interface WheelHandler {
31
31
  *
32
32
  * @param amount int
33
33
  */
34
- public void handleWheel(final short amount);
34
+ void handleWheel(final short amount);
35
35
  }
@@ -11,14 +11,14 @@ public interface JRender {
11
11
  * @param x double
12
12
  * @param y double
13
13
  */
14
- public void vertex(double x, double y);
14
+ void vertex(double x, double y);
15
15
 
16
16
  /**
17
17
  *
18
18
  * @param x double
19
19
  * @param y double
20
20
  */
21
- public void curveVertex(double x, double y);
21
+ void curveVertex(double x, double y);
22
22
 
23
23
  /**
24
24
  *
@@ -26,7 +26,7 @@ public interface JRender {
26
26
  * @param y double
27
27
  * @param z double
28
28
  */
29
- public void vertex(double x, double y, double z);
29
+ void vertex(double x, double y, double z);
30
30
 
31
31
  /**
32
32
  *
@@ -36,7 +36,7 @@ public interface JRender {
36
36
  * @param u double
37
37
  * @param v double
38
38
  */
39
- public void vertex(double x, double y, double z, double u, double v);
39
+ void vertex(double x, double y, double z, double u, double v);
40
40
 
41
41
  /**
42
42
  *
@@ -44,7 +44,7 @@ public interface JRender {
44
44
  * @param y double
45
45
  * @param z double
46
46
  */
47
- public void curveVertex(double x, double y, double z);
47
+ void curveVertex(double x, double y, double z);
48
48
 
49
49
  /**
50
50
  *
@@ -52,5 +52,5 @@ public interface JRender {
52
52
  * @param y double
53
53
  * @param z double
54
54
  */
55
- public void normal(double x, double y, double z);
55
+ void normal(double x, double y, double z);
56
56
  }
@@ -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;
@@ -73,7 +73,7 @@ public class Vec2 extends RubyObject {
73
73
  * @return new Vec2 object (ruby)
74
74
  */
75
75
  @JRubyMethod(name = "new", meta = true, rest = true)
76
- public static final IRubyObject rbNew(ThreadContext context, IRubyObject klazz, IRubyObject... args) {
76
+ public static IRubyObject rbNew(ThreadContext context, IRubyObject klazz, IRubyObject... args) {
77
77
  Vec2 vec2 = (Vec2) ((RubyClass) klazz).allocate();
78
78
  vec2.init(context, args);
79
79
  return vec2;
@@ -91,16 +91,16 @@ public class Vec2 extends RubyObject {
91
91
  void init(ThreadContext context, IRubyObject... args) {
92
92
  int count = args.length;
93
93
  if (count == 2) {
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();
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();
96
96
  } // allow ruby ducktyping in constructor
97
97
  if (count == 1) {
98
98
  if (!(args[0].respondsTo("x"))) {
99
99
  throw context.runtime.newTypeError(args[0].getType() + " doesn't respond_to :x & :y");
100
100
  }
101
- jx = ((args[0].callMethod(context, "x")) instanceof RubyFloat)
101
+ jx = args[0].callMethod(context, "x") instanceof RubyFloat
102
102
  ? ((RubyFloat) args[0].callMethod(context, "x")).getValue() : ((RubyFixnum) args[0].callMethod(context, "x")).getDoubleValue();
103
- jy = ((args[0].callMethod(context, "y")) instanceof RubyFloat)
103
+ jy = args[0].callMethod(context, "y") instanceof RubyFloat
104
104
  ? ((RubyFloat) args[0].callMethod(context, "y")).getValue() : ((RubyFixnum) args[0].callMethod(context, "y")).getDoubleValue();
105
105
  }
106
106
  }
@@ -162,10 +162,10 @@ public class Vec2 extends RubyObject {
162
162
  Ruby runtime = context.runtime;
163
163
  if (key instanceof RubySymbol) {
164
164
  if (key == RubySymbol.newSymbol(runtime, "x")) {
165
- jx = (value instanceof RubyFloat)
165
+ jx = value instanceof RubyFloat
166
166
  ? ((RubyFloat) value).getValue() : ((RubyFixnum) value).getDoubleValue();
167
167
  } else if (key == RubySymbol.newSymbol(runtime, "y")) {
168
- jy = (value instanceof RubyFloat)
168
+ jy = value instanceof RubyFloat
169
169
  ? ((RubyFloat) value).getValue() : ((RubyFixnum) value).getDoubleValue();
170
170
  }
171
171
  } else {
@@ -224,7 +224,7 @@ public class Vec2 extends RubyObject {
224
224
  } else {
225
225
  throw runtime.newTypeError("argument should be Vec2D");
226
226
  }
227
- double result = Math.hypot((jx - b.jx), (jy - b.jy));
227
+ double result = Math.hypot(jx - b.jx, jy - b.jy);
228
228
  return runtime.newFloat(result);
229
229
  }
230
230
 
@@ -318,7 +318,7 @@ public class Vec2 extends RubyObject {
318
318
 
319
319
  public IRubyObject op_mul(ThreadContext context, IRubyObject other) {
320
320
  Ruby runtime = context.runtime;
321
- double scalar = (other instanceof RubyFloat)
321
+ double scalar = other instanceof RubyFloat
322
322
  ? ((RubyFloat) other).getValue() : ((RubyFixnum) other).getDoubleValue();
323
323
  return Vec2.rbNew(context, this.getMetaClass(),
324
324
  new IRubyObject[]{runtime.newFloat(jx * scalar),
@@ -335,7 +335,7 @@ public class Vec2 extends RubyObject {
335
335
 
336
336
  public IRubyObject op_div(ThreadContext context, IRubyObject other) {
337
337
  Ruby runtime = context.runtime;
338
- double scalar = (other instanceof RubyFloat)
338
+ double scalar = other instanceof RubyFloat
339
339
  ? ((RubyFloat) other).getValue() : ((RubyFixnum) other).getDoubleValue();
340
340
  if (Math.abs(scalar) < Vec2.EPSILON) {
341
341
  return this;
@@ -400,10 +400,8 @@ public class Vec2 extends RubyObject {
400
400
 
401
401
  public IRubyObject set_mag(ThreadContext context, IRubyObject scalar, Block block) {
402
402
  double new_mag = scalar.toJava(Double.class);
403
- if (block.isGiven()) {
404
- if (!(boolean) block.yield(context, scalar).toJava(Boolean.class)) {
405
- return this;
406
- }
403
+ if (block.isGiven() && !block.yield(context, scalar).toJava(Boolean.class)) {
404
+ return this;
407
405
  }
408
406
  double current = 0;
409
407
  if (Math.abs(jx) > EPSILON && Math.abs(jy) > EPSILON) {
@@ -489,7 +487,7 @@ public class Vec2 extends RubyObject {
489
487
  @JRubyMethod(name = "from_angle", meta = true)
490
488
  public static IRubyObject from_angle(ThreadContext context, IRubyObject klazz, IRubyObject scalar) {
491
489
  Ruby runtime = context.runtime;
492
- double angle = (scalar instanceof RubyFloat)
490
+ double angle = scalar instanceof RubyFloat
493
491
  ? ((RubyFloat) scalar).getValue() : ((RubyFixnum) scalar).getDoubleValue();
494
492
  return Vec2.rbNew(context, klazz, new IRubyObject[]{
495
493
  runtime.newFloat(Math.cos(angle)),
@@ -520,10 +518,10 @@ public class Vec2 extends RubyObject {
520
518
  */
521
519
  @JRubyMethod(name = "rotate!")
522
520
  public IRubyObject rotate_bang(ThreadContext context, IRubyObject scalar) {
523
- double theta = (scalar instanceof RubyFloat)
521
+ double theta = scalar instanceof RubyFloat
524
522
  ? ((RubyFloat) scalar).getValue() : ((RubyFixnum) scalar).getDoubleValue();
525
- double x = (jx * Math.cos(theta) - jy * Math.sin(theta));
526
- 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);
527
525
  jx = x;
528
526
  jy = y;
529
527
  return this;
@@ -538,7 +536,7 @@ public class Vec2 extends RubyObject {
538
536
  @JRubyMethod(name = "rotate")
539
537
  public IRubyObject rotate(ThreadContext context, IRubyObject scalar) {
540
538
  Ruby runtime = context.runtime;
541
- double theta = (scalar instanceof RubyFloat)
539
+ double theta = scalar instanceof RubyFloat
542
540
  ? ((RubyFloat) scalar).getValue() : ((RubyFixnum) scalar).getDoubleValue();
543
541
  IRubyObject[] ary = new IRubyObject[]{
544
542
  runtime.newFloat(jx * Math.cos(theta) - jy * Math.sin(theta)),
@@ -559,9 +557,9 @@ public class Vec2 extends RubyObject {
559
557
  throw runtime.newSyntaxError("Check syntax");
560
558
  }
561
559
  Vec2 vec = (Vec2) args[0].toJava(Vec2.class);
562
- double scalar = (args[1] instanceof RubyFloat)
560
+ double scalar = args[1] instanceof RubyFloat
563
561
  ? ((RubyFloat) args[1]).getValue() : ((RubyFixnum) args[1]).getDoubleValue();
564
- assert (scalar >= 0 && scalar < 1.0) :
562
+ assert scalar >= 0 && scalar < 1.0 :
565
563
  "Lerp value " + scalar + " out of range 0..1.0";
566
564
  return Vec2.rbNew(context, this.getMetaClass(), new IRubyObject[]{
567
565
  runtime.newFloat(jx + (vec.jx - jx) * scalar),
@@ -581,9 +579,9 @@ public class Vec2 extends RubyObject {
581
579
  throw runtime.newSyntaxError("Check syntax");
582
580
  }
583
581
  Vec2 vec = (Vec2) args[0].toJava(Vec2.class);
584
- double scalar = (args[1] instanceof RubyFloat)
582
+ double scalar = args[1] instanceof RubyFloat
585
583
  ? ((RubyFloat) args[1]).getValue() : ((RubyFixnum) args[1]).getDoubleValue();
586
- assert (scalar >= 0 && scalar < 1.0) :
584
+ assert scalar >= 0 && scalar < 1.0 :
587
585
  "Lerp value " + scalar + " out of range 0..1.0";
588
586
  jx += (vec.jx - jx) * scalar;
589
587
  jy += (vec.jy - jy) * scalar;
@@ -744,10 +742,8 @@ public class Vec2 extends RubyObject {
744
742
  }
745
743
  if (obj instanceof Vec2) {
746
744
  final Vec2 other = (Vec2) obj;
747
- if ((Double.compare(jx, (Double) other.jx) == 0)
748
- && (Double.compare(jy, (Double) other.jy) == 0)) {
749
- return true;
750
- }
745
+ return Double.compare(jx, (Double) other.jx) == 0
746
+ && Double.compare(jy, (Double) other.jy) == 0;
751
747
  }
752
748
  return false;
753
749
  }
@@ -766,8 +762,8 @@ public class Vec2 extends RubyObject {
766
762
  }
767
763
  if (other instanceof Vec2) {
768
764
  Vec2 v = (Vec2) other.toJava(Vec2.class);
769
- if ((Double.compare(jx, (Double) v.jx) == 0)
770
- && (Double.compare(jy, (Double) v.jy) == 0)) {
765
+ if (Double.compare(jx, (Double) v.jx) == 0
766
+ && Double.compare(jy, (Double) v.jy) == 0) {
771
767
  return runtime.newBoolean(true);
772
768
  }
773
769
  }
@@ -793,7 +789,7 @@ public class Vec2 extends RubyObject {
793
789
  double diff = jx - v.jx;
794
790
  if ((diff < 0 ? -diff : diff) > Vec2.EPSILON) {
795
791
  return runtime.newBoolean(false);
796
- }
792
+ }
797
793
  diff = jy - v.jy;
798
794
  return runtime.newBoolean((diff < 0 ? -diff : diff) < Vec2.EPSILON);
799
795
  }
@@ -65,7 +65,7 @@ public final class Vec3 extends RubyObject {
65
65
  * @return new Vec3 object (ruby)
66
66
  */
67
67
  @JRubyMethod(name = "new", meta = true, rest = true)
68
- public final static IRubyObject rbNew(ThreadContext context, IRubyObject klazz, IRubyObject... args) {
68
+ public static IRubyObject rbNew(ThreadContext context, IRubyObject klazz, IRubyObject... args) {
69
69
  Vec3 vec = (Vec3) ((RubyClass) klazz).allocate();
70
70
  vec.init(context, args);
71
71
  return vec;
@@ -83,27 +83,27 @@ public final class Vec3 extends RubyObject {
83
83
  void init(ThreadContext context, IRubyObject... args) {
84
84
  int count = args.length;
85
85
  if (count >= 2) {
86
- jx = (args[0] instanceof RubyFloat)
86
+ jx = args[0] instanceof RubyFloat
87
87
  ? ((RubyFloat) args[0]).getValue() : ((RubyFixnum) args[0]).getDoubleValue();
88
- jy = (args[1] instanceof RubyFloat)
88
+ jy = args[1] instanceof RubyFloat
89
89
  ? ((RubyFloat) args[1]).getValue() : ((RubyFixnum) args[1]).getDoubleValue();
90
90
  }
91
91
  if (count == 3) {
92
- jz = (args[2] instanceof RubyFloat)
92
+ jz = args[2] instanceof RubyFloat
93
93
  ? ((RubyFloat) args[2]).getValue() : ((RubyFixnum) args[2]).getDoubleValue();
94
94
  } // allow ruby ducktyping in constructor
95
95
  if (count == 1) {
96
96
  if (!(args[0].respondsTo("x"))) {
97
97
  throw context.runtime.newTypeError(args[0].getType() + " doesn't respond_to :x & :y");
98
98
  }
99
- jx = ((args[0].callMethod(context, "x")) instanceof RubyFloat)
99
+ jx = (args[0].callMethod(context, "x")) instanceof RubyFloat
100
100
  ? ((RubyFloat) args[0].callMethod(context, "x")).getValue() : ((RubyFixnum) args[0].callMethod(context, "x")).getDoubleValue();
101
- jy = ((args[0].callMethod(context, "y")) instanceof RubyFloat)
101
+ jy = (args[0].callMethod(context, "y")) instanceof RubyFloat
102
102
  ? ((RubyFloat) args[0].callMethod(context, "y")).getValue() : ((RubyFixnum) args[0].callMethod(context, "y")).getDoubleValue();
103
103
  if (!(args[0].respondsTo("z"))) {
104
104
  return;
105
105
  } // allow promotion from 2D to 3D, sets jz = 0
106
- 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();
107
107
  }
108
108
  }
109
109
 
@@ -147,11 +147,7 @@ public final class Vec3 extends RubyObject {
147
147
  */
148
148
  @JRubyMethod(name = "x=")
149
149
  public IRubyObject setX(ThreadContext context, IRubyObject other) {
150
- if (other instanceof RubyFloat) {
151
- jx = ((RubyFloat) other).getValue();
152
- } else {
153
- jx = ((RubyFixnum) other).getDoubleValue();
154
- }
150
+ jx = other instanceof RubyFloat ? ((RubyFloat) other).getValue() : ((RubyFixnum) other).getDoubleValue();
155
151
  return other;
156
152
  }
157
153
 
@@ -163,11 +159,7 @@ public final class Vec3 extends RubyObject {
163
159
  */
164
160
  @JRubyMethod(name = "y=")
165
161
  public IRubyObject setY(ThreadContext context, IRubyObject other) {
166
- if (other instanceof RubyFloat) {
167
- jy = ((RubyFloat) other).getValue();
168
- } else {
169
- jy = ((RubyFixnum) other).getDoubleValue();
170
- }
162
+ jy = other instanceof RubyFloat ? ((RubyFloat) other).getValue() : ((RubyFixnum) other).getDoubleValue();
171
163
  return other;
172
164
  }
173
165
 
@@ -179,11 +171,7 @@ public final class Vec3 extends RubyObject {
179
171
  */
180
172
  @JRubyMethod(name = "z=")
181
173
  public IRubyObject setZ(ThreadContext context, IRubyObject other) {
182
- if (other instanceof RubyFloat) {
183
- jz = ((RubyFloat) other).getValue();
184
- } else {
185
- jz = ((RubyFixnum) other).getDoubleValue();
186
- }
174
+ jz = other instanceof RubyFloat ? ((RubyFloat) other).getValue() : ((RubyFixnum) other).getDoubleValue();
187
175
  return other;
188
176
  }
189
177
 
@@ -222,13 +210,13 @@ public final class Vec3 extends RubyObject {
222
210
  Ruby runtime = context.runtime;
223
211
  if (key instanceof RubySymbol) {
224
212
  if (key == RubySymbol.newSymbol(runtime, "x")) {
225
- jx = (value instanceof RubyFloat)
213
+ jx = value instanceof RubyFloat
226
214
  ? ((RubyFloat) value).getValue() : ((RubyFixnum) value).getDoubleValue();
227
215
  } else if (key == RubySymbol.newSymbol(runtime, "y")) {
228
- jy = (value instanceof RubyFloat)
216
+ jy = value instanceof RubyFloat
229
217
  ? ((RubyFloat) value).getValue() : ((RubyFixnum) value).getDoubleValue();
230
218
  } else if (key == RubySymbol.newSymbol(runtime, "z")) {
231
- jz = (value instanceof RubyFloat)
219
+ jz = value instanceof RubyFloat
232
220
  ? ((RubyFloat) value).getValue() : ((RubyFixnum) value).getDoubleValue();
233
221
  } else {
234
222
  throw runtime.newIndexError("invalid key");
@@ -368,7 +356,7 @@ public final class Vec3 extends RubyObject {
368
356
  @JRubyMethod(name = "*", required = 1)
369
357
  public IRubyObject op_mul(ThreadContext context, IRubyObject scalar) {
370
358
  Ruby runtime = context.runtime;
371
- double multi = (scalar instanceof RubyFloat)
359
+ double multi = scalar instanceof RubyFloat
372
360
  ? ((RubyFloat) scalar).getValue() : ((RubyFixnum) scalar).getDoubleValue();
373
361
  return Vec3.rbNew(context, this.getMetaClass(), new IRubyObject[]{
374
362
  runtime.newFloat(jx * multi),
@@ -385,7 +373,7 @@ public final class Vec3 extends RubyObject {
385
373
  @JRubyMethod(name = "/", required = 1)
386
374
  public IRubyObject op_div(ThreadContext context, IRubyObject scalar) {
387
375
  Ruby runtime = context.runtime;
388
- double divisor = (scalar instanceof RubyFloat)
376
+ double divisor = scalar instanceof RubyFloat
389
377
  ? ((RubyFloat) scalar).getValue() : ((RubyFixnum) scalar).getDoubleValue();
390
378
  if (Math.abs(divisor) < Vec3.EPSILON) {
391
379
  return this;
@@ -427,12 +415,10 @@ public final class Vec3 extends RubyObject {
427
415
  */
428
416
  @JRubyMethod(name = "set_mag")
429
417
  public IRubyObject set_mag(ThreadContext context, IRubyObject scalar, Block block) {
430
- if (block.isGiven()) {
431
- if (!(boolean) block.yield(context, scalar).toJava(Boolean.class)) {
432
- return this;
433
- }
418
+ if (block.isGiven() && !block.yield(context, scalar).toJava(Boolean.class)) {
419
+ return this;
434
420
  }
435
- double new_mag = (scalar instanceof RubyFloat)
421
+ double new_mag = scalar instanceof RubyFloat
436
422
  ? ((RubyFloat) scalar).getValue() : ((RubyFixnum) scalar).getDoubleValue();
437
423
  double current = Math.sqrt(jx * jx + jy * jy + jz * jz);
438
424
  if (current > EPSILON) {
@@ -598,9 +584,9 @@ public final class Vec3 extends RubyObject {
598
584
  double u = 0;
599
585
  double v = 0;
600
586
  if (count == 3) {
601
- u = (args[1] instanceof RubyFloat)
587
+ u = args[1] instanceof RubyFloat
602
588
  ? ((RubyFloat) args[1]).getValue() : ((RubyFixnum) args[1]).getDoubleValue();
603
- v = (args[2] instanceof RubyFloat)
589
+ v = args[2] instanceof RubyFloat
604
590
  ? ((RubyFloat) args[2]).getValue() : ((RubyFixnum) args[2]).getDoubleValue();
605
591
  }
606
592
  if (count == 2) {
@@ -662,9 +648,9 @@ public final class Vec3 extends RubyObject {
662
648
  }
663
649
  if (obj instanceof Vec3) {
664
650
  final Vec3 other = (Vec3) obj;
665
- if ((Double.compare(jx, (Double) other.jx) == 0)
666
- && (Double.compare(jy, (Double) other.jy) == 0)
667
- && (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) {
668
654
  return true;
669
655
  }
670
656
 
@@ -686,9 +672,9 @@ public final class Vec3 extends RubyObject {
686
672
  }
687
673
  if (other instanceof Vec3) {
688
674
  Vec3 v = (Vec3) other.toJava(Vec3.class);
689
- if ((Double.compare(jx, (Double) v.jx) == 0)
690
- && (Double.compare(jy, (Double) v.jy) == 0)
691
- && (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) {
692
678
  return runtime.newBoolean(true);
693
679
  }
694
680
 
@@ -1564,6 +1564,15 @@ public class PGraphicsJava2D extends PGraphics {
1564
1564
 
1565
1565
  /**
1566
1566
  * Handle renderer-specific image drawing.
1567
+ * @param who
1568
+ * @param x1
1569
+ * @param y1
1570
+ * @param x2
1571
+ * @param y2
1572
+ * @param u1
1573
+ * @param v1
1574
+ * @param u2
1575
+ * @param v2
1567
1576
  */
1568
1577
  @Override
1569
1578
  protected void imageImpl(PImage who,
@@ -2575,7 +2584,7 @@ public class PGraphicsJava2D extends PGraphics {
2575
2584
  // WritableRaster raster = ((BufferedImage) image).getRaster();
2576
2585
  // WritableRaster raster = image.getRaster();
2577
2586
  WritableRaster raster = getRaster();
2578
- if ((clearPixels == null) || (clearPixels.length < imageWidth)) {
2587
+ if (clearPixels == null || clearPixels.length < imageWidth) {
2579
2588
  clearPixels = new int[imageWidth];
2580
2589
  }
2581
2590
  Arrays.fill(clearPixels, 0, imageWidth, backgroundColor);
@@ -2595,7 +2604,6 @@ public class PGraphicsJava2D extends PGraphics {
2595
2604
  public void backgroundImpl() {
2596
2605
  if (backgroundAlpha) {
2597
2606
  clearPixels(backgroundColor);
2598
-
2599
2607
  } else {
2600
2608
  Color bgColor = new Color(backgroundColor);
2601
2609
  // seems to fire an additional event that causes flickering,
@@ -2798,7 +2806,7 @@ public class PGraphicsJava2D extends PGraphics {
2798
2806
  public void updatePixels(int x, int y, int c, int d) {
2799
2807
  //if ((x == 0) && (y == 0) && (c == width) && (d == height)) {
2800
2808
  // System.err.format("%d %d %d %d .. w/h = %d %d .. pw/ph = %d %d %n", x, y, c, d, width, height, pixelWidth, pixelHeight);
2801
- if ((x != 0) || (y != 0) || (c != pixelWidth) || (d != pixelHeight)) {
2809
+ if (x != 0 || y != 0 || c != pixelWidth || d != pixelHeight) {
2802
2810
  // Show a warning message, but continue anyway.
2803
2811
  showVariationWarning("updatePixels(x, y, w, h)");
2804
2812
  // new Exception().printStackTrace(System.out);
@@ -118,6 +118,7 @@ public class PImageAWT extends PImage {
118
118
 
119
119
  /**
120
120
  * Returns a native BufferedImage from this PImage.
121
+ * @return
121
122
  */
122
123
  @Override
123
124
  public Object getNative() { // ignore
@@ -259,11 +260,12 @@ public class PImageAWT extends PImage {
259
260
 
260
261
 
261
262
  /**
262
- * Use ImageIO functions from Java 1.4 and later to handle image save.
263
- * Various formats are supported, typically jpeg, png, bmp, and wbmp.
264
- * To get a list of the supported formats for writing, use: <BR>
265
- * <TT>println(javax.imageio.ImageIO.getReaderFormatNames())</TT>
263
+ * Use ImageIO functions from Java 1.4 and later to handle image save.Various formats are supported, typically jpeg, png, bmp, and wbmp.To get a list of the supported formats for writing, use: <BR>
264
+ <code>println(javax.imageio.ImageIO.getReaderFormatNames())</code>
266
265
  *
266
+ * @param path
267
+ * @return
268
+ * @throws java.io.IOException
267
269
  * @path The path to which the file should be written.
268
270
  */
269
271
  protected boolean saveImageIO(String path) throws IOException {