// node space experiment // conceived from a ongoing context browser project idea // nodes and their interrelations a represented and rendered as metaballs // rasterization is using thick lines parallel to vector(1,0,-1) // author: info@toxi.co.uk // last modified: 08/10/03 NodeSpace ns; int NodeCount=10; int spaceUnits=100; int unitOffset=spaceUnits/2; float currScale=0.01; float maxScale=3; int stepSize=4; void setup() { size(760,400); ns=new NodeSpace(spaceUnits,spaceUnits,spaceUnits,NodeCount); for(int i=1; ispaceUnits+40 || y>spaceUnits+40 || z>spaceUnits+40) this.init(-random(unitOffset),-random(unitOffset),-random(unitOffset)); } } class NodeSpace { Node[] nodes; int numNodes; int w,h,d; int w2,h2,d2; NodeSpace(int ww,int hh,int dd, int maxNodes) { w=ww; h=hh; d=dd; w2=w/2; h2=h/2; d2=d/2; nodes=new Node[maxNodes]; numNodes=0; } void addNode(Node n) { nodes[numNodes++]=n; } void updateNodes() { for(int i=0; i=0) { // compute potential at curr point //potential=noise(pos[0]*0.1,sliceY*0.1,pos[2]*0.1); potential=calcPotentialAt(pos[0],pos[1],pos[2]); if (potential>isoLevel1 && potential=0) { // compute potential at curr point //potential=noise(pos[0]*0.1,sliceY*0.1,pos[2]*0.1); potential=calcPotentialAt(pos[0],pos[1],pos[2]); if (potential>isoLevel1 && potential=0 && nodes[i].x<=w && nodes[i].y>=0 && nodes[i].y<=h && nodes[i].z>=0 && nodes[i].z<=d) { push(); translate(nodes[i].x-w2,nodes[i].y-h2,nodes[i].z-d2); box(sz); pop(); } } } }