SeamAwareDecimater icon indicating copy to clipboard operation
SeamAwareDecimater copied to clipboard

decimate_down_to always return false

Open Zeta48 opened this issue 1 year ago • 0 comments

I am trying to add mesh decimation to my engine using your SeamAwareDecimater. Unfortunaletly the decimate_down_to method always return false.

Even that small 2 triangles example fails: `

		const int inNbVertices = 4;
		// 4 Vertices
		Eigen::MatrixXd V(inNbVertices, 3);
		{
			V(0, 0) = 0.0; V(0, 1) = 0.0; V(0, 2) = 0.0;
			V(1, 0) = 0.0; V(1, 1) = 1.0; V(1, 2) = 0.0;
			V(2, 0) = 1.0; V(2, 1) = 0.0; V(2, 2) = 0.0;
			V(3, 0) = 1.0; V(3, 1) = 1.0; V(3, 2) = 0.0;
		}

		// 4 texture coordinates
		Eigen::MatrixXd TC(inNbVertices, 2);
		{
			TC(0, 0) = 0.0; TC(0, 1) = 0.0;
			TC(1, 0) = 0.0; TC(1, 1) = 1.0;
			TC(2, 0) = 1.0; TC(2, 1) = 0.0;
			TC(3, 0) = 1.0; TC(3, 1) = 1.0;
		}

		// 2 faces
		const int inNbFaces = 2;
		Eigen::MatrixXi F(inNbFaces, 3);
		Eigen::MatrixXi FT(inNbFaces, 3);
		{
			{
				F(0, 0) = 0; F(0, 1) = 3; F(0, 2) = 1;
				F(1, 0) = 0; F(1, 1) = 2; F(1, 2) = 3;
			}
			FT = F;
		}

		// Perform decimation.
		const int target_num_vertices = 3;//75%
		const int seam_aware_degree = int(SeamAwareDegree::Seamless);

		Eigen::MatrixXd V_out, TC_out;
		Eigen::MatrixXi F_out, FT_out;

		const bool success = decimate_down_to(V, F, TC, FT, target_num_vertices, V_out, F_out, TC_out, FT_out, seam_aware_degree);
		assert(success);

`

Am i doing something wrong?

Zeta48 avatar Apr 05 '23 00:04 Zeta48