Constructs

noun : an abstract or general idea inferred or derived from specific instances [syn: concept, conception]; verb 1: make by combining materials and parts [syn: build, make]; verb 2: put together out of components or parts [syn: manufacture, fabricate]; verb 3: draw with suitable instruments and under specified conditions, of geometrical figures; verb 4: of past events [syn: reconstruct, retrace]

Portfolio

General

Hemesh : a 3D mesh library for Processing

Coded, recoded, lost, recoded and recoded … hemesh, the half-edge mesh library for Pro­cess­ing has slowly accreted to a state that war­rants a release. A release in more than one way. In ret­ro­spect, the cur­rent func­tion­al­ity looks depress­ingly small, espe­cially com­pared to the hun­dreds of hours that already went into cod­ing it. But like a broke home-owner with a base­ment and a half-finished first floor, I com­fort myself with the thought that at least it holds poten­tial for growth.

What is hemesh?

hemesh is an imple­men­ta­tion of a half-edge datas­truc­ture for manip­u­lat­ing 3D meshes in Pro­cess­ing. Basi­cally it’s a toolset to extend my Pro­cess­ing sand­box to a proper playground.

Gen­er­at­ing and dis­play­ing a mesh requires noth­ing more than a list of ver­tices and a list of faces con­nect­ing them. This hardly requires a spe­cial dataset. How­ever, manip­u­lat­ing a mesh in any but a triv­ial way requires a lot of con­nec­tiv­ity infor­ma­tion: neigh­bor­ing ver­tices, neigh­bor­ing faces, shared edges,… Keep­ing track of this in a sim­ple facelist type struc­ture is dif­fi­cult. Hence the need for a datas­truc­ture that incor­po­rates con­nec­tiv­ity infor­ma­tion in an effi­cient way: the half-edge mesh.

What can hemesh do?

The library is cur­rently focused on the stuff I coded it for: 3D voronoi and ran­dom plane divi­sions. So with hemesh we can cre­ate 3D meshes. Sev­eral prim­i­tives are built-in, but any kind of 2-manifold mesh can be turned into a half-edge mesh from its ver­tices and facelist. The weight of the imple­men­ta­tion lies in closed meshes but open sur­faces are han­dled as well.

Cre­at­ing meshes is cool (for a given amount of cool) but destroy­ing them is cooler. Sev­eral mod­i­fiers are pro­vided, either as part of the basic mesh func­tion­al­ity or as sep­a­rate mod­i­fier classes. Sub­di­vi­dors are a spe­cial class of mod­i­fier ori­ented towards sub­di­vi­sions. (The names might not be orig­i­nal but I guess it’s eas­ier to remem­ber than quaghot and umpsink.)

What hemesh can’t do…

The half-edge datas­truc­ture has a few lim­i­ta­tions in itself. In prac­tice, each edge in a mesh can be shared by at most two faces. The imple­men­ta­tion is strongly face-based, iso­lated ver­tices and edges are not sup­ported and will lead to ouchie.

The ini­tial intent of hemesh was to build a sys­tem to pro­to­type geo­met­ric play. So large-scale sys­tems were never a goal. Sev­eral imple­mented algo­rithms are O(n²) and use a lot of stor­age. Con­naiseurs and lec­tors in com­pu­ta­tional geom­e­try are advised to avoid perus­ing the code, bleed­ing eyes often offend. On the pos­i­tive side, there’s room for improvement…

Get­ting hemesh

The library is main­tained at code.google.com. hemesh is cur­rently at beta ver­sion 1.1.0 Down­load and extract the archive inside the Pro­cess­ing ‘libraries’ folder. The ‘hemesh’ sub­folder con­tains sev­eral exam­ples. A Pro­cess­ing ver­sion sup­port­ing JAVA 1.5 syn­tax is rec­om­mended, Rev 180 or higher. In the com­ing days, I’ll post some tuto­ri­als and spiel­erei to illus­trate fur­ther use.

Future

At this time, the library reflects my cur­rent inter­ests. If you want it to do some­thing else, have a sug­ges­tion or hemesh goes hay­wire on you, let me know! One major addi­tion is already planned: boolean mesh oper­a­tions. This is a small step away from completion.

Please enable Javascript and Flash to view this Flash video.

import processing.opengl.*;
import wblut.hemesh.*;
import wblut.geom.*;
HE_Mesh box;

