public
Created

  • Download Gist
3d_data.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
-1.22920245520088 1.26297072626596 1.83337525320795
1.20936180458861 0.611215979963239 -1.30133702133403
0.522987838117479 -0.451731971345027 -0.58388185591968
0.101340272969554 -0.435726497850704 0.569398963635685
0.426031516466784 0.151080475310323 0.956491447694583
-0.252059713648723 -0.175471660877733 -0.980883888395024
0.662052189667485 1.33212600996006 -1.47268894052709
1.48817331808508 -0.0473711069814109 -0.492789669961388
-0.503441036994115 -0.294926138113795 0.366179342735957
-2.12920560829524 1.02332212331524 -1.58266122316052
0.0333696028917393 0.607482935093015 0.062048962482562
-0.108377156741774 1.61845876637128 -1.21420675867615
-1.53690377980258 0.27913592923595 1.48958924068119
-1.01476946747815 0.0679527517044784 1.43379969250667
-1.29733848956707 -1.24322644398551 0.0781768848245438
1.11469504959544 0.307293949658199 -0.293061581364159
1.44300804471195 -0.379787810339892 0.154570838330972
1.18699674944511 0.222185114055329 -2.04601385951423
0.0353333287301387 -0.508076936413495 1.69890150090395
-1.28855022172269 -1.06457194457426 -0.5141811123489
-0.60420723780604 -0.080216375835249 1.15552521510425
1.05398026630596 0.917595995252196 -2.55710067065376
-0.375811397519651 -0.00774275638242981 0.316795479285581
1.38918200063111 1.85943697701714 0.0130839595805375
-0.210375063178721 -0.367274818003115 0.206865195796925
-1.65206767947753 -0.58181817734415 0.633602570226003
-0.661922693383632 0.484506412360496 -1.48130492893109
-0.587613364808775 -0.406680637840752 -0.226170287080826
1.17111391774896 -0.173488756598797 -2.09034085772045
-0.167479971046896 2.7861854961422 -0.962444030628109
0.962575750696042 1.00021302670012 0.604942475622883
-0.679019154526634 0.365834123198408 0.50153468355636
-0.605876887336055 -1.13373709445113 -0.311089762372643
-0.495208137602755 0.07600917006355 0.685679323077719
1.00275091807029 0.539230311189364 0.190429280366654
-1.84884494166703 0.422101254358016 0.823271850068232
-1.28908781880381 0.474454422189027 0.524764950032975
1.5983370625349 0.415056252893829 1.00733246446985
0.512290873195218 0.82117827523033 1.33528658827839
2.75688818553458 0.577358425234337 0.0472076071995961
-0.110531383591239 0.644849900752487 -0.83737521524379
0.0990914939350696 -0.228873251193224 1.20072950687097
1.72030212503451 0.987118273842401 0.878718959520318
0.411039521549277 -0.659976703910251 -0.542728817144429
0.686587629306125 1.38338066717718 -1.5922885069831
-0.532755386468959 1.39977662671441 -1.28640456247106
0.628888822525878 0.347464405119494 2.75574992168252
0.423605256282334 -0.427764697432649 -0.347475819039854
-0.639897338821274 4.293821569178 -0.560449748759062
1.34127737243162 0.889031039743162 0.554807601599797
0.25835229477258 0.775138960171794 0.710725074199095
0.810925908141172 0.698432845393356 0.214930083239088
0.453836544326775 -0.753019773021281 1.62064618259897
-0.710524630532146 0.735324475059198 -0.190671758633825
-1.5521211878096 -2.67606104487225 0.529231649720989
-0.344927097885301 0.965299742326822 -0.60230318712584
0.849969778023071 0.81721382299816 0.346643605430721
2.32661801570721 0.497929435437024 0.709523372286099
-0.501024743459356 0.680174243224324 -0.431800635126306
-1.0279725535517 0.0607502314512954 2.25076174223735
-0.474850458550325 0.784894764765977 0.144435298650133
0.244418674608334 1.55323062922233 -1.82152574828116
-0.410902244286904 1.54260076740748 -1.40001173003853
0.112914254915835 -2.88578214029554 0.803013136536199
0.0339552073980012 0.665499980066827 0.0748220475738047
0.78293771930752 1.0050394461821 0.128906360049258
-0.0118997180376744 2.20661076863967 -0.856488414426482
0.0773480905258162 0.871463640630162 0.269900943987146
1.00614243437056 -0.272934859456963 -0.36892722970238
0.811017195057145 0.126580308409256 2.07822089379117
-0.509086170525439 -0.134078281491426 1.24363097539062
-0.787784130128316 -0.885344929870242 -2.04864798165846
0.194217175301617 -0.308535132000841 0.198442525381634
-1.56664683614523 2.43029999081974 -1.75085239826812
1.10798630357026 -0.75750853230008 -1.60060906308456
-0.121228467976172 -0.0895042599375774 1.758838253016
0.636296942657262 0.274678455350121 -0.0233383571145547
-0.160777524094709 -0.0085895597338435 1.56618308602691
0.262472856757263 0.784115153769515 0.274531914174623
0.237096174023016 0.268031903604491 -0.745299026237023
0.707729309465513 0.845208514738601 -0.649296126797862
-1.28791684155213 -0.867666519184028 0.56238785066433
-1.25238999900757 -1.84200408357575 -1.18446941245004
-0.537199742199359 -0.557378567766443 -0.102139737810163
0.0908970567944377 -0.371087487199626 1.6750611070369
0.857532415775255 1.83708087700684 1.06785654931527
0.285145058254306 -0.374327543054641 1.44416941374839
0.0245836151033084 -0.528610352368707 0.621158816561301
1.21001562037365 -0.336061710741499 0.903463808864141
0.927492326375271 -0.16670439451648 1.06966973354685
-0.153496064807856 0.525462389681399 -1.18588381860732
-1.1485732272638 1.34404133448765 -0.389596682933675
-0.0413559065204696 -0.990866544321361 1.31094363333544
-1.30929844750198 0.995364874016275 -0.24635963587644
-0.448824542356067 -0.0252174959124236 0.684897916296398
-1.23020809889045 -0.343410908404823 -0.915808954886614
0.424823826890641 -1.55211853488215 0.0818888333093576
0.533457274196888 -0.838236679179732 0.367844238261844
-1.33641224559998 0.619747871340238 -0.664184727035492
-1.37917479456488 -0.565457169741251 1.03165093472332
processing_test.html
HTML
1 2 3 4 5 6 7 8 9 10 11
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Processing.js Demo</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head>
 
