Closed lukkio88 closed 5 years ago
Just done the following check:
#include <Bff.h>
#include <MeshIO.h>
#include <iostream>
int main(int argc, char** argv) {
std::ifstream ifs("./test_mesh.obj");
std::stringstream ss_content;
std::string content;
std::istringstream iss_content;
if(ifs) {
std::cout << "Reading file!" << std::endl;
ss_content << ifs.rdbuf();
content = ss_content.str();
iss_content = std::istringstream(content);
}
ifs.close();
Mesh test_mesh;
if(!MeshIO::read(iss_content,test_mesh))
std::cout << "Reading problems!" << std::endl;
test_mesh.write("./output_test_mesh.obj", false, false);
return 0;
}
And I get the same problem, so the processing has nothing to do with it.
The output of your binaries is instead the following:
v 0.707107 -0.707107 0
v 0.707107 0.707107 0
v -0.707107 0.707107 0
v -0.707107 -0.707107 0
vt 1 2e-08
vt -1e-08 1
vt 1e-08 -1
vt -1e-08 1
vt -1 -2e-08
vt 1e-08 -1
f 1/3 2/1 3/2
f 1/6 3/4 4/5
Why are the coordinates scaled?
Never mind it worked... I probably wasn't supposed to use the MeshIO
class... by using the following
#include <Bff.h>
#include <MeshIO.h>
#include <iostream>
int main(int argc, char** argv) {
Mesh test_mesh;
if(!test_mesh.read("./test_mesh.obj"))
std::cout << "Reading problems!" << std::endl;
BFF flattening_module(test_mesh);
EigenDenseMatrix boundaryData(flattening_module.data->bN);
std::cout << "flattening mesh" << std::endl;
flattening_module.flatten(boundaryData,true);
std::cout << "mesh flattened, now storing into a file" << std::endl;
test_mesh.write("./output_test_mesh.obj",false,true);
return 0;
}
I got the following output:
v 0.707107 -0.707107 0
v 0.707107 0.707107 0
v -0.707107 0.707107 0
v -0.707107 -0.707107 0
vt 0.853553 0.853553
vt 0.146447 0.853553
vt 0.853553 0.146447
vt 0.146447 0.853553
vt 0.146447 0.146447
vt 0.853553 0.146447
f 1/3 2/1 3/2
f 1/6 3/4 4/5
Which is the same as the one provided by your tool (with the rescaling enabled). But again, is there a reason why the coordinates are scaled?
The mesh class "normalizes" the model, which it probably shouldn't do. I would comment out this line: https://github.com/GeometryCollective/boundary-first-flattening/blob/23d8448a817f5175ebffd79f233076444b3a8d5e/mesh/src/Mesh.cpp#L34
Is this final normalization a mistake then?
Yes, it won't be there in the next version.
Hi, as I mentioned I've been trying to integrate Eigen in your tool. I managed to do that, I run the tool as suggested, but the output is a mesh with same vertices as the original one + the new UV and but all the faces are set to 0.
My main looks like the following:
The only code I changed are the linear algebra wrappers, but nothing has changed inside the
Mesh BFF, BFFData
andMeshIO
, so I assume the manipulation of the indices should be the same as before.I cannot explain why I'm getting something like the following for the faces:
Input:
Output:
Any advice?