LuigiGiaccari / Surface-Reconstruction-Toolbox

Offers several algorithms to triangulate 3d scattered points
GNU General Public License v3.0
45 stars 10 forks source link

Matlab commands to generate .dat (binary) file #14

Open ZhongweiXu opened 7 years ago

ZhongweiXu commented 7 years ago

I used the provided codes for generate .dat file, but then the surface reconstruction based on this dat file was totally wrong.

Then I noticed you wrote: "Points are stored this way: X1,Y1,Z1,X2,Y2,Z2……", however, if the point cloud in matlab is stored in a N x 3 matrix, like below:

p = 0,060649 0,011160 0,059552 0,060351 0,012167 0,058159 0,060749 0,012164 0,059571 0,060267 0,011162 0,058137 0,060278 0,013168 0,058137 0,060653 0,013164 0,059557

using this line "fwrite(fid,p,'double');%points;" to write, the points will be stored in this way: X1,X2,X3...., XN, Y1,Y2,Y3,...,YN, ..., Z1,Z2,Z3,...ZN, because Matlab read p(:) along the column by column, not row by row.

I just changed the line "fwrite(fid,p,'double');%points;" -> "fwrite(fid,p','double');%points;" everything works fine now.

LuigiGiaccari commented 7 years ago

Thanks ZhongweiXu,

I have fixed the typo. Please let me know if face any other issues.

Thanks

Luigi