void setup(){
size(600,600,OPENGL);
hint(ENABLE_OPENGL_4X_SMOOTH);
HEC_Box boxCreator=new HEC_Box(this).setWidth(400).setWidthSegments(10)
.setHeight(200).setHeightSegments(4)
.setDepth(200).setDepthSegments(4);
boxCreator.setCenter(100,100,0).setAxis(1,1,1);
box=new HE_Mesh(boxCreator);
HEM_Lattice lattice=new HEM_Lattice().setDepth(10).setWidth(10)
.setFuse(true).setThresholdAngle(HALF_PI);
box.modify(lattice);
}

void draw(){
background(120);
lights();
translate(300,300,0);
rotateY(mouseX*1.0f/width*TWO_PI);
rotateX(mouseY*1.0f/height*TWO_PI);
noStroke();
box.drawFaces();
stroke(0);
box.drawEdges();
}

Trinity

Com­plex­ity, evo­lu­tion, home­osta­sis … If I had to pick the three things that intrigue me the most, these would be the ones. I’m rather fond of them, and pro­tec­tive. It’s time to rant about mis­use, abuse and curi­ous lack-of-use.

Com­plex­ity needs no intro­duc­tion. Any open-minded math or sci­ence course finds some room for esthetic and pseudo-philosophical ram­blings on the damn thing. I guess it’s safe to say that com­plex­ity and its bas­tard child emer­gence have, more than any other idea, attracted flies look­ing for a trendy, post-modern jus­ti­fi­ca­tion of furry think­ing. Well, at least for­mer runner-ups quan­tum physics and chaos the­ory can get a rest from harass­ment by quacks and get back to cre­at­ing inter­est­ing t-shirts.

For the record, I don’t believe in emer­gence in sim­ple sys­tems. Agreed, the unpre­dictable pat­terns cre­ated by Langton’s Ant are inter­est­ing but the only way to explain them is by run­ning through the sim­ple steps of the algo­rithm. There’s no higher level of expla­na­tion, noth­ing beyond the blind fol­low­ing of the rules, no meta sys­tem. I wouldn’t call that emer­gence. A real-life ant-hill is another bucket of inver­te­brates, the many com­plex inter­ac­tions between the ants result in an entity that can almost be explained as a sin­gle organ­ism, mrs. Hill. Even with­out knowl­edge of the algo­rithm, pheromones mostly, we can sen­si­bly pre­dict the behav­ior of an ant-hill. Get­ting swarmed and bit­ten in the unmen­tion­ables, now that’s what I call emer­gence! And the human ant-hill, we’re prob­a­bly up five meta’s (ask any soci­ol­o­gist to explain the behav­ior of a mob by elec­tro­mag­netic inter­ac­tions). As a plus, swarm­ing and unmen­tion­able bit­ing are far less common…

Nev­er­the­less, com­plex­ity in its sim­plest form, small piece­wise algo­rithms build­ing com­plex forms, is a valu­able par­a­digm of gen­er­a­tive art. There’s some­thing sat­is­fy­ing in cre­at­ing a set of rules and the beau­ti­ful images that sprout from them. The ques­tion whether art in gen­er­a­tive art refers to the code, or to the results of the code, is a fun one to dis­cuss in mixed com­pany. How­ever fur­ther depth can­not be found in fast-and-cheap emer­gence. As in any art, mean­ing and sig­nif­i­cance are to be found in the artist and her inten­tions. I for one keep to con­structs, devoid of mean­ing. Yep, I’m shallow.

Richard Dawkins refers to Darwin’s idea of evo­lu­tion as an eye-opener, an idea so pro­found it changes the way you look at the entire world. I know it did for me. The idea itself is remark­ably sim­ple: any repli­cat­ing sys­tem will favor the repli­ca­tor that euh, repli­cates the most suc­ces­fully. I guess it’s more catchy if it involves a gazil­lion species of Gala­pa­gos finches… It res­onates with gen­er­a­tive cre­ation, imagery beyond the con­trol of the coder. A sys­tem that evolves will suit itself to pur­pose and cir­cum­stance in ways a designer could never imag­ine. Not only will the sys­tem work but it’ll keep work­ing after some parts are removed, at least up to a cer­tain level. It will adapt to chang­ing require­ments. If prop­erly cared for, it will wag its pos­te­rior appendage and shed fur all over your furniture.

Yet, despite genetic algo­rithms and their like, human endeavor has only scratched the sur­face. Not only does evo­lu­tion shape organ­isms, it shapes the envi­ron­ment around them. That’s another meta… The clos­est I’ve seen art approach this level is in inter­ac­tive instal­la­tions. These change the behav­ior of the peo­ple around them, at least very locally, and in turn they affect the instal­la­tion. So, if you’ve ever build one of these, I guess you’re enti­tled to a bit of smug­ness. Good for you!

