Code Monkey home page Code Monkey logo

Comments (6)

lukkio88 avatar lukkio88 commented on July 17, 2024

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.

from boundary-first-flattening.

lukkio88 avatar lukkio88 commented on July 17, 2024

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?

from boundary-first-flattening.

lukkio88 avatar lukkio88 commented on July 17, 2024

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?

from boundary-first-flattening.

rohan-sawhney avatar rohan-sawhney commented on July 17, 2024

The mesh class "normalizes" the model, which it probably shouldn't do. I would comment out this line:

from boundary-first-flattening.

lukkio88 avatar lukkio88 commented on July 17, 2024

Is this final normalization a mistake then?

from boundary-first-flattening.

rohan-sawhney avatar rohan-sawhney commented on July 17, 2024

Yes, it won't be there in the next version.

from boundary-first-flattening.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.