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

Signing Processing applets

Robustness of geo­met­ric algo­rithms is a prime con­cern in my hemesh library. It is sur­pris­ing how fast the intri­ca­cies of floating-point cal­cu­la­tions crop up and ren­der your code fickle and buggy. It’s easy to for­get that com­puter math is not the same as reg­u­lar math. Rather, it is a dis­crete limited-domain sim­u­la­tion of real mathematics.

I’m cur­rently adding some new plumb­ing to hemesh using an arbi­trary pre­ci­sion library, Apfloat. because it’s a lot slower it is only called when nec­es­sary. Including it had an unex­pected side-effect. Apfloat requires infor­ma­tion about your sys­tem when it’s run­ning in a browser. It needs your machine’s inher­ent precision.

However, access­ing your com­puter is a big no-no for my code. So unless the applets are signed, they won’t run because of secu­rity restric­tions. In itself, this is not really a prob­lem, we can still share code and show each other images. But I’d rather keep shar­ing applets, these always include the cor­rect libraries and often rely on unre­leased alpha-level mod­i­fi­ca­tions of my library.

I can’t claim a proper under­stand­ing of Java secu­rity issues and all details about sign­ing. But I’ve been look­ing around and gath­ered masses of raw data, info-ore. I’ve smelted it down to an ingot of use­ful­ness. In short, this is how you sign a Processing applet with­out know­ing what you’re doing. On a Windows machine… (don’t be too dis­ap­pointed, the essen­tials are the same on hip­ster machines.)

Preparations

1) First locate your Java Development Kit (JDK) dis­tri­b­u­tion. If you’re using Eclipse, or pro­gram in JAVA, you prob­a­bly have one around some­where. If not, Processing has it included in its \java sub­di­rec­tory. Check out the con­tents of the \bin folder. See all those exe­cuta­bles, we’ll be using a few of those. Let’s say you traced your JDK to c:\processing\java. So any­where the text men­tions c:\processing\java\bin sub­sti­tute this with your own location.

2) Include the \bin sub­di­rec­tory in your system’s PATH. Check this if you aren’t sure how, of course use c:\processing\java\bin instead of the Matlab exam­ple. This’ll save you a lot of typ­ing. The exe­cuta­bles in the bin folder can now be called from any directory.

3) Create a folder to store your key­store, the repos­i­tory for your cer­tifi­cates. I’ll be using c:\keystore.

Creating your certificate

4) Open up a com­mand prompt (press windows+r, type cmd). If you set up the PATH prop­erly, you can access the com­mands we’ll be using any­where. Otherwise you’ll have to call them with their full path… We’ll cre­ate a key­store and a first cer­tifi­cate mykey now. Since our keys will be self-certified only (i.e. no cer­ti­fy­ing agency will vouch for your good inten­tions), we’ll give them a valid­ity of 100 years. That should be enough…

keytool -genkey -keystore c:\keystore\mykeystore.jks -alias mykey -validity 36500

Since this is the first time the key­store is accessed, you’ll need to input some impor­tant info. Just choose a decent key­store pass­word (let’s say passw0rd ;) ) and fill in the rest. After fill­ing in your data, key­tool will ask for the key pass­word. You can keep this the same as the key­store pass­word, just enter and fin­ish. You now have a key­store with a sin­gle cer­tifi­cate mykey in it.

5) Now we’ll make the cer­tifi­cate self-certified. It’s up to the end-user whether or not he’ll trust your applet.

keytool -selfcert -keystore c:\keystore\mykeystore.jks -alias mykey

Signing your applet

6) I now have an applet I want to share and that requires sign­ing:c:\sketchbook\condel. First export the applet. The /applet sub­di­rec­tory now con­tains all Java archives (JAR) asso­ci­ated with your sketch. We’ll need to sign all of them, even if only one requires authentication.

7) Re-open the com­mand win­dow if nec­es­sary and nav­i­gate to c:\sketchbook\condel\applet. For every JAR run this:
jarsigner -keystore c:\keystore\mykeystore.jks -storepass passw0rd -keypass passw0rd core.jar mykey

In my case, I have core.jar, hemesh.jar, apfloat.jar and sev­eral oth­ers I’ll need to sign.

8) Done! You can upload the applet. If some­body accesses the page she will be given the choice of trust­ing the applet. If yes, then the applet will run. If no, then it won’t.… I’ve cre­ated condel this way.


McCabeism: animations


Snippets VII: 2D boolean

Another demo of the wblut.geom and wblut.geom2d pack­ages included with hemesh. Meshes are gen­er­ated by the inter­sec­tion of two stars.

2dboolean

2dboolean

Hemesh : a 3D mesh library for Processing

UPDATE : He_Mesh has grown enough to give it its own site: http://hemesh.wblut.com/. In time, the new site will con­tain tuto­ri­als and in-depth explanations.

Coded, recoded, lost, recoded and recoded … hemesh, the half-edge mesh library for Processing 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 datastructure for manip­u­lat­ing 3D meshes in Processing. Basically it’s a toolset to extend my Processing sand­box to a proper playground.

Generating 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. However, 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,… Keeping 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. Several 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.

Creating meshes is cool (for a given amount of cool) but destroy­ing them is cooler. Several 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. Subdividors 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 limitations 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. Several imple­mented algo­rithms are O(n²) and use a lot of stor­age. Connaiseurs 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…

Getting hemesh

The library is main­tained at code.google.com. hemesh is cur­rently at beta ver­sion 1.1.01.3.0 Download and extract the archive inside the Processing ‘libraries’ folder. The ‘hemesh’ sub­folder con­tains sev­eral exam­ples. A Processing 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();
}