propane 3.10.0-java → 3.11.0-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.mvn/wrapper/maven-wrapper.properties +1 -1
- data/CHANGELOG.md +2 -0
- data/README.md +7 -7
- data/lib/propane/app.rb +2 -5
- data/lib/propane/helper_methods.rb +6 -6
- data/lib/propane/version.rb +1 -1
- data/lib/{propane-3.10.0.jar → propane-3.11.0.jar} +0 -0
- data/pom.rb +6 -6
- data/pom.xml +6 -6
- data/propane.gemspec +3 -3
- data/src/main/java/monkstone/noise/OpenSimplex2F.java +838 -737
- data/src/main/java/monkstone/vecmath/vec2/Vec2.java +8 -13
- data/src/main/java/monkstone/vecmath/vec3/Vec3.java +14 -28
- data/src/main/java/processing/awt/PImageAWT.java +6 -4
- data/src/main/java/processing/core/PApplet.java +71 -59
- data/src/main/java/processing/core/PImage.java +14 -14
- data/src/main/java/processing/opengl/PGraphicsOpenGL.java +13 -13
- data/src/main/java/processing/opengl/PShader.java +1 -6
- data/src/main/java/processing/opengl/PSurfaceJOGL.java +6 -6
- data/{lib/java/processing/opengl → src/main/resources}/cursors/arrow.png +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/cursors/cross.png +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/cursors/hand.png +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/cursors/license.txt +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/cursors/move.png +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/cursors/text.png +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/cursors/wait.png +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/ColorFrag.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/ColorVert.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/LightFrag.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/LightVert.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/LineFrag.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/LineVert.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/MaskFrag.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/PointFrag.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/PointVert.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/TexFrag.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/TexLightFrag.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/TexLightVert.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/TexVert.glsl +0 -0
- data/test/test_helper.rb +1 -0
- data/vendors/Rakefile +1 -1
- metadata +29 -155
- data/lib/java/japplemenubar/JAppleMenuBar.java +0 -88
- data/lib/java/japplemenubar/libjAppleMenuBar.jnilib +0 -0
- data/lib/java/monkstone/ColorUtil.java +0 -127
- data/lib/java/monkstone/MathToolModule.java +0 -287
- data/lib/java/monkstone/PropaneLibrary.java +0 -46
- data/lib/java/monkstone/core/LibraryProxy.java +0 -136
- data/lib/java/monkstone/fastmath/DegLutTables.java +0 -111
- data/lib/java/monkstone/fastmath/Deglut.java +0 -71
- data/lib/java/monkstone/fastmath/package-info.java +0 -6
- data/lib/java/monkstone/filechooser/Chooser.java +0 -39
- data/lib/java/monkstone/noise/FastTerrain.java +0 -874
- data/lib/java/monkstone/noise/Noise.java +0 -90
- data/lib/java/monkstone/noise/NoiseGenerator.java +0 -75
- data/lib/java/monkstone/noise/NoiseMode.java +0 -28
- data/lib/java/monkstone/noise/OpenSimplex2F.java +0 -881
- data/lib/java/monkstone/noise/OpenSimplex2S.java +0 -1106
- data/lib/java/monkstone/noise/SmoothTerrain.java +0 -1099
- data/lib/java/monkstone/slider/CustomHorizontalSlider.java +0 -164
- data/lib/java/monkstone/slider/CustomVerticalSlider.java +0 -178
- data/lib/java/monkstone/slider/SimpleHorizontalSlider.java +0 -145
- data/lib/java/monkstone/slider/SimpleSlider.java +0 -166
- data/lib/java/monkstone/slider/SimpleVerticalSlider.java +0 -157
- data/lib/java/monkstone/slider/Slider.java +0 -61
- data/lib/java/monkstone/slider/SliderBar.java +0 -245
- data/lib/java/monkstone/slider/SliderGroup.java +0 -56
- data/lib/java/monkstone/slider/WheelHandler.java +0 -35
- data/lib/java/monkstone/vecmath/GfxRender.java +0 -86
- data/lib/java/monkstone/vecmath/JRender.java +0 -56
- data/lib/java/monkstone/vecmath/ShapeRender.java +0 -87
- data/lib/java/monkstone/vecmath/package-info.java +0 -20
- data/lib/java/monkstone/vecmath/vec2/Vec2.java +0 -802
- data/lib/java/monkstone/vecmath/vec2/package-info.java +0 -6
- data/lib/java/monkstone/vecmath/vec3/Vec3.java +0 -727
- data/lib/java/monkstone/vecmath/vec3/package-info.java +0 -6
- data/lib/java/monkstone/videoevent/CaptureEvent.java +0 -27
- data/lib/java/monkstone/videoevent/MovieEvent.java +0 -32
- data/lib/java/monkstone/videoevent/package-info.java +0 -20
- data/lib/java/processing/awt/PGraphicsJava2D.java +0 -3040
- data/lib/java/processing/awt/PImageAWT.java +0 -377
- data/lib/java/processing/awt/PShapeJava2D.java +0 -387
- data/lib/java/processing/awt/PSurfaceAWT.java +0 -1581
- data/lib/java/processing/awt/ShimAWT.java +0 -581
- data/lib/java/processing/core/PApplet.java +0 -15156
- data/lib/java/processing/core/PConstants.java +0 -523
- data/lib/java/processing/core/PFont.java +0 -1126
- data/lib/java/processing/core/PGraphics.java +0 -8600
- data/lib/java/processing/core/PImage.java +0 -3377
- data/lib/java/processing/core/PMatrix.java +0 -208
- data/lib/java/processing/core/PMatrix2D.java +0 -562
- data/lib/java/processing/core/PMatrix3D.java +0 -890
- data/lib/java/processing/core/PShape.java +0 -3561
- data/lib/java/processing/core/PShapeOBJ.java +0 -483
- data/lib/java/processing/core/PShapeSVG.java +0 -2016
- data/lib/java/processing/core/PStyle.java +0 -63
- data/lib/java/processing/core/PSurface.java +0 -198
- data/lib/java/processing/core/PSurfaceNone.java +0 -431
- data/lib/java/processing/core/PVector.java +0 -1066
- data/lib/java/processing/core/ThinkDifferent.java +0 -115
- data/lib/java/processing/data/DoubleDict.java +0 -850
- data/lib/java/processing/data/DoubleList.java +0 -928
- data/lib/java/processing/data/FloatDict.java +0 -847
- data/lib/java/processing/data/FloatList.java +0 -936
- data/lib/java/processing/data/IntDict.java +0 -807
- data/lib/java/processing/data/IntList.java +0 -936
- data/lib/java/processing/data/JSONArray.java +0 -1260
- data/lib/java/processing/data/JSONObject.java +0 -2282
- data/lib/java/processing/data/JSONTokener.java +0 -435
- data/lib/java/processing/data/LongDict.java +0 -802
- data/lib/java/processing/data/LongList.java +0 -937
- data/lib/java/processing/data/Sort.java +0 -46
- data/lib/java/processing/data/StringDict.java +0 -613
- data/lib/java/processing/data/StringList.java +0 -800
- data/lib/java/processing/data/Table.java +0 -4936
- data/lib/java/processing/data/TableRow.java +0 -198
- data/lib/java/processing/data/XML.java +0 -1156
- data/lib/java/processing/dxf/RawDXF.java +0 -404
- data/lib/java/processing/event/Event.java +0 -125
- data/lib/java/processing/event/KeyEvent.java +0 -70
- data/lib/java/processing/event/MouseEvent.java +0 -114
- data/lib/java/processing/event/TouchEvent.java +0 -57
- data/lib/java/processing/javafx/PGraphicsFX2D.java +0 -32
- data/lib/java/processing/javafx/PSurfaceFX.java +0 -173
- data/lib/java/processing/net/Client.java +0 -744
- data/lib/java/processing/net/Server.java +0 -388
- data/lib/java/processing/opengl/FontTexture.java +0 -378
- data/lib/java/processing/opengl/FrameBuffer.java +0 -513
- data/lib/java/processing/opengl/LinePath.java +0 -627
- data/lib/java/processing/opengl/LineStroker.java +0 -681
- data/lib/java/processing/opengl/PGL.java +0 -3483
- data/lib/java/processing/opengl/PGraphics2D.java +0 -615
- data/lib/java/processing/opengl/PGraphics3D.java +0 -281
- data/lib/java/processing/opengl/PGraphicsOpenGL.java +0 -13753
- data/lib/java/processing/opengl/PJOGL.java +0 -2008
- data/lib/java/processing/opengl/PShader.java +0 -1484
- data/lib/java/processing/opengl/PShapeOpenGL.java +0 -5269
- data/lib/java/processing/opengl/PSurfaceJOGL.java +0 -1385
- data/lib/java/processing/opengl/Texture.java +0 -1696
- data/lib/java/processing/opengl/VertexBuffer.java +0 -88
- data/lib/java/processing/pdf/PGraphicsPDF.java +0 -581
- data/lib/java/processing/svg/PGraphicsSVG.java +0 -378
- data/src/main/java/processing/opengl/cursors/arrow.png +0 -0
- data/src/main/java/processing/opengl/cursors/cross.png +0 -0
- data/src/main/java/processing/opengl/cursors/hand.png +0 -0
- data/src/main/java/processing/opengl/cursors/license.txt +0 -27
- data/src/main/java/processing/opengl/cursors/move.png +0 -0
- data/src/main/java/processing/opengl/cursors/text.png +0 -0
- data/src/main/java/processing/opengl/cursors/wait.png +0 -0
- data/src/main/java/processing/opengl/shaders/ColorFrag.glsl +0 -32
- data/src/main/java/processing/opengl/shaders/ColorVert.glsl +0 -34
- data/src/main/java/processing/opengl/shaders/LightFrag.glsl +0 -33
- data/src/main/java/processing/opengl/shaders/LightVert.glsl +0 -151
- data/src/main/java/processing/opengl/shaders/LineFrag.glsl +0 -32
- data/src/main/java/processing/opengl/shaders/LineVert.glsl +0 -100
- data/src/main/java/processing/opengl/shaders/MaskFrag.glsl +0 -40
- data/src/main/java/processing/opengl/shaders/PointFrag.glsl +0 -32
- data/src/main/java/processing/opengl/shaders/PointVert.glsl +0 -56
- data/src/main/java/processing/opengl/shaders/TexFrag.glsl +0 -37
- data/src/main/java/processing/opengl/shaders/TexLightFrag.glsl +0 -37
- data/src/main/java/processing/opengl/shaders/TexLightVert.glsl +0 -157
- data/src/main/java/processing/opengl/shaders/TexVert.glsl +0 -38
|
@@ -1,287 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The purpose of this tool is to allow JRubyArt users to use an alternative
|
|
3
|
-
* to processing.org map, lerp and norm methods in their sketches and to implement
|
|
4
|
-
* JRubyArt convenenience method grid(width, height, stepW, stepH) { |x, y| do stuff }
|
|
5
|
-
* Copyright (c) 2015-20 Martin Prout. This tool is free software; you can
|
|
6
|
-
* redistribute it and/or modify it under the terms of the GNU Lesser General
|
|
7
|
-
* Public License as published by the Free Software Foundation; either version
|
|
8
|
-
* 2.1 of the License, or (at your option) any later version.
|
|
9
|
-
*
|
|
10
|
-
* Obtain a copy of the license at http://www.gnu.org/licenses/lgpl-2.1.html
|
|
11
|
-
*/
|
|
12
|
-
package monkstone;
|
|
13
|
-
|
|
14
|
-
import org.jruby.Ruby;
|
|
15
|
-
import org.jruby.RubyFixnum;
|
|
16
|
-
import org.jruby.RubyFloat;
|
|
17
|
-
import org.jruby.RubyModule;
|
|
18
|
-
import org.jruby.RubyRange;
|
|
19
|
-
import org.jruby.anno.JRubyMethod;
|
|
20
|
-
import org.jruby.anno.JRubyModule;
|
|
21
|
-
import org.jruby.runtime.Block;
|
|
22
|
-
import org.jruby.runtime.ThreadContext;
|
|
23
|
-
import org.jruby.runtime.builtin.IRubyObject;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
*
|
|
27
|
-
* @author Martin Prout
|
|
28
|
-
*/
|
|
29
|
-
@JRubyModule(name = "MathTool")
|
|
30
|
-
public class MathToolModule {
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
*
|
|
34
|
-
* @param runtime Ruby
|
|
35
|
-
*/
|
|
36
|
-
public static void createMathToolModule(Ruby runtime) {
|
|
37
|
-
RubyModule mtModule = runtime.defineModule("MathTool");
|
|
38
|
-
mtModule.defineAnnotatedMethods(MathToolModule.class);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
*
|
|
43
|
-
* @param context ThreadContext
|
|
44
|
-
* @param recv IRubyObject
|
|
45
|
-
* @param args array of RubyRange (must be be numeric)
|
|
46
|
-
* @return mapped value RubyFloat
|
|
47
|
-
*/
|
|
48
|
-
@JRubyMethod(name = "map1d", rest = true, module = true)
|
|
49
|
-
public static IRubyObject mapOneD(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
|
|
50
|
-
double value = (args[0] instanceof RubyFloat)
|
|
51
|
-
? ((RubyFloat) args[0]).getValue() : ((RubyFixnum) args[0]).getDoubleValue();
|
|
52
|
-
RubyRange r1 = (RubyRange) args[1];
|
|
53
|
-
RubyRange r2 = (RubyRange) args[2];
|
|
54
|
-
double first1 = (r1.first(context) instanceof RubyFloat)
|
|
55
|
-
? ((RubyFloat) r1.first(context)).getValue() : ((RubyFixnum) r1.first(context)).getDoubleValue();
|
|
56
|
-
double first2 = (r2.first(context) instanceof RubyFloat)
|
|
57
|
-
? ((RubyFloat) r2.first(context)).getValue() : ((RubyFixnum) r2.first(context)).getDoubleValue();
|
|
58
|
-
double last1 = (r1.last(context) instanceof RubyFloat)
|
|
59
|
-
? ((RubyFloat) r1.last(context)).getValue() : ((RubyFixnum) r1.last(context)).getDoubleValue();
|
|
60
|
-
double last2 = (r2.last(context) instanceof RubyFloat)
|
|
61
|
-
? ((RubyFloat) r2.last(context)).getValue() : ((RubyFixnum) r2.last(context)).getDoubleValue();
|
|
62
|
-
return mapMt(context, value, first1, last1, first2, last2);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
*
|
|
67
|
-
* @param context ThreadContext
|
|
68
|
-
* @param recv IRubyObject
|
|
69
|
-
* @param args array of RubyRange (must be be numeric)
|
|
70
|
-
* @return mapped value RubyFloat
|
|
71
|
-
*/
|
|
72
|
-
@JRubyMethod(name = "constrained_map", rest = true, module = true)
|
|
73
|
-
public static IRubyObject constrainedMap(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
|
|
74
|
-
double value = (args[0] instanceof RubyFloat) ? ((RubyFloat) args[0]).getValue() : ((RubyFixnum) args[0]).getDoubleValue();
|
|
75
|
-
RubyRange r1 = (RubyRange) args[1];
|
|
76
|
-
RubyRange r2 = (RubyRange) args[2];
|
|
77
|
-
double first1 = (r1.first(context) instanceof RubyFloat)
|
|
78
|
-
? ((RubyFloat) r1.first(context)).getValue() : ((RubyFixnum) r1.first(context)).getDoubleValue();
|
|
79
|
-
double first2 = (r2.first(context) instanceof RubyFloat)
|
|
80
|
-
? ((RubyFloat) r2.first(context)).getValue() : ((RubyFixnum) r2.first(context)).getDoubleValue();
|
|
81
|
-
double last1 = (r1.last(context) instanceof RubyFloat)
|
|
82
|
-
? ((RubyFloat) r1.last(context)).getValue() : ((RubyFixnum) r1.last(context)).getDoubleValue();
|
|
83
|
-
double last2 = (r2.last(context) instanceof RubyFloat)
|
|
84
|
-
? ((RubyFloat) r2.last(context)).getValue() : ((RubyFixnum) r2.last(context)).getDoubleValue();
|
|
85
|
-
double max = Math.max(first1, last1);
|
|
86
|
-
double min = Math.min(first1, last1);
|
|
87
|
-
if (value < min) {
|
|
88
|
-
return mapMt(context, min, first1, last1, first2, last2);
|
|
89
|
-
}
|
|
90
|
-
if (value > max) {
|
|
91
|
-
return mapMt(context, max, first1, last1, first2, last2);
|
|
92
|
-
}
|
|
93
|
-
return mapMt(context, value, first1, last1, first2, last2);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
*
|
|
98
|
-
* @param context ThreadContext
|
|
99
|
-
* @param recv self IRubyObject
|
|
100
|
-
* @param args floats as in processing map function
|
|
101
|
-
* @return mapped value RubyFloat
|
|
102
|
-
*/
|
|
103
|
-
@JRubyMethod(name = "p5map", rest = true, module = true)
|
|
104
|
-
public static IRubyObject mapProcessing(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
|
|
105
|
-
double value = (args[0] instanceof RubyFloat) ? ((RubyFloat) args[0]).getValue() : ((RubyFixnum) args[0]).getDoubleValue();
|
|
106
|
-
double first1 = (args[1] instanceof RubyFloat) ? ((RubyFloat) args[1]).getValue() : ((RubyFixnum) args[1]).getDoubleValue();
|
|
107
|
-
double first2 = (args[3] instanceof RubyFloat) ? ((RubyFloat) args[3]).getValue() : ((RubyFixnum) args[3]).getDoubleValue();
|
|
108
|
-
double last1 = (args[2] instanceof RubyFloat) ? ((RubyFloat) args[2]).getValue() : ((RubyFixnum) args[2]).getDoubleValue();
|
|
109
|
-
double last2 = (args[4] instanceof RubyFloat) ? ((RubyFloat) args[4]).getValue() : ((RubyFixnum) args[4]).getDoubleValue();
|
|
110
|
-
return mapMt(context, value, first1, last1, first2, last2);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* A more correct version than processing.org version
|
|
115
|
-
*
|
|
116
|
-
* @param context ThreadContext
|
|
117
|
-
* @param recv self IRubyObject
|
|
118
|
-
* @param args args[2] should be between 0 and 1.0 if not returns start or
|
|
119
|
-
* stop
|
|
120
|
-
* @return lerped value RubyFloat
|
|
121
|
-
*/
|
|
122
|
-
@JRubyMethod(name = "lerp", rest = true, module = true)
|
|
123
|
-
public static IRubyObject lerpP(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
|
|
124
|
-
double start = (args[0] instanceof RubyFloat) ? ((RubyFloat) args[0]).getValue() : ((RubyFixnum) args[0]).getDoubleValue();
|
|
125
|
-
double stop = (args[1] instanceof RubyFloat) ? ((RubyFloat) args[1]).getValue() : ((RubyFixnum) args[1]).getDoubleValue();
|
|
126
|
-
double amount = (args[2] instanceof RubyFloat) ? ((RubyFloat) args[2]).getValue() : ((RubyFixnum) args[2]).getDoubleValue();
|
|
127
|
-
if (amount <= 0) {
|
|
128
|
-
return args[0];
|
|
129
|
-
}
|
|
130
|
-
if (amount >= 1.0) {
|
|
131
|
-
return args[1];
|
|
132
|
-
}
|
|
133
|
-
return context.runtime.newFloat((1 - amount) * start + (stop * amount));
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Identical to p5map(value, low, high, 0, 1). Numbers outside of the range
|
|
138
|
-
* are not clamped to 0 and 1, because out-of-range values are often
|
|
139
|
-
* intentional and useful.
|
|
140
|
-
*
|
|
141
|
-
* @param context ThreadContext
|
|
142
|
-
* @param recv IRubyObject
|
|
143
|
-
* @param args array of args must be be numeric
|
|
144
|
-
* @return mapped value RubyFloat
|
|
145
|
-
*/
|
|
146
|
-
@JRubyMethod(name = "norm", rest = true, module = true)
|
|
147
|
-
public static IRubyObject normP(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
|
|
148
|
-
double value = (args[0] instanceof RubyFloat) ? ((RubyFloat) args[0]).getValue() : ((RubyFixnum) args[0]).getDoubleValue();
|
|
149
|
-
double start = (args[1] instanceof RubyFloat) ? ((RubyFloat) args[1]).getValue() : ((RubyFixnum) args[1]).getDoubleValue();
|
|
150
|
-
double stop = (args[2] instanceof RubyFloat) ? ((RubyFloat) args[2]).getValue() : ((RubyFixnum) args[2]).getDoubleValue();
|
|
151
|
-
return mapMt(context, value, start, stop, 0, 1.0);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Identical to p5map(value, low, high, 0, 1) but 'clamped'. Numbers outside
|
|
156
|
-
* of the range are clamped to 0 and 1,
|
|
157
|
-
*
|
|
158
|
-
* @param context ThreadContext
|
|
159
|
-
* @param recv IRubyObject
|
|
160
|
-
* @param args array of args must be be numeric
|
|
161
|
-
* @return mapped value RubyFloat
|
|
162
|
-
*/
|
|
163
|
-
@JRubyMethod(name = "norm_strict", rest = true, module = true)
|
|
164
|
-
public static IRubyObject norm_strict(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
|
|
165
|
-
|
|
166
|
-
double value = (args[0] instanceof RubyFloat) ? ((RubyFloat) args[0]).getValue() : ((RubyFixnum) args[0]).getDoubleValue();
|
|
167
|
-
double start = (args[1] instanceof RubyFloat) ? ((RubyFloat) args[1]).getValue() : ((RubyFixnum) args[1]).getDoubleValue();
|
|
168
|
-
double stop = (args[2] instanceof RubyFloat) ? ((RubyFloat) args[2]).getValue() : ((RubyFixnum) args[2]).getDoubleValue();
|
|
169
|
-
double max = Math.max(start, stop);
|
|
170
|
-
double min = Math.min(start, stop);
|
|
171
|
-
if (value < min) {
|
|
172
|
-
return mapMt(context, min, start, stop, 0, 1.0);
|
|
173
|
-
}
|
|
174
|
-
if (value > max) {
|
|
175
|
-
return mapMt(context, max, start, stop, 0, 1.0);
|
|
176
|
-
}
|
|
177
|
-
return mapMt(context, value, start, stop, 0, 1.0);
|
|
178
|
-
}
|
|
179
|
-
// start2 + (stop2 - start2) * ((value - start1) / (stop1 - start1));
|
|
180
|
-
static final RubyFloat mapMt(ThreadContext context, double value, double first1, double last1, double first2, double last2) {
|
|
181
|
-
Ruby ruby = context.runtime;
|
|
182
|
-
double result = first2 + (last2 - first2) * ((value - first1) / (last1 - first1));
|
|
183
|
-
return ruby.newFloat(result);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* Provides processing constrain method as a ruby module method
|
|
188
|
-
*
|
|
189
|
-
* @param context ThreadContext
|
|
190
|
-
* @param recv IRubyObject
|
|
191
|
-
* @param args array of args must be be numeric
|
|
192
|
-
* @return original or limit values
|
|
193
|
-
*/
|
|
194
|
-
@JRubyMethod(name = "constrain", rest = true, module = true)
|
|
195
|
-
public static IRubyObject constrainValue(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
|
|
196
|
-
RubyFloat value = args[0].convertToFloat();
|
|
197
|
-
RubyFloat start = args[1].convertToFloat();
|
|
198
|
-
RubyFloat stop = args[2].convertToFloat();
|
|
199
|
-
if (value.op_ge(context, start).isTrue() && value.op_le(context, stop).isTrue()) {
|
|
200
|
-
return args[0];
|
|
201
|
-
} else if (value.op_ge(context, start).isTrue()) {
|
|
202
|
-
return args[2];
|
|
203
|
-
} else {
|
|
204
|
-
return args[1];
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
/**
|
|
209
|
-
* Provides JRubyArt grid method as a ruby module method behaves like:-
|
|
210
|
-
* def grid(dx, dy, sx = 1, sy = 1)
|
|
211
|
-
* (0...dx).step(sx) do |x|
|
|
212
|
-
* (0...dy).step(sy) do |y|
|
|
213
|
-
* yield(x, y)
|
|
214
|
-
* end
|
|
215
|
-
* end
|
|
216
|
-
* end
|
|
217
|
-
* @param context ThreadContext
|
|
218
|
-
* @param recv IRubyObject
|
|
219
|
-
* @param args array of args should be Fixnum
|
|
220
|
-
* @param block { |x, y| `do something` }
|
|
221
|
-
* @return nil
|
|
222
|
-
*/
|
|
223
|
-
@JRubyMethod(name = "grid", rest = true, module = true)
|
|
224
|
-
public static IRubyObject createGrid(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) {
|
|
225
|
-
Ruby ruby = context.runtime;
|
|
226
|
-
int row = (int) args[0].toJava(Integer.class);
|
|
227
|
-
int column = (int) args[1].toJava(Integer.class);
|
|
228
|
-
int rowStep = 1;
|
|
229
|
-
int colStep = 1;
|
|
230
|
-
if (args.length == 4){
|
|
231
|
-
rowStep = (int) args[2].toJava(Integer.class);
|
|
232
|
-
colStep = (int) args[3].toJava(Integer.class);
|
|
233
|
-
}
|
|
234
|
-
if (block.isGiven()) {
|
|
235
|
-
int tempRow = row / rowStep;
|
|
236
|
-
int tempColumn = column /colStep;
|
|
237
|
-
for (int z = 0; z < (tempRow * tempColumn); z++){
|
|
238
|
-
int y = z % tempColumn;
|
|
239
|
-
int x = z / tempColumn;
|
|
240
|
-
block.yieldSpecific(context, ruby.newFixnum(x * rowStep), ruby.newFixnum(y * colStep));
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
return context.nil;
|
|
244
|
-
}
|
|
245
|
-
/**
|
|
246
|
-
* Provides JRubyArt mesh_grid method as a ruby module method
|
|
247
|
-
* def grid(dx, dy, dz, sx = 1, sy = 1, sz = 1)
|
|
248
|
-
* (0...dx).step(sx) do |x|
|
|
249
|
-
* (0...dy).step(sy) do |y|
|
|
250
|
-
* (0...dz).step(sy) do |z|
|
|
251
|
-
* yield(x, y, z)
|
|
252
|
-
* end
|
|
253
|
-
* end
|
|
254
|
-
* end
|
|
255
|
-
* end
|
|
256
|
-
*
|
|
257
|
-
* @param context ThreadContext
|
|
258
|
-
* @param recv IRubyObject
|
|
259
|
-
* @param args array of args should be Fixnum
|
|
260
|
-
* @param block { |x, y, z| `do something` }
|
|
261
|
-
* @return nil
|
|
262
|
-
*/
|
|
263
|
-
@JRubyMethod(name = "mesh_grid", rest = true, module = true)
|
|
264
|
-
public static IRubyObject createGrid3D(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) {
|
|
265
|
-
Ruby ruby = context.runtime;
|
|
266
|
-
int xDim = (int) args[0].toJava(Integer.class);
|
|
267
|
-
int yDim = (int) args[1].toJava(Integer.class);
|
|
268
|
-
int zDim = (int) args[2].toJava(Integer.class);
|
|
269
|
-
int xStep = (args.length > 3) ? (int) args[3].toJava(Integer.class) : 1;
|
|
270
|
-
int yStep = (args.length > 4) ? (int) args[4].toJava(Integer.class) : 1;
|
|
271
|
-
int zStep = (args.length == 6) ? (int) args[5].toJava(Integer.class) : 1;
|
|
272
|
-
int dimX = xDim / xStep;
|
|
273
|
-
int dimY = yDim / yStep;
|
|
274
|
-
int dimZ = zDim / zStep;
|
|
275
|
-
if (block.isGiven()) {
|
|
276
|
-
int count = dimX * dimY * dimZ;
|
|
277
|
-
for (int x = 0; x < xDim; x += xStep){
|
|
278
|
-
for (int j = 0; j < (dimZ * dimY); j++){
|
|
279
|
-
int z = j % dimZ;
|
|
280
|
-
int y = j / dimZ;
|
|
281
|
-
block.yieldSpecific(context, ruby.newFixnum(x), ruby.newFixnum(y * yStep), ruby.newFixnum(z * zStep));
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
return context.nil;
|
|
286
|
-
}
|
|
287
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The purpose of this class is to load the MathTool into ruby-processing runtime
|
|
3
|
-
* Copyright (C) 2015-20 Martin Prout. This code is free software; you can
|
|
4
|
-
* redistribute it and/or modify it under the terms of the GNU Lesser General
|
|
5
|
-
* Public License as published by the Free Software Foundation; either version
|
|
6
|
-
* 2.1 of the License, or (at your option) any later version.
|
|
7
|
-
*
|
|
8
|
-
* Obtain a copy of the license at http://www.gnu.org/licenses/lgpl-2.1.html
|
|
9
|
-
*/
|
|
10
|
-
package monkstone;
|
|
11
|
-
|
|
12
|
-
import java.io.IOException;
|
|
13
|
-
import monkstone.fastmath.Deglut;
|
|
14
|
-
import monkstone.vecmath.vec2.Vec2;
|
|
15
|
-
import monkstone.vecmath.vec3.Vec3;
|
|
16
|
-
import org.jruby.Ruby;
|
|
17
|
-
import org.jruby.runtime.load.Library;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
*
|
|
21
|
-
* @author Martin Prout
|
|
22
|
-
*/
|
|
23
|
-
public class PropaneLibrary implements Library {
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
*
|
|
27
|
-
* @param runtime
|
|
28
|
-
*/
|
|
29
|
-
public static void load(final Ruby runtime) {
|
|
30
|
-
MathToolModule.createMathToolModule(runtime);
|
|
31
|
-
Deglut.createDeglut(runtime);
|
|
32
|
-
Vec2.createVec2(runtime);
|
|
33
|
-
Vec3.createVec3(runtime);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
*
|
|
38
|
-
* @param runtime
|
|
39
|
-
* @param wrap
|
|
40
|
-
* @throws java.io.IOException
|
|
41
|
-
*/
|
|
42
|
-
@Override
|
|
43
|
-
public void load(final Ruby runtime, boolean wrap) throws IOException {
|
|
44
|
-
PropaneLibrary.load(runtime);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
package monkstone.core;
|
|
2
|
-
|
|
3
|
-
import processing.core.PApplet;
|
|
4
|
-
import static processing.core.PConstants.*;
|
|
5
|
-
import processing.event.MouseEvent;
|
|
6
|
-
import processing.event.KeyEvent;
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* The purpose of this class is to enable access to processing pre, draw and
|
|
10
|
-
* post loops in ruby-processing as a regular java library class. Also included
|
|
11
|
-
* background, fill and stroke methods. PConstants should also be available from
|
|
12
|
-
* static import
|
|
13
|
-
*
|
|
14
|
-
* @author Martin Prout
|
|
15
|
-
*/
|
|
16
|
-
public abstract class LibraryProxy {
|
|
17
|
-
|
|
18
|
-
private final PApplet app;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Useful accessors
|
|
22
|
-
*/
|
|
23
|
-
public int width, height;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
*
|
|
27
|
-
* @param app PApplet
|
|
28
|
-
*/
|
|
29
|
-
public LibraryProxy(PApplet app) {
|
|
30
|
-
this.app = app;
|
|
31
|
-
this.width = app.width;
|
|
32
|
-
this.height = app.height;
|
|
33
|
-
setActive(true);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Extending classes can override this, gives access to, by reflection,
|
|
38
|
-
* processing PApplet pre loop (called before draw)
|
|
39
|
-
*/
|
|
40
|
-
public void pre() {
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Extending classes must implement this gives access to processing PApplet
|
|
45
|
-
* draw loop
|
|
46
|
-
*/
|
|
47
|
-
public abstract void draw();
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Extending classes can override this, gives access to, by reflection,
|
|
51
|
-
* processing PApplet post loop (called after draw)
|
|
52
|
-
*/
|
|
53
|
-
public void post() {
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Extending classes can override this, gives access to, by reflection,
|
|
58
|
-
* processing PApplet post loop (called after draw)
|
|
59
|
-
* @param e
|
|
60
|
-
*/
|
|
61
|
-
public void keyEvent(KeyEvent e) {
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Extending classes can override this, gives access to, by reflection,
|
|
66
|
-
* processing PApplet post loop (called after draw)
|
|
67
|
-
* @param e
|
|
68
|
-
*/
|
|
69
|
-
public void mouseEvent(MouseEvent e) {
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Register or unregister reflection methods
|
|
74
|
-
*
|
|
75
|
-
* @param active
|
|
76
|
-
*/
|
|
77
|
-
final void setActive(boolean active) {
|
|
78
|
-
if (active) {
|
|
79
|
-
this.app.registerMethod("pre", this);
|
|
80
|
-
this.app.registerMethod("draw", this);
|
|
81
|
-
this.app.registerMethod("post", this);
|
|
82
|
-
this.app.registerMethod("mouseEvent", this);
|
|
83
|
-
this.app.registerMethod("keyEvent", this);
|
|
84
|
-
this.app.registerMethod("dispose", this);
|
|
85
|
-
} else {
|
|
86
|
-
this.app.unregisterMethod("pre", this);
|
|
87
|
-
this.app.unregisterMethod("draw", this);
|
|
88
|
-
this.app.unregisterMethod("post", this);
|
|
89
|
-
this.app.unregisterMethod("mouseEvent", this);
|
|
90
|
-
this.app.unregisterMethod("keyEvent", this);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Simple signature for background hides need to call app
|
|
96
|
-
*
|
|
97
|
-
* @param col int
|
|
98
|
-
*/
|
|
99
|
-
public void background(int col) {
|
|
100
|
-
this.app.background(col);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Simple signature for fill hides need to call app
|
|
105
|
-
*
|
|
106
|
-
* @param col int
|
|
107
|
-
*/
|
|
108
|
-
public void fill(int col) {
|
|
109
|
-
this.app.fill(col);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Simple signature for stroke hides need to call app
|
|
114
|
-
*
|
|
115
|
-
* @param col int
|
|
116
|
-
*/
|
|
117
|
-
public void stroke(int col) {
|
|
118
|
-
this.app.stroke(col);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Access applet if we must
|
|
123
|
-
*
|
|
124
|
-
* @return applet PApplet
|
|
125
|
-
*/
|
|
126
|
-
public PApplet app() {
|
|
127
|
-
return this.app;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* required for processing
|
|
132
|
-
*/
|
|
133
|
-
public void dispose() {
|
|
134
|
-
setActive(false);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2021 Martin Prout
|
|
3
|
-
*
|
|
4
|
-
* This library is free software; you can redistribute it and/or
|
|
5
|
-
* modify it under the terms of the GNU Lesser General Public
|
|
6
|
-
* License as published by the Free Software Foundation; either
|
|
7
|
-
* version 2.1 of the License, or (at your option) any later version.
|
|
8
|
-
*
|
|
9
|
-
* http://creativecommons.org/licenses/LGPL/2.1/
|
|
10
|
-
*
|
|
11
|
-
* This library is distributed in the hope that it will be useful,
|
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
14
|
-
* Lesser General Public License for more details.
|
|
15
|
-
*
|
|
16
|
-
* You should have received a copy of the GNU Lesser General Public
|
|
17
|
-
* License along with this library; if not, write to the Free Software
|
|
18
|
-
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
19
|
-
*/
|
|
20
|
-
package monkstone.fastmath;
|
|
21
|
-
|
|
22
|
-
public final class DegLutTables {
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
*
|
|
26
|
-
*/
|
|
27
|
-
static public final float PI = 3.1415927f;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
*
|
|
31
|
-
*/
|
|
32
|
-
static public final float PI2 = PI * 2;
|
|
33
|
-
static private final int SIN_BITS = 15; // 16KB. Adjust for accuracy.
|
|
34
|
-
static private final int SIN_MASK = ~(-1 << SIN_BITS);
|
|
35
|
-
static private final int SIN_COUNT = SIN_MASK + 1;
|
|
36
|
-
|
|
37
|
-
static private final float RAD_FULL = PI * 2;
|
|
38
|
-
static private final float DEG_FULL = 360;
|
|
39
|
-
static private final float RAD_TO_INDEX = SIN_COUNT / RAD_FULL;
|
|
40
|
-
static private final float DEG_TO_INDEX = SIN_COUNT / DEG_FULL;
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* multiply by this to convert from radians to degrees
|
|
44
|
-
*/
|
|
45
|
-
static public final float RADIANS_TO_DEGREES = 180f / PI;
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
*
|
|
49
|
-
*/
|
|
50
|
-
static public final float RAD_DEG = RADIANS_TO_DEGREES;
|
|
51
|
-
/**
|
|
52
|
-
* multiply by this to convert from degrees to radians
|
|
53
|
-
*/
|
|
54
|
-
static public final float DEGREES_TO_RADIANS = PI / 180;
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
*
|
|
58
|
-
*/
|
|
59
|
-
static public final float DEG_RAD = DEGREES_TO_RADIANS;
|
|
60
|
-
|
|
61
|
-
static private class Sin {
|
|
62
|
-
|
|
63
|
-
static final float[] table = new float[SIN_COUNT];
|
|
64
|
-
|
|
65
|
-
static {
|
|
66
|
-
for (int i = 0; i < SIN_COUNT; i++) {
|
|
67
|
-
table[i] = (float) Math.sin((i + 0.5f) / SIN_COUNT * RAD_FULL);
|
|
68
|
-
}
|
|
69
|
-
for (int i = 0; i < 360; i += 90) {
|
|
70
|
-
table[(int) (i * DEG_TO_INDEX) & SIN_MASK] = (float) Math.sin(i * DEGREES_TO_RADIANS);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Returns the sine in radians from a lookup table.
|
|
77
|
-
* @param radians
|
|
78
|
-
* @return
|
|
79
|
-
*/
|
|
80
|
-
static public final float sin(float radians) {
|
|
81
|
-
return Sin.table[(int) (radians * RAD_TO_INDEX) & SIN_MASK];
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Returns the cosine in radians from a lookup table.
|
|
86
|
-
* @param radians
|
|
87
|
-
* @return
|
|
88
|
-
*/
|
|
89
|
-
static public final float cos(float radians) {
|
|
90
|
-
return Sin.table[(int) ((radians + PI / 2) * RAD_TO_INDEX) & SIN_MASK];
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Returns the sine in radians from a lookup table.
|
|
95
|
-
* @param degrees
|
|
96
|
-
* @return
|
|
97
|
-
*/
|
|
98
|
-
static public final float sinDeg(float degrees) {
|
|
99
|
-
return Sin.table[(int) (degrees * DEG_TO_INDEX) & SIN_MASK];
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Returns the cosine in radians from a lookup table.
|
|
104
|
-
* @param degrees
|
|
105
|
-
* @return
|
|
106
|
-
*/
|
|
107
|
-
static public final float cosDeg(float degrees) {
|
|
108
|
-
return Sin.table[(int) ((degrees + 90) * DEG_TO_INDEX) & SIN_MASK];
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2015-21 Martin Prout
|
|
3
|
-
*
|
|
4
|
-
* This library is free software; you can redistribute it and/or
|
|
5
|
-
* modify it under the terms of the GNU Lesser General Public
|
|
6
|
-
* License as published by the Free Software Foundation; either
|
|
7
|
-
* version 2.1 of the License, or (at your option) any later version.
|
|
8
|
-
*
|
|
9
|
-
* http://creativecommons.org/licenses/LGPL/2.1/
|
|
10
|
-
*
|
|
11
|
-
* This library is distributed in the hope that it will be useful,
|
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
14
|
-
* Lesser General Public License for more details.
|
|
15
|
-
*
|
|
16
|
-
* You should have received a copy of the GNU Lesser General Public
|
|
17
|
-
* License along with this library; if not, write to the Free Software
|
|
18
|
-
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
19
|
-
*/
|
|
20
|
-
package monkstone.fastmath;
|
|
21
|
-
|
|
22
|
-
import org.jruby.Ruby;
|
|
23
|
-
import org.jruby.RubyNumeric;
|
|
24
|
-
import org.jruby.RubyModule;
|
|
25
|
-
import org.jruby.anno.JRubyModule;
|
|
26
|
-
import org.jruby.anno.JRubyMethod;
|
|
27
|
-
import org.jruby.runtime.ThreadContext;
|
|
28
|
-
import org.jruby.runtime.builtin.IRubyObject;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
*
|
|
32
|
-
* @author Martin Prout
|
|
33
|
-
*/
|
|
34
|
-
@JRubyModule(name = "DegLut")
|
|
35
|
-
public class Deglut {
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
*
|
|
39
|
-
* @param runtime Ruby
|
|
40
|
-
*/
|
|
41
|
-
public static void createDeglut(final Ruby runtime) {
|
|
42
|
-
RubyModule deglutModule = runtime.defineModule("DegLut");
|
|
43
|
-
deglutModule.defineAnnotatedMethods(Deglut.class);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
*
|
|
48
|
-
* @param context ThreadContext
|
|
49
|
-
* @param recv IRubyObject
|
|
50
|
-
* @param other IRubyObject degrees
|
|
51
|
-
* @return sin IRubyObject
|
|
52
|
-
*/
|
|
53
|
-
@JRubyMethod(name = "sin", module = true)
|
|
54
|
-
public static IRubyObject sin(ThreadContext context, IRubyObject recv, IRubyObject other) {
|
|
55
|
-
float thet = (float) ((RubyNumeric) other).getLongValue();
|
|
56
|
-
return context.runtime.newFloat(DegLutTables.sinDeg(thet));
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
*
|
|
61
|
-
* @param context ThreadContext
|
|
62
|
-
* @param recv IRubyObject
|
|
63
|
-
* @param other IRubyObject degrees
|
|
64
|
-
* @return cos IRubyObject
|
|
65
|
-
*/
|
|
66
|
-
@JRubyMethod(name = "cos", module = true)
|
|
67
|
-
public static IRubyObject cos(ThreadContext context, IRubyObject recv, IRubyObject other) {
|
|
68
|
-
float thet = (float) ((RubyNumeric) other).getLongValue();
|
|
69
|
-
return context.runtime.newFloat(DegLutTables.cosDeg(thet));
|
|
70
|
-
}
|
|
71
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2015-20 Martin Prout
|
|
3
|
-
*
|
|
4
|
-
* This library is free software; you can redistribute it and/or
|
|
5
|
-
* modify it under the terms of the GNU Lesser General Public
|
|
6
|
-
* License as published by the Free Software Foundation; either
|
|
7
|
-
* version 2.1 of the License, or (at your option) any later version.
|
|
8
|
-
*
|
|
9
|
-
* http://creativecommons.org/licenses/LGPL/2.1/
|
|
10
|
-
*
|
|
11
|
-
* This library is distributed in the hope that it will be useful,
|
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
14
|
-
* Lesser General Public License for more details.
|
|
15
|
-
*
|
|
16
|
-
* You should have received a copy of the GNU Lesser General Public
|
|
17
|
-
* License along with this library; if not, write to the Free Software
|
|
18
|
-
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
19
|
-
*/
|
|
20
|
-
package monkstone.filechooser;
|
|
21
|
-
|
|
22
|
-
import java.io.File;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* This interface makes it easier/possible to use the reflection methods
|
|
26
|
-
* selectInput def setup java_signature 'void selectInput(String, String)'
|
|
27
|
-
* selectInput('Select a file to process:', 'fileSelected') end
|
|
28
|
-
*
|
|
29
|
-
* def file_selected(selection) if selection.nil? puts 'Window was closed or the
|
|
30
|
-
* user hit cancel.' else puts format('User selected %s',
|
|
31
|
-
* selection.get_absolute_path) end end
|
|
32
|
-
*
|
|
33
|
-
* @author Martin Prout
|
|
34
|
-
*/
|
|
35
|
-
@FunctionalInterface
|
|
36
|
-
public interface Chooser {
|
|
37
|
-
|
|
38
|
-
public void file_selected(File selection);
|
|
39
|
-
}
|