diff --git a/script/tools/matlab/effectorRomToObj.m b/script/tools/matlab/effectorRomToObj.m new file mode 100755 index 0000000000000000000000000000000000000000..59ff8697e1d9723569c1aa2410d37277f2773d08 --- /dev/null +++ b/script/tools/matlab/effectorRomToObj.m @@ -0,0 +1,6 @@ +function [] = effectorRomToObj(filename, outname) +delimiterIn = ','; +headerlinesIn = 0; +points = importdata(filename,delimiterIn,headerlinesIn); +k = convhull(points); +vertface2obj(points,k,outname) diff --git a/script/tools/matlab/vertface2obj.m b/script/tools/matlab/vertface2obj.m new file mode 100755 index 0000000000000000000000000000000000000000..04c887bbf168b40a26963a3343b397cd3acbbc8c --- /dev/null +++ b/script/tools/matlab/vertface2obj.m @@ -0,0 +1,21 @@ +function vertface2obj(v,f,name) +% VERTFACE2OBJ Save a set of vertice coordinates and faces as a Wavefront/Alias Obj file +% VERTFACE2OBJ(v,f,fname) +% v is a Nx3 matrix of vertex coordinates. +% f is a Mx3 matrix of vertex indices. +% fname is the filename to save the obj file. + +fid = fopen(name,'w'); + +for i=1:size(v,1) +fprintf(fid,'v %f %f %f\n',v(i,1),v(i,2),v(i,3)); +end + +fprintf(fid,'g foo\n'); + +for i=1:size(f,1); +fprintf(fid,'f %d %d %d\n',f(i,1),f(i,2),f(i,3)); +end +fprintf(fid,'g\n'); + +fclose(fid);