furlyman
YaBB Newbies
Offline
Posts: 14
Re: 3d points/map
Reply #6 - Sep 13th , 2009, 10:18pm
here's the code that gets me most of the way there. the only drawback is that using points doesn't scale the size of the points in the distance, and it appears that i have too many coordinates (over 5000) to use spheres. this makes it a little difficult to get perspective on the data. thanks for all you help guys! import de.bezier.data.*; XlsReader reader; import peasy.*; PeasyCam cam; float [] xpos = new float[7000]; float [] ypos = new float [7000]; float [] zpos = new float [7000]; void setup() { size(1300, 1000, P3D); smooth(); cam = new PeasyCam(this, 100); cam.setMinimumDistance(10); cam.setMaximumDistance(200); reader = new XlsReader( this, "blah.xls" ); float xmax = getColMax(6); float xmin = getColMin(6); float ymax = getColMax(7); float ymin = getColMin(7); float zmax = getColMax(8); float zmin = getColMin(8); for (int d = 1; d < reader.getLastRowNum(); d++){ xpos[d]= map(reader.getFloat(d, 6),xmax,xmin,0,abs(xmax-xmin)); ypos[d]= map(reader.getFloat(d, 7),ymax,ymin,0,abs(ymax-ymin)); zpos[d]= map(reader.getFloat(d, 8),zmax,zmin,0,abs(zmax-zmin)); } } void draw() { background(0); stroke(250,250,25); strokeWeight(2); point(xpos[0], ypos[0], zpos[0]); for (int g = 1; g <5000; g++){ point(xpos[g], ypos[g], zpos[g]); } for (int h = 0; h < 100; h++){//draw x axis stroke(255,h*5,0); point(h,0,0); } for (int h = 0; h < 100; h++){// draw y axis stroke(h*5,255,0); point(0,h,0); } for (int h = 0; h < 100; h++){// draw z axis strokeWeight(3); stroke(0,255,h*5); point(0,0,h); } }