Skip to content

Commit 8e3808d

Browse files
committed
readme
1 parent a8d3dd4 commit 8e3808d

File tree

4 files changed

+85
-23
lines changed

4 files changed

+85
-23
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# HE_Mesh
2+
3+
Is 3D Geometry java library for processing by [Frederik Vanhoutte](http://www.wblut.com/) see http://www.wblut.com/he_mesh/ sketches in this folder are expected to work with version 5.0.3. The library has changed a lot over the years and not necessarily for the better (dependencies seem to be expanding exponentially, this cannot be a good thing, just look at the disaster that is ruby-on-rails)
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
load_library :hemesh
2+
3+
include_package 'wblut.math'
4+
include_package 'wblut.processing'
5+
include_package 'wblut.core'
6+
include_package 'wblut.hemesh'
7+
include_package 'wblut.geom'
8+
9+
attr_reader :mesh, :render, :plane, :plane2, :plane3, :modifier
10+
11+
def settings
12+
size(1000, 1000, P3D)
13+
smooth(8)
14+
end
15+
16+
def setup
17+
sketch_title 'Half Edge Mirror'
18+
ArcBall.init(self)
19+
create_mesh
20+
@modifier = HEM_Mirror.new
21+
@plane = WB_Plane.new(0, 0, 0, 0, 1, 1)
22+
modifier.set_plane(plane)
23+
modifier.set_offset(0)
24+
modifier.set_reverse(false)
25+
mesh.modify(modifier)
26+
@plane2 = WB_Plane.new(0, 0, 0, 1, -1, 1)
27+
modifier.set_plane(plane2) # mirror plane
28+
mesh.modify(modifier)
29+
@plane3 = WB_Plane.new(-80, 0, 0, 1, 0, 0)
30+
modifier.set_plane(plane3) # mirror plane
31+
mesh.modify(modifier)
32+
mesh.validate
33+
@render = WB_Render.new(self)
34+
end
35+
36+
def draw
37+
background(120)
38+
setup_lights
39+
fill(255)
40+
no_stroke
41+
render.draw_faces(mesh)
42+
no_fill
43+
stroke(0, 50)
44+
render.draw_edges(mesh)
45+
stroke(255, 0, 0)
46+
render.draw_plane(@plane, 300)
47+
render.draw_plane(@plane2, 300)
48+
render.draw_plane(@plane3, 300)
49+
end
50+
51+
def create_mesh
52+
@mesh = HE_Mesh.new(HEC_Beethoven.new.set_scale(10))
53+
end
54+
55+
def setup_lights
56+
lights
57+
directional_light(255, 255, 255, 1, 1, -1)
58+
directional_light(127, 127, 127, -1, -1, 1)
59+
end

external_library/java/hemesh/spray_nozzle.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def draw
2121
fill(255)
2222
no_stroke
2323
render.draw_faces(mesh)
24-
noFill
24+
no_fill
2525
stroke(0, 50)
2626
render.draw_edges(mesh)
2727
fill(255, 0, 0)

external_library/java/hemesh/twin_iso.rb

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
load_libraries :hemesh, :vbo
2-
# module MS imports necessary java classes and contains ruby MeshToVBO class
3-
include MS
1+
load_libraries :hemesh
2+
java_import 'wblut.processing.WB_Render'
3+
java_import 'wblut.hemesh.HEC_IsoSurface'
4+
java_import 'wblut.hemesh.HE_Mesh'
5+
java_import 'wblut.hemesh.HEM_Smooth'
6+
47
RES ||= 20
58

6-
attr_reader :mesh_ret, :inv_mesh_ret, :render
9+
attr_reader :mesh, :inv_mesh, :render
710

811
def setup
912
sketch_title 'Twin Iso'
@@ -24,30 +27,22 @@ def setup
2427
creator = HEC_IsoSurface.new
2528
creator.set_resolution(RES, RES, RES) # number of cells in x,y,z direction
2629
creator.set_size(400.0 / RES, 400.0 / RES, 400.0 / RES) # cell size
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[][][].
30+
# JRuby requires a bit of help to determine correct 'java args', particulary with
31+
# overloaded arrays args as seen below. Note we are saying we have an 'array' of
32+
# 'float array' here, where the values can also be double[][][].
3133
java_values = values.to_java(Java::float[][]) # pre-coerce values to java
32-
creator.set_values(java_values) # the grid points
33-
34-
creator.set_isolevel(1) # isolevel to mesh
34+
creator.set_values(java_values) # the grid points
35+
creator.set_isolevel(1) # isolevel to mesh
3536
creator.set_invert(false) # invert mesh
3637
creator.set_boundary(100) # value of isoFunction outside grid
3738
# use creator.clear_boundary to set boundary values to "no value".
3839
# A boundary value of "no value" results in an open mesh
39-
40-
mesh = HE_Mesh.new(creator)
40+
@mesh = HE_Mesh.new(creator)
4141
# mesh.modify(HEM_Smooth.new.set_iterations(10).setAutoRescale(true))
4242
creator.set_invert(true)
43-
44-
inv_mesh = HE_Mesh.new(creator)
43+
@inv_mesh = HE_Mesh.new(creator)
4544
inv_mesh.modify(HEM_Smooth.new.set_iterations(10).set_auto_rescale(true))
46-
@render = MeshToVBO.new(self)
47-
no_stroke
48-
# no color args produces a default light grey fill
49-
@mesh_ret = render.meshToVBO(mesh, color(200, 0, 0))
50-
@inv_mesh_ret = render.meshToVBO(inv_mesh, color(0, 0, 200))
45+
@render = WB_Render.new(self)
5146
end
5247

5348
def settings
@@ -59,8 +54,13 @@ def draw
5954
background(200)
6055
lights
6156
define_lights
62-
shape(inv_mesh_ret)
63-
shape(mesh_ret)
57+
no_stroke
58+
fill(255, 0, 0)
59+
render.draw_faces(inv_mesh)
60+
stroke(0)
61+
render.draw_edges(mesh)
62+
stroke(255, 0, 0, 80)
63+
render.draw_edges(inv_mesh)
6464
end
6565

6666
def define_lights

0 commit comments

Comments
 (0)