1
1
load_libraries :hemesh , :vbo
2
-
3
- include MS # module MS imports necessary java classes and contains ruby MeshToVBO class
4
-
2
+ # module MS imports necessary java classes and contains ruby MeshToVBO class
3
+ include MS
5
4
RES ||= 20
6
5
7
6
attr_reader :mesh_ret , :inv_mesh_ret , :render
8
7
9
8
def setup
10
9
sketch_title 'Twin Iso'
11
10
ArcBall . init ( self )
12
- values = [ ] # build a multi-dimensional array in ruby
13
- ( 0 ..RES ) . each do |i | # the inclusive range is intentional here
11
+ values = [ ] # build a multi-dimensional array in ruby
12
+ ( 0 ..RES ) . each do |i | # the inclusive range is intentional here
14
13
valu = [ ]
15
14
( 0 ..RES ) . each do |j |
16
15
val = [ ]
@@ -21,27 +20,27 @@ def setup
21
20
end
22
21
values << valu
23
22
end
24
-
23
+
25
24
creator = HEC_IsoSurface . new
26
25
creator . set_resolution ( RES , RES , RES ) # number of cells in x,y,z direction
27
26
creator . set_size ( 400.0 / RES , 400.0 / RES , 400.0 / RES ) # cell size
28
-
29
- # JRuby requires a bit of help to determine correct 'java args', particulary with
30
- # overloaded arrays args as seen below. Note we are saying we have an 'array' of
31
- # 'float array' here, where the values can also be double[][][].
27
+
28
+ # JRuby requires a bit of help to determine correct 'java args', particulary
29
+ # with overloaded arrays args as seen below. Note we are saying we have an
30
+ # 'array' of ' float array' here, where the values can also be double[][][].
32
31
java_values = values . to_java ( Java ::float [ ] [ ] ) # pre-coerce values to java
33
- creator . set_values ( java_values ) # the grid points
34
-
35
- creator . set_isolevel ( 1 ) # isolevel to mesh
32
+ creator . set_values ( java_values ) # the grid points
33
+
34
+ creator . set_isolevel ( 1 ) # isolevel to mesh
36
35
creator . set_invert ( false ) # invert mesh
37
36
creator . set_boundary ( 100 ) # value of isoFunction outside grid
38
37
# use creator.clear_boundary to set boundary values to "no value".
39
38
# A boundary value of "no value" results in an open mesh
40
-
39
+
41
40
mesh = HE_Mesh . new ( creator )
42
41
# mesh.modify(HEM_Smooth.new.set_iterations(10).setAutoRescale(true))
43
42
creator . set_invert ( true )
44
-
43
+
45
44
inv_mesh = HE_Mesh . new ( creator )
46
45
inv_mesh . modify ( HEM_Smooth . new . set_iterations ( 10 ) . set_auto_rescale ( true ) )
47
46
@render = MeshToVBO . new ( self )
0 commit comments