diff --git a/mesh/readBDL.m b/mesh/readBDL.m index 34b24b9b..0a001b0c 100644 --- a/mesh/readBDL.m +++ b/mesh/readBDL.m @@ -73,3 +73,4 @@ fseek(fp, chunkSize, 'cof'); end end +end diff --git a/mesh/tri2tgf.m b/mesh/tri2tgf.m index a548bbfc..dc0b4b15 100644 --- a/mesh/tri2tgf.m +++ b/mesh/tri2tgf.m @@ -13,9 +13,9 @@ function tri2tgf(input_name,output_name) [V,F] = load_mesh(input_name); % Find all edges in mesh, note internal edges are repeated E = sort( ... - [F(:,1) (:,2); ... - F(:,2) (:,3); ... - F(:,3) (:,1)]')'; + [F(:,1) F(:,2); ... + F(:,2) F(:,3); ... + F(:,3) F(:,1)], 2); % remove duplicates E = unique(E,'rows'); writeTGF(output_name,V,E); diff --git a/mesh/udq2quattrans.m b/mesh/udq2quattrans.m index fd9254b1..12166c7c 100644 --- a/mesh/udq2quattrans.m +++ b/mesh/udq2quattrans.m @@ -29,10 +29,10 @@ -UDQ(2,1,:).*UDQ(1,3,:) + ... UDQ(2,2,:).*UDQ(1,4,:) + ... UDQ(2,3,:).*UDQ(1,1,:) - ... - UDQ(2,4,:).*UDQ(1,2,:); + UDQ(2,4,:).*UDQ(1,2,:)); T(:,3) = 2.0*( ... -UDQ(2,1,:).*UDQ(1,4,:) - ... UDQ(2,2,:).*UDQ(1,3,:) + ... UDQ(2,3,:).*UDQ(1,2,:) + ... - UDQ(2,4,:).*UDQ(1,1,:); + UDQ(2,4,:).*UDQ(1,1,:)); end diff --git a/mesh/writeBDL.m b/mesh/writeBDL.m index 943c5849..e642387a 100644 --- a/mesh/writeBDL.m +++ b/mesh/writeBDL.m @@ -27,7 +27,7 @@ function writeBDL(filename,V,F) fwrite(fp, nBytes, 'int64'); end - function bundle = writeBDLMeshChunk(fp, mesh) + function writeBDLMeshChunk(fp, mesh) % write a mesh chunk to a file stream that can be processed by the external % viewer. % @@ -52,13 +52,13 @@ function writeBDL(filename,V,F) end nCperCol = 0; - if isfield(mesh,'col') nCperCol = size(mesh.col,2); end + if isfield(mesh,'col'); nCperCol = size(mesh.col,2); end baseColor = [1,1,1,1]; - if isfield(mesh,'baseColor') baseColor = mesh.baseColor; end + if isfield(mesh,'baseColor'); baseColor = mesh.baseColor; end nCperUV = 0; - if isfield(mesh,'UV') nCperUV = size(mesh.UV,2); end + if isfield(mesh,'UV'); nCperUV = size(mesh.UV,2); end nCperNormal = 0; strip = 0; @@ -78,9 +78,9 @@ function writeBDL(filename,V,F) fwrite(fp, baseColor, 'float32'); fwrite(fp, mesh.V', 'float32'); - if isfield(mesh,'UV') fwrite(fp, mesh.UV', 'float32'); end - if isfield(mesh,'col') fwrite(fp, mesh.col', 'float32'); end - if isfield(mesh,'F') fwrite(fp, mesh.F'-1, 'uint32'); % faces are 1-based in matlab + if isfield(mesh,'UV'); fwrite(fp, mesh.UV', 'float32'); end + if isfield(mesh,'col'); fwrite(fp, mesh.col', 'float32'); end + if isfield(mesh,'F'); fwrite(fp, mesh.F'-1, 'uint32'); end% faces are 1-based in matlab chunkSize = ftell(fp) - chunkStart;