Skip to content

Commit c1032a5

Browse files
committed
cool sketches, difficult libray
1 parent e15ce83 commit c1032a5

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
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.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)
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). However Frederik Vanhoutte has developed some rather cool sketches, it's just that need a lot of imagination and persistence to create equally good ones using the library.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
load_library :hemesh
2+
include_package 'wblut.hemesh'
3+
java_import 'wblut.processing.WB_Render'
4+
5+
attr_reader :selection, :invselection, :box, :render
6+
7+
def settings
8+
size(800, 800, P3D)
9+
end
10+
11+
def setup
12+
sketch_title 'Mesh Selection'
13+
box_creator = HEC_Box.new.set_width(400)
14+
.set_width_segments(10)
15+
.set_height(200)
16+
.set_height_segments(4)
17+
.set_depth(200)
18+
.set_depth_segments(4)
19+
@box = HE_Mesh.new(box_creator)
20+
ArcBall.init(self)
21+
# define a selection
22+
@selection = HE_Selection.new(box)
23+
# add faces to selection
24+
box.f_itr.each { |face| selection.add(face) if rand(100) < 50 }
25+
invselection = selection.get
26+
invselection.invert_faces
27+
cc = HES_CatmullClark.new.set_keep_edges(false).set_keep_boundary(false)
28+
# only modify selection (if applicable)
29+
selection.subdivide(cc, 2)
30+
# modifiers try to preserve selections whenever possible
31+
selection.modify(HEM_Extrude.new.set_distance(25).set_chamfer(0.4))
32+
invselection.modify(HEM_Extrude.new.set_distance(-5).set_chamfer(0.4))
33+
@render = WB_Render.new(self)
34+
end
35+
36+
def draw
37+
background(25)
38+
lights
39+
fill(255)
40+
no_stroke
41+
render.draw_faces(box)
42+
fill(255, 0, 0)
43+
render.draw_faces(selection)
44+
stroke(0)
45+
render.draw_edges(box)
46+
end

0 commit comments

Comments
 (0)