Skip to content

Commit e15ce83

Browse files
committed
update hemesh examples
1 parent a6835cf commit e15ce83

File tree

4 files changed

+63
-9
lines changed

4 files changed

+63
-9
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# HE_Mesh
22

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)
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.1.2. 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)

external_library/java/hemesh/mirror.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
load_library :hemesh
22

3-
include_package 'wblut.math'
4-
include_package 'wblut.processing'
5-
include_package 'wblut.core'
3+
java_import 'wblut.processing.WB_Render'
4+
java_import 'wblut.geom.WB_Plane'
65
include_package 'wblut.hemesh'
7-
include_package 'wblut.geom'
86

97
attr_reader :mesh, :render, :plane, :plane2, :plane3, :modifier
108

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
load_library :hemesh
2+
# namespace for hemesh java classes
3+
module WBlut
4+
java_import 'wblut.processing.WB_Render'
5+
java_import 'wblut.core.WB_ProgressReporter'
6+
include_package 'wblut.hemesh'
7+
end
8+
9+
attr_reader :mesh, :render, :pr
10+
def settings
11+
size(1000, 1000, P3D)
12+
smooth(8)
13+
end
14+
15+
def setup
16+
sketch_title 'Progress Reporter'
17+
ArcBall.init(self)
18+
@pr= WBlut::WB_ProgressReporter.new(5) # maximum depth of reporting
19+
pr.start
20+
create_mesh
21+
@render= WBlut::WB_Render.new(self)
22+
end
23+
24+
def draw
25+
background(120)
26+
directional_light(255, 255, 255, 1, 1, -1)
27+
directional_light(127, 127, 127, -1, -1, 1)
28+
fill(255)
29+
no_stroke
30+
render.draw_faces(mesh)
31+
stroke(0)
32+
render.draw_edges(mesh)
33+
end
34+
35+
36+
def create_mesh
37+
creator= WBlut::HEC_Geodesic.new.setC(2).setB(2).set_radius(300)
38+
@mesh= WBlut::HE_Mesh.new(creator)
39+
mesh.add(WBlut::HE_Mesh.new(
40+
WBlut::HEC_Grid.new(10, 10, 700, 700).set_center(0, 0, -350))
41+
)
42+
modifier= WBlut::HEM_Lattice.new
43+
modifier.set_width(10) # desired width of struts
44+
modifier.set_depth(10) # depth of struts
45+
# treat edges sharper than this angle as hard edges
46+
modifier.set_threshold_angle(1.5 * HALF_PI)
47+
# try to fuse planar adjacent planar faces created by the extrude
48+
modifier.set_fuse(true)
49+
# threshold angle to be considered coplanar
50+
modifier.set_fuse_angle(0.1 * HALF_PI)
51+
sel= WBlut::HE_Selection.select_random_faces(mesh, 0.4)
52+
sel.modify(modifier)
53+
mesh.smooth(2)
54+
end
55+
56+
def stop
57+
pr.interrupt
58+
super.stop
59+
end

external_library/java/hemesh/simplify.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
load_library :hemesh
2-
include_package 'wblut.math'
3-
include_package 'wblut.processing'
4-
include_package 'wblut.core'
2+
java_import 'wblut.processing.WB_Render'
53
include_package 'wblut.hemesh'
6-
include_package 'wblut.geom'
74

85
attr_reader :mesh, :render, :old_mesh
96

0 commit comments

Comments
 (0)