I encoun­tered the con­cept of home­osta­sis only late in my aca­d­e­mic pur­suits. The abil­ity of a liv­ing organ­ism to main­tain a sta­ble, con­stant con­di­tion was the skele­ton onto which my pro­fes­sor phys­i­ol­ogy built a clear pic­ture of our inner work­ings (most of them rather yucky). Instead of a ran­dom col­lec­tion of bio­chem­i­cal sys­tems, the body sud­denly made sense. The sheer ele­gance of the var­i­ous sys­tems that bal­ance each other is an eye-opener of the same mag­ni­tude as Darwin’s idea. In fact, one could claim that home­osta­sis is a direct con­se­quence of evo­lu­tion, as any organ­ism that can’t main­tain its own con­di­tion is … doomed. And damna­tion tends to ham­per procreation.

<side­track> Why hasn’t any­one writ­ten a gen­eral audi­ence book on phys­i­ol­ogy? I mean, cos­mol­ogy, check, evo­lu­tion, check, pi, check, our own bod­ies, not a sausage. Com’on funky scientist/surfer charis­matic dudes out there, there’s a gold­mine of won­ders in there, get writ­ing… (I accept Ama­zon gift cer­tifi­cates). </sidetrack>

<side­track> The uni­ver­sity I went to made reli­gion, psy­chol­ogy and phi­los­o­phy a manda­tory part of every cur­ricu­lum. At this stage I’m won­der­ing if it wouldn’t be a good idea to add some mod­ern biol­ogy and phys­i­ol­ogy. And some­thing arty as well, if you insist. </sidetrack>

I’m not really plugged in into any scene, but so far I haven’t heard of home­osta­sis as a con­cept in mod­ern design cul­ture. As a buzz­word it def­i­nitely has poten­tial. A hint of bio­mimicry, a hint of com­plex­ity, a tad of evo­lu­tion, touches of dynamism and intel­li­gence. A post-modernist delight. I wish I had an aca­d­e­mic career to spend explor­ing home­o­sta­tic struc­tures. Build­ings dynam­i­cally and intel­li­gently, sorry, redis­trib­ut­ing stress after some part fails (i.e. a floor drops out). Heating/cooling sys­tems adapt­ing to sup­ply and demand, not just any plain-old adapt­ing, no, home­o­sta­tic adapt­ing! Traf­fic mim­ic­ing blood flow, self-regulating its pres­sure (and viciously attack­ing annoy­ances as-per-spec). Book­shelves chang­ing shape!!! I could even get some eco in there. Now that would be a very lucra­tive book, the eco­home­o­sta­tic design par­a­digm. Pity, I have no time to write it.


Ooh, ooh, ooh! 3D Voronoi!

I’m sorry, I got a bit excited. But I never thought I’d get this far: actual, geo­met­ri­cally cor­rect 3D Voronoi sub­di­vi­sion. Fol­low­ing my shot­gun approach to 3D Voronoi sub­di­vi­sions in the voronoiBall, it was time to recon­sider the problem.

A 3D Voronoi sub­di­vi­sion is not that hard to imag­ine. Con­sider 2 lonely points in a box. A good way of divid­ing the box is split­ting it with the bisec­tor plane. This plane is per­pen­dic­u­lar to the line con­nect­ing the two points and put exactly halfway between them. voronoi 3d: 2 points in a box There’s no need to limit our­selves to two points. Once we can split by a plane, we can repeat this as often as we like. With three points… voronoi 3d: 3 points in a box or ten (the mad­ness!).. voronoi 3d: 10 points in a box Any­way you got the idea. Now, if you cut by more than one plane, you need some way of select­ing the proper seg­ments. Oth­er­wise you end up with a mess of planes cut­ting planes. It’s an inter­est­ing mess and I might get back to it one day, but it’s not what we’re look­ing for today. If done prop­erly you end up with the Voronoi sub­di­vi­sion of the points bounded by the cube. In anal­ogy with my dab­blings in 2D Voronoi, I thought this selec­tion was going to be the tough part. Boy, was I wrong…

To be con­tin­ued. (In the mean­time, feel free to explore the code.)

voronoi3d

body in a box, W:Blut, 2009

notes

notes2


Voronoi showcase

The voronoi frac­tal sketch has got­ten some extra atten­tion lately: 1, 2 and 3.  So I got side­tracked from my cur­rent project. It’s fun to get some feed­back, but it’s also a bit wor­ry­ing. The code I write was never meant for close scrutiny. It’s shared like pages from a scrap­book lying in a pud­dle in the street, kind of.

I guess it’s time to doc­u­ment and clean up the code. In the mean­time, some sam­ple images from the vari­a­tions that inevitably show up when rewrit­ing something.

Please enable Javascript and Flash to view this Flash video.