<body>
<script src="processing-1.3.6.js" type="text/javascript"></script>
<canvas data-processing-sources="processing_test.pde"></canvas>
</body>
processing_test.pde
Processing
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
String[] lines;
float[] x, y, z;
int scale = 5;
int axis = 20;
 
void setup() {
size(640, 480, P3D);
// Load scatterplot data
lines = loadStrings("3d_data.txt");
x = new float[lines.length];
y = new float[lines.length];
z = new float[lines.length];
for (int i=1; i < lines.length; i++) {
String[] pieces = split(lines[i], ' ');
x[i] = float(pieces[0]);
y[i] = float(pieces[1]);
z[i] = float(pieces[2]);
}
}
 
void draw() {
colorMode(RGB, 1);
camera(50*sin(PI*mouseX/width), 50*cos(PI*mouseX/width), 10, 0, 0, 0, 0, 0, -1);
// Make axis
background(1);
noFill();
stroke(0);
line(-1*axis, 0, 0, 1*axis, 0, 0);
line(0, -1*axis, 0, 0, 1*axis, 0);
line(0, 0, -1*axis, 0, 0, 1*axis);
// Plot points
for (int i=1; i < x.length; i++) {
pushMatrix();
translate(scale*x[i], scale*y[i], scale*z[i]);
fill(0);
box(0.05*scale);
noFill();
popMatrix();
}
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.