Merge pull request #1365 from libigl/alecjacobson-patch-test_common
Update test_common.h
This commit is contained in:
@@ -10,7 +10,7 @@ TEST_CASE("avg_edge_length: cube", "[igl]")
|
||||
Eigen::MatrixXd V;
|
||||
Eigen::MatrixXi F;
|
||||
//This is a cube of dimensions 1.0x1.0x1.0
|
||||
test_common::load_mesh("cube.obj", V, F);
|
||||
igl::read_triangle_mesh(test_common::data_path("cube.obj"), V, F);
|
||||
//Create scaled versions of the cube
|
||||
double scale = 1.0;
|
||||
double huge_scale = 1.0e8;
|
||||
|
||||
@@ -9,7 +9,7 @@ TEST_CASE("boundary_loop: cube", "[igl]")
|
||||
Eigen::MatrixXd V;
|
||||
Eigen::MatrixXi F;
|
||||
//This is a cube of dimensions 1.0x1.0x1.0
|
||||
test_common::load_mesh("cube.off", V, F);
|
||||
igl::read_triangle_mesh(test_common::data_path("cube.off"), V, F);
|
||||
|
||||
//Compute Boundary Loop
|
||||
Eigen::VectorXi boundary;
|
||||
@@ -24,7 +24,7 @@ TEST_CASE("boundary_loop: bunny", "[igl]")
|
||||
Eigen::MatrixXd V;
|
||||
Eigen::MatrixXi F;
|
||||
//Load the Stanford bunny
|
||||
test_common::load_mesh("bunny.off", V, F);
|
||||
igl::read_triangle_mesh(test_common::data_path("bunny.off"), V, F);
|
||||
|
||||
//Compute list of ordered boundary loops for a manifold mesh
|
||||
std::vector<std::vector<int> >boundaries;
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace {
|
||||
TEST_CASE("MeshBoolean: TwoCubes", "[igl/copyleft/boolean]") {
|
||||
Eigen::MatrixXd V1;
|
||||
Eigen::MatrixXi F1;
|
||||
test_common::load_mesh("two-boxes-bad-self-union.ply", V1, F1);
|
||||
igl::read_triangle_mesh(test_common::data_path("two-boxes-bad-self-union.ply"), V1, F1);
|
||||
|
||||
Eigen::MatrixXd V2(0, 3);
|
||||
Eigen::MatrixXi F2(0, 3);
|
||||
@@ -76,8 +76,8 @@ TEST_CASE("MeshBoolean: MinusTest", "[igl/copyleft/boolean]") {
|
||||
// Many thanks to Eric Yao for submitting this test case.
|
||||
Eigen::MatrixXd V1, V2, Vo;
|
||||
Eigen::MatrixXi F1, F2, Fo;
|
||||
test_common::load_mesh("boolean_minus_test_cube.obj", V1, F1);
|
||||
test_common::load_mesh("boolean_minus_test_green.obj", V2, F2);
|
||||
igl::read_triangle_mesh(test_common::data_path("boolean_minus_test_cube.obj"), V1, F1);
|
||||
igl::read_triangle_mesh(test_common::data_path("boolean_minus_test_green.obj"), V2, F2);
|
||||
|
||||
igl::copyleft::cgal::mesh_boolean(V1, F1, V2, F2,
|
||||
igl::MESH_BOOLEAN_TYPE_MINUS,
|
||||
@@ -91,7 +91,7 @@ TEST_CASE("MeshBoolean: MinusTest", "[igl/copyleft/boolean]") {
|
||||
TEST_CASE("MeshBoolean: IntersectWithSelf", "[igl/copyleft/boolean]") {
|
||||
Eigen::MatrixXd V1, Vo;
|
||||
Eigen::MatrixXi F1, Fo;
|
||||
test_common::load_mesh("cube.obj", V1, F1);
|
||||
igl::read_triangle_mesh(test_common::data_path("cube.obj"), V1, F1);
|
||||
|
||||
igl::copyleft::cgal::mesh_boolean(V1, F1, V1, F1,
|
||||
igl::MESH_BOOLEAN_TYPE_INTERSECT,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
TEST_CASE("CSGTree: extrusion", "[igl/copyleft/cgal]") {
|
||||
Eigen::MatrixXd V;
|
||||
Eigen::MatrixXi F;
|
||||
test_common::load_mesh("extrusion.obj", V, F);
|
||||
igl::read_triangle_mesh(test_common::data_path("extrusion.obj"), V, F);
|
||||
igl::copyleft::cgal::CSGTree tree(V, F);
|
||||
igl::copyleft::cgal::CSGTree inter(tree, tree, "i"); // returns error
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@ TEST_CASE("hausdorff: knightVScheburashka", "[igl/copyleft/cgal]")
|
||||
{
|
||||
Eigen::MatrixXd VA,VB;
|
||||
Eigen::MatrixXi FA,FB;
|
||||
test_common::load_mesh("decimated-knight.obj", VA, FA);
|
||||
test_common::load_mesh("cheburashka.off", VB, FB);
|
||||
igl::read_triangle_mesh(test_common::data_path("decimated-knight.obj"), VA, FA);
|
||||
igl::read_triangle_mesh(test_common::data_path("cheburashka.off"), VB, FB);
|
||||
//typedef CGAL::Epeck Kernel;
|
||||
typedef CGAL::Simple_cartesian<double> Kernel;
|
||||
CGAL::AABB_tree<
|
||||
|
||||
@@ -12,7 +12,7 @@ TEST_CASE(
|
||||
{
|
||||
Eigen::MatrixXd V;
|
||||
Eigen::MatrixXi F;
|
||||
test_common::load_mesh(param, V, F);
|
||||
igl::read_triangle_mesh(test_common::data_path(param), V, F);
|
||||
CGAL::Polyhedron_3<
|
||||
CGAL::Simple_cartesian<double>,
|
||||
CGAL::Polyhedron_items_with_id_3,
|
||||
@@ -31,7 +31,7 @@ TEST_CASE(
|
||||
{
|
||||
Eigen::MatrixXd V;
|
||||
Eigen::MatrixXi F;
|
||||
test_common::load_mesh("truck.obj", V, F);
|
||||
igl::read_triangle_mesh(test_common::data_path("truck.obj"), V, F);
|
||||
CGAL::Polyhedron_3<
|
||||
CGAL::Simple_cartesian<double>,
|
||||
CGAL::Polyhedron_items_with_id_3,
|
||||
|
||||
@@ -54,7 +54,7 @@ void assert_order(
|
||||
Eigen::MatrixXd N;
|
||||
//igl::per_face_normals_stable(V, F, N);
|
||||
//igl::per_face_normals(V, F, N);
|
||||
test_common::load_matrix(normal, N);
|
||||
igl::readDMAT(test_common::data_path(normal), N);
|
||||
igl::copyleft::cgal::order_facets_around_edges(
|
||||
V, F, N, uE, uE2E, uE2oE, uE2C);
|
||||
} else {
|
||||
@@ -192,9 +192,9 @@ TEST_CASE("copyleft_cgal_order_facets_around_edges: NormalSensitivity", "[igl/co
|
||||
// results in very different ordering of facets.
|
||||
|
||||
Eigen::MatrixXd V;
|
||||
test_common::load_matrix("duplicated_faces_V.dmat", V);
|
||||
igl::readDMAT(test_common::data_path("duplicated_faces_V.dmat"), V);
|
||||
Eigen::MatrixXi F;
|
||||
test_common::load_matrix("duplicated_faces_F.dmat", F);
|
||||
igl::readDMAT(test_common::data_path("duplicated_faces_F.dmat"), F);
|
||||
|
||||
assert_order(V, F, 223, 224, {2, 0, 3, 1}, "duplicated_faces_N1.dmat");
|
||||
assert_order(V, F, 223, 224, {0, 3, 2, 1}, "duplicated_faces_N2.dmat");
|
||||
|
||||
@@ -22,7 +22,7 @@ TEST_CASE("OuterFacet: Simple", "[igl/copyleft/cgal]")
|
||||
{
|
||||
Eigen::MatrixXd V;
|
||||
Eigen::MatrixXi F;
|
||||
test_common::load_mesh("cube.obj", V, F);
|
||||
igl::read_triangle_mesh(test_common::data_path("cube.obj"), V, F);
|
||||
|
||||
const size_t num_faces = F.rows();
|
||||
|
||||
@@ -41,7 +41,7 @@ TEST_CASE("OuterFacet: DuplicatedOppositeFaces", "[igl/copyleft/cgal]")
|
||||
{
|
||||
Eigen::MatrixXd V;
|
||||
Eigen::MatrixXi F1;
|
||||
test_common::load_mesh("cube.obj", V, F1);
|
||||
igl::read_triangle_mesh(test_common::data_path("cube.obj"), V, F1);
|
||||
|
||||
Eigen::MatrixXi F2 = F1;
|
||||
F2.col(0).swap(F2.col(1));
|
||||
@@ -64,7 +64,7 @@ TEST_CASE("OuterFacet: FullyDegnerated", "[igl/copyleft/cgal]")
|
||||
{
|
||||
Eigen::MatrixXd V;
|
||||
Eigen::MatrixXi F;
|
||||
test_common::load_mesh("degenerated.obj", V, F);
|
||||
igl::read_triangle_mesh(test_common::data_path("degenerated.obj"), V, F);
|
||||
|
||||
Eigen::VectorXi I(F.rows());
|
||||
I.setLinSpaced(F.rows(), 0, F.rows()-1);
|
||||
@@ -81,7 +81,7 @@ TEST_CASE("OuterFacet: InvertedNormal", "[igl/copyleft/cgal]")
|
||||
{
|
||||
Eigen::MatrixXd V;
|
||||
Eigen::MatrixXi F;
|
||||
test_common::load_mesh("cube.obj", V, F);
|
||||
igl::read_triangle_mesh(test_common::data_path("cube.obj"), V, F);
|
||||
F.col(0).swap(F.col(1));
|
||||
|
||||
Eigen::VectorXi I(F.rows());
|
||||
@@ -99,7 +99,7 @@ TEST_CASE("OuterFacet: SliverTet", "[igl/copyleft/cgal]")
|
||||
{
|
||||
Eigen::MatrixXd V;
|
||||
Eigen::MatrixXi F;
|
||||
test_common::load_mesh("sliver_tet.ply", V, F);
|
||||
igl::read_triangle_mesh(test_common::data_path("sliver_tet.ply"), V, F);
|
||||
|
||||
Eigen::VectorXi I(F.rows());
|
||||
I.setLinSpaced(F.rows(), 0, F.rows()-1);
|
||||
|
||||
@@ -7,7 +7,7 @@ TEST_CASE("OuterHull: CubeWithFold", "[igl/copyleft/cgal]")
|
||||
{
|
||||
Eigen::MatrixXd V;
|
||||
Eigen::MatrixXi F;
|
||||
test_common::load_mesh("cube_with_fold.ply", V, F);
|
||||
igl::read_triangle_mesh(test_common::data_path("cube_with_fold.ply"), V, F);
|
||||
|
||||
Eigen::MatrixXi G,J,flip;
|
||||
// Is this just checking that it doesn't crash?
|
||||
|
||||
@@ -15,7 +15,7 @@ TEST_CASE("copyleft_cgal_peel_outer_hull_layers: TwoCubes", "[igl/copyleft/cgal]
|
||||
{
|
||||
Eigen::MatrixXd V;
|
||||
Eigen::MatrixXi F;
|
||||
test_common::load_mesh("two-boxes-bad-self-union.ply", V, F);
|
||||
igl::read_triangle_mesh(test_common::data_path("two-boxes-bad-self-union.ply"), V, F);
|
||||
REQUIRE (V.rows() == 486);
|
||||
REQUIRE (F.rows() == 708);
|
||||
|
||||
@@ -55,7 +55,7 @@ TEST_CASE("PeelOuterHullLayers: CubeWithFold", "[igl/copyleft/cgal]")
|
||||
{
|
||||
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> V;
|
||||
Eigen::MatrixXi F;
|
||||
test_common::load_mesh("cube_with_fold.ply", V, F);
|
||||
igl::read_triangle_mesh(test_common::data_path("cube_with_fold.ply"), V, F);
|
||||
|
||||
typedef CGAL::Exact_predicates_exact_constructions_kernel K;
|
||||
typedef K::FT Scalar;
|
||||
|
||||
@@ -7,7 +7,7 @@ TEST_CASE("PointInsideComponent: simple", "[igl/copyleft/cgal]")
|
||||
{
|
||||
Eigen::MatrixXd V1;
|
||||
Eigen::MatrixXi F1;
|
||||
test_common::load_mesh("cube.obj", V1, F1);
|
||||
igl::read_triangle_mesh(test_common::data_path("cube.obj"), V1, F1);
|
||||
|
||||
Eigen::MatrixXd P(4, 3);
|
||||
P << 0.0, 0.0, 0.0,
|
||||
@@ -27,7 +27,7 @@ TEST_CASE("PointInsideComponent: near_boundary", "[igl/copyleft/cgal]")
|
||||
{
|
||||
Eigen::MatrixXd V1;
|
||||
Eigen::MatrixXi F1;
|
||||
test_common::load_mesh("cube.obj", V1, F1);
|
||||
igl::read_triangle_mesh(test_common::data_path("cube.obj"), V1, F1);
|
||||
|
||||
const double EPS = std::numeric_limits<double>::epsilon();
|
||||
Eigen::MatrixXd P(6, 3);
|
||||
@@ -52,7 +52,7 @@ TEST_CASE("PointInsideComponent: near_corner", "[igl/copyleft/cgal]")
|
||||
{
|
||||
Eigen::MatrixXd V1;
|
||||
Eigen::MatrixXi F1;
|
||||
test_common::load_mesh("cube.obj", V1, F1);
|
||||
igl::read_triangle_mesh(test_common::data_path("cube.obj"), V1, F1);
|
||||
|
||||
const double EPS = std::numeric_limits<double>::epsilon();
|
||||
Eigen::MatrixXd P_out(8, 3);
|
||||
|
||||
@@ -10,7 +10,7 @@ TEST_CASE("RemeshSelfIntersections: CubeWithFold", "[igl/copyleft/cgal]")
|
||||
{
|
||||
Eigen::MatrixXd V;
|
||||
Eigen::MatrixXi F;
|
||||
test_common::load_mesh("cube_with_fold.ply", V, F);
|
||||
igl::read_triangle_mesh(test_common::data_path("cube_with_fold.ply"), V, F);
|
||||
|
||||
typedef CGAL::Exact_predicates_exact_constructions_kernel K;
|
||||
typedef Eigen::Matrix<K::FT, Eigen::Dynamic, Eigen::Dynamic> MatrixXe;
|
||||
|
||||
@@ -10,7 +10,7 @@ TEST_CASE("cotmatrix: constant_in_null_space", "[igl]")
|
||||
Eigen::MatrixXi F;
|
||||
Eigen::SparseMatrix<double> L;
|
||||
// Load example mesh: GetParam() will be name of mesh file
|
||||
test_common::load_mesh(param, V, F);
|
||||
igl::read_triangle_mesh(test_common::data_path(param), V, F);
|
||||
igl::cotmatrix(V,F,L);
|
||||
REQUIRE (L.rows() == V.rows());
|
||||
REQUIRE (L.cols() == L.rows());
|
||||
@@ -33,7 +33,7 @@ TEST_CASE("cotmatrix: cube", "[igl]")
|
||||
Eigen::MatrixXd V;
|
||||
Eigen::MatrixXi F;
|
||||
//This is a cube of dimensions 1.0x1.0x1.0
|
||||
test_common::load_mesh("cube.obj", V, F);
|
||||
igl::read_triangle_mesh(test_common::data_path("cube.obj"), V, F);
|
||||
|
||||
//Scale the cube to have huge sides
|
||||
Eigen::MatrixXd V_huge = V * 1.0e8;
|
||||
@@ -109,7 +109,7 @@ TEST_CASE("cotmatrix: tetrahedron", "[igl]")
|
||||
Eigen::MatrixXd V;
|
||||
Eigen::MatrixXi F;
|
||||
//This is a cube of dimensions 1.0x1.0x1.0
|
||||
test_common::load_mesh("cube.obj", V, F);
|
||||
igl::read_triangle_mesh(test_common::data_path("cube.obj"), V, F);
|
||||
|
||||
//Prepare another mesh with triangles along side diagonals of the cube
|
||||
//These triangles are form a regular tetrahedron of side sqrt(2)
|
||||
|
||||
@@ -12,7 +12,7 @@ TEST_CASE("cotmatrix_entries: simple", "[igl]")
|
||||
Eigen::MatrixXd V;
|
||||
Eigen::MatrixXi F;
|
||||
//This is a cube of dimensions 1.0x1.0x1.0
|
||||
test_common::load_mesh("cube.obj", V, F);
|
||||
igl::read_triangle_mesh(test_common::data_path("cube.obj"), V, F);
|
||||
|
||||
//Prepare another mesh with triangles along side diagonals of the cube
|
||||
//These triangles are form a regular tetrahedron of side sqrt(2)
|
||||
@@ -142,7 +142,7 @@ TEST_CASE("cotmatrix_entries: intrinsic", "[igl]")
|
||||
Eigen::MatrixXd V;
|
||||
Eigen::MatrixXi F;
|
||||
//This is a cube of dimensions 1.0x1.0x1.0
|
||||
test_common::load_mesh("cube.obj", V, F);
|
||||
igl::read_triangle_mesh(test_common::data_path("cube.obj"), V, F);
|
||||
Eigen::MatrixXd Cext,Cint;
|
||||
// compute C extrinsically
|
||||
igl::cotmatrix_entries(V,F,Cext);
|
||||
|
||||
@@ -67,7 +67,7 @@ TEST_CASE("cotmatrix_intrinsic: manifold_meshes", "[igl]")
|
||||
{
|
||||
Eigen::MatrixXd V;
|
||||
Eigen::MatrixXi F;
|
||||
test_common::load_mesh(param, V, F);
|
||||
igl::read_triangle_mesh(test_common::data_path(param), V, F);
|
||||
Eigen::MatrixXd l;
|
||||
igl::edge_lengths(V,F,l);
|
||||
Eigen::SparseMatrix<double> L,Li;
|
||||
|
||||
@@ -108,7 +108,7 @@ TEST_CASE("cut_to_disk: torus", "[igl]")
|
||||
using namespace igl;
|
||||
Eigen::MatrixXd V;
|
||||
Eigen::MatrixXi F;
|
||||
test_common::load_mesh("TinyTorus.obj", V, F);
|
||||
igl::read_triangle_mesh(test_common::data_path("TinyTorus.obj"), V, F);
|
||||
|
||||
std::vector<std::vector<int>> cuts;
|
||||
cut_to_disk(F, cuts);
|
||||
@@ -122,7 +122,7 @@ TEST_CASE("cut_to_disk: cube", "[igl]")
|
||||
using namespace igl;
|
||||
Eigen::MatrixXd V;
|
||||
Eigen::MatrixXi F;
|
||||
test_common::load_mesh("cube.obj", V, F);
|
||||
igl::read_triangle_mesh(test_common::data_path("cube.obj"), V, F);
|
||||
|
||||
std::vector<std::vector<int>> cuts;
|
||||
cut_to_disk(F, cuts);
|
||||
@@ -136,7 +136,7 @@ TEST_CASE("cut_to_disk: annulus", "[igl]") {
|
||||
using namespace igl;
|
||||
Eigen::MatrixXd V;
|
||||
Eigen::MatrixXi F;
|
||||
test_common::load_mesh("annulus.obj", V, F);
|
||||
igl::read_triangle_mesh(test_common::data_path("annulus.obj"), V, F);
|
||||
|
||||
std::vector<std::vector<int>> cuts;
|
||||
cut_to_disk(F, cuts);
|
||||
|
||||
@@ -22,7 +22,7 @@ TEST_CASE("decimate: hemisphere", "[igl]")
|
||||
Eigen::MatrixXi F,G;
|
||||
Eigen::VectorXi J,I;
|
||||
// Load example mesh: GetParam() will be name of mesh file
|
||||
test_common::load_mesh("hemisphere.obj", V, F);
|
||||
igl::read_triangle_mesh(test_common::data_path("hemisphere.obj"), V, F);
|
||||
// Perfect normals from positions
|
||||
Eigen::MatrixXd NV = V.rowwise().normalized();
|
||||
// Remove half of the faces
|
||||
@@ -48,7 +48,7 @@ TEST_CASE("decimate: closed", "[igl]")
|
||||
Eigen::MatrixXi F,G;
|
||||
Eigen::VectorXi J;
|
||||
// Load example mesh: GetParam() will be name of mesh file
|
||||
test_common::load_mesh(param, V, F);
|
||||
igl::read_triangle_mesh(test_common::data_path(param), V, F);
|
||||
igl::decimate(V,F,0,U,G,J);
|
||||
REQUIRE (4 == U.rows());
|
||||
REQUIRE (4 == G.rows());
|
||||
|
||||
@@ -8,7 +8,7 @@ TEST_CASE("dijkstra: cube", "[igl]")
|
||||
Eigen::MatrixXd V;
|
||||
Eigen::MatrixXi F;
|
||||
//This is a cube of dimensions 1.0x1.0x1.0
|
||||
test_common::load_mesh("cube.off", V, F);
|
||||
igl::read_triangle_mesh(test_common::data_path("cube.off"), V, F);
|
||||
|
||||
std::vector<std::vector<int>> VV;
|
||||
igl::adjacency_list(F, VV);
|
||||
|
||||
@@ -8,7 +8,7 @@ TEST_CASE("doublearea: VF_vs_ABC", "[igl]")
|
||||
{
|
||||
Eigen::MatrixXd V;
|
||||
Eigen::MatrixXi F;
|
||||
test_common::load_mesh(param, V, F);
|
||||
igl::read_triangle_mesh(test_common::data_path(param), V, F);
|
||||
|
||||
// Check that computing double area with (V,F) is the same as computing
|
||||
// double area with (V1,V2,V2)
|
||||
|
||||
@@ -8,7 +8,7 @@ TEST_CASE("edge_flaps: verify", "[igl]")
|
||||
{
|
||||
Eigen::MatrixXd V;
|
||||
Eigen::MatrixXi F;
|
||||
test_common::load_mesh(param, V, F);
|
||||
igl::read_triangle_mesh(test_common::data_path(param), V, F);
|
||||
|
||||
Eigen::MatrixXi efE,efEF,efEI;
|
||||
Eigen::VectorXi efEMAP;
|
||||
|
||||
@@ -9,7 +9,7 @@ TEST_CASE("edge_lengths: cube", "[igl]")
|
||||
Eigen::MatrixXd V;
|
||||
Eigen::MatrixXi F;
|
||||
//This is a cube of dimensions 1.0x1.0x1.0
|
||||
test_common::load_mesh("cube.obj", V, F);
|
||||
igl::read_triangle_mesh(test_common::data_path("cube.obj"), V, F);
|
||||
//Create scaled versions of the cube
|
||||
double scale = 1.0;
|
||||
double huge_scale = 1.0e8;
|
||||
|
||||
@@ -9,7 +9,7 @@ TEST_CASE("EmbreeIntersector: cube", "[igl/embree]")
|
||||
Eigen::MatrixXd V;
|
||||
Eigen::MatrixXi F;
|
||||
// This is a cube of dimensions 1.0x1.0x1.0
|
||||
test_common::load_mesh("cube.obj", V, F);
|
||||
igl::read_triangle_mesh(test_common::data_path("cube.obj"), V, F);
|
||||
|
||||
// Initialize embree
|
||||
igl::embree::EmbreeIntersector embree;
|
||||
|
||||
@@ -43,7 +43,7 @@ TEST_CASE("intrinsic_delaunay_cotmatrix: manifold_meshes", "[igl]")
|
||||
{
|
||||
Eigen::MatrixXd V;
|
||||
Eigen::MatrixXi F;
|
||||
test_common::load_mesh(param, V, F);
|
||||
igl::read_triangle_mesh(test_common::data_path(param), V, F);
|
||||
Eigen::SparseMatrix<double> L;
|
||||
Eigen::MatrixXi F_intrinsic;
|
||||
Eigen::MatrixXd l_intrinsic;
|
||||
|
||||
@@ -8,7 +8,7 @@ TEST_CASE("is_edge_manifold: positive", "[igl]")
|
||||
{
|
||||
Eigen::MatrixXd V;
|
||||
Eigen::MatrixXi F;
|
||||
test_common::load_mesh(param, V, F);
|
||||
igl::read_triangle_mesh(test_common::data_path(param), V, F);
|
||||
REQUIRE ( igl::is_edge_manifold(F) );
|
||||
};
|
||||
|
||||
@@ -20,6 +20,6 @@ TEST_CASE("is_edge_manifold: negative", "[igl]")
|
||||
Eigen::MatrixXd V;
|
||||
Eigen::MatrixXi F;
|
||||
// Known non-manifold mesh
|
||||
test_common::load_mesh("truck.obj", V, F);
|
||||
igl::read_triangle_mesh(test_common::data_path("truck.obj"), V, F);
|
||||
REQUIRE (! igl::is_edge_manifold(F) );
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ TEST_CASE("is_irregular_vertex: simple", "[igl]")
|
||||
Eigen::MatrixXd V;
|
||||
Eigen::MatrixXi F;
|
||||
// Known "bad" mesh (many boundaries + irregular vertices, non-manifold)
|
||||
test_common::load_mesh("truck.obj", V, F);
|
||||
igl::read_triangle_mesh(test_common::data_path("truck.obj"), V, F);
|
||||
std::vector<bool> vec = igl::is_irregular_vertex(V,F);
|
||||
// some vertices are irregular thus the sum over all vertices should evaluate to true
|
||||
REQUIRE(std::any_of(vec.begin(),vec.end(), [](bool v) { return v; }));
|
||||
|
||||
@@ -16,7 +16,7 @@ TEST_CASE("iterative_closest_point: identity","[igl]")
|
||||
Eigen::MatrixXd VX,VY;
|
||||
Eigen::MatrixXi FX,FY;
|
||||
// Load example mesh: GetParam() will be name of mesh file
|
||||
test_common::load_mesh(param, VY, FY);
|
||||
igl::read_triangle_mesh(test_common::data_path(param), VY, FY);
|
||||
VX = VY;
|
||||
FX = FY;
|
||||
// Single iteration should find a identity
|
||||
|
||||
@@ -10,7 +10,7 @@ TEST_CASE("per_face_normals: dot", "[igl]")
|
||||
Eigen::MatrixXd V,N;
|
||||
Eigen::MatrixXi F;
|
||||
// Load example mesh: GetParam() will be name of mesh file
|
||||
test_common::load_mesh(param, V, F);
|
||||
igl::read_triangle_mesh(test_common::data_path(param), V, F);
|
||||
igl::per_face_normals(V,F,N);
|
||||
REQUIRE (N.rows() == F.rows());
|
||||
for(int f = 0;f<N.rows();f++)
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
TEST_CASE("readDMAT: Comp", "[igl]")
|
||||
{
|
||||
Eigen::MatrixXd N1, N2;
|
||||
test_common::load_matrix("duplicated_faces_N1.dmat", N1);
|
||||
test_common::load_matrix("duplicated_faces_N2.dmat", N2);
|
||||
igl::readDMAT(test_common::data_path("duplicated_faces_N1.dmat"), N1);
|
||||
igl::readDMAT(test_common::data_path("duplicated_faces_N2.dmat"), N2);
|
||||
|
||||
REQUIRE (N2.rows() == N1.rows());
|
||||
REQUIRE (N2.cols() == N1.cols());
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <igl/readOBJ.h>
|
||||
#include <test_common.h>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
@@ -9,7 +10,7 @@ TEST_CASE("readOBJ: simple", "[igl]")
|
||||
Eigen::MatrixXi F;
|
||||
// wait... so this is actually testing test_common::load_mesh not readOBJ
|
||||
// directly...
|
||||
test_common::load_mesh("cube.obj", V, F);
|
||||
igl::read_triangle_mesh(test_common::data_path("cube.obj"), V, F);
|
||||
REQUIRE (V.rows() == 8);
|
||||
REQUIRE (F.rows() == 12);
|
||||
}
|
||||
@@ -23,7 +24,8 @@ TEST_CASE("readOBJ: Obj with material", "[igl]")
|
||||
std::vector<std::vector<int > > FTC;
|
||||
std::vector<std::vector<int > > FN;
|
||||
std::vector<std::tuple<std::string, int, int>> FM;
|
||||
test_common::load_obj_with_material<double, int>("cubewithmaterial.obj", V, TC, N, F, FTC, FN, FM);
|
||||
igl::readOBJ(test_common::data_path("cubewithmaterial.obj"), V, TC, N, F, FTC, FN, FM);
|
||||
|
||||
REQUIRE (V.size() == 8);
|
||||
REQUIRE (F.size() == 6);
|
||||
for ( const auto& i : FM ) {
|
||||
|
||||
@@ -6,7 +6,7 @@ TEST_CASE("readOFF: simple", "[igl]")
|
||||
Eigen::MatrixXi F;
|
||||
// wait... so this is actually testing test_common::load_mesh not readOFF
|
||||
// directly...
|
||||
test_common::load_mesh("cube.off", V, F);
|
||||
igl::read_triangle_mesh(test_common::data_path("cube.off"), V, F);
|
||||
REQUIRE (V.rows() == 8);
|
||||
REQUIRE (V.cols() == 3);
|
||||
REQUIRE (F.rows() == 12);
|
||||
|
||||
@@ -10,7 +10,7 @@ TEST_CASE("squared_edge_lengths: cube", "[igl]")
|
||||
Eigen::MatrixXd V;
|
||||
Eigen::MatrixXi F;
|
||||
//This is a cube of dimensions 1.0x1.0x1.0
|
||||
test_common::load_mesh("cube.obj", V, F);
|
||||
igl::read_triangle_mesh(test_common::data_path("cube.obj"), V, F);
|
||||
//Create scaled versions of the cube
|
||||
double scale = 1.0;
|
||||
double huge_scale = 1.0e8;
|
||||
|
||||
@@ -11,7 +11,7 @@ TEST_CASE("triangle_triangle_adjacency: dot", "[igl]")
|
||||
Eigen::MatrixXd V;
|
||||
Eigen::MatrixXi F,TT,TTi;
|
||||
// Load example mesh: GetParam() will be name of mesh file
|
||||
test_common::load_mesh(param, V, F);
|
||||
igl::read_triangle_mesh(test_common::data_path(param), V, F);
|
||||
igl::triangle_triangle_adjacency(F,TT,TTi);
|
||||
REQUIRE (TT.rows() == F.rows());
|
||||
REQUIRE (TTi.rows() == F.rows());
|
||||
|
||||
@@ -34,7 +34,7 @@ TEST_CASE("upsample: V_comes_first_F_ordering", "[igl]")
|
||||
Eigen::MatrixXd V,NV;
|
||||
Eigen::MatrixXi F,NF;
|
||||
// Load example mesh: GetParam() will be name of mesh file
|
||||
test_common::load_mesh(param, V, F);
|
||||
igl::read_triangle_mesh(test_common::data_path(param), V, F);
|
||||
igl::upsample(V,F,NV,NF);
|
||||
REQUIRE (V.rows() <= NV.rows());
|
||||
REQUIRE (4*F.rows() == NF.rows());
|
||||
|
||||
+17
-43
@@ -1,10 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
// These are not directly used but would otherwise be included in most files.
|
||||
// Leaving them included here.
|
||||
#include <igl/read_triangle_mesh.h>
|
||||
#include <igl/find.h>
|
||||
#include <igl/readDMAT.h>
|
||||
#include <igl/readOBJ.h>
|
||||
|
||||
#include <igl/find.h>
|
||||
|
||||
#include <Eigen/Core>
|
||||
#include <catch2/catch.hpp>
|
||||
@@ -21,7 +23,20 @@ namespace test_common
|
||||
void run_test_cases(const std::vector<Param> ¶ms, Fun test_case)
|
||||
{
|
||||
for(const auto &p : params)
|
||||
{
|
||||
// Can't use INFO( p ) because we're not sure how to print p
|
||||
test_case(p);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename Fun>
|
||||
void run_test_cases(const std::vector<std::string> ¶ms, Fun test_case)
|
||||
{
|
||||
for(const auto &p : params)
|
||||
{
|
||||
INFO( p );
|
||||
test_case(p);
|
||||
}
|
||||
}
|
||||
|
||||
inline std::vector<std::string> closed_genus_0_meshes()
|
||||
@@ -75,47 +90,6 @@ namespace test_common
|
||||
return std::string(LIBIGL_DATA_DIR) + "/" + s;
|
||||
};
|
||||
|
||||
// TODO: this seems like a pointless indirection. Should just find and
|
||||
// replace test_common::load_mesh(X,...) with
|
||||
// igl::read_triangle_mesh(test_common::data_path(X),...)
|
||||
template<typename DerivedV, typename DerivedF>
|
||||
void load_mesh(
|
||||
const std::string& filename,
|
||||
Eigen::PlainObjectBase<DerivedV>& V,
|
||||
Eigen::PlainObjectBase<DerivedF>& F)
|
||||
{
|
||||
igl::read_triangle_mesh(data_path(filename), V, F);
|
||||
}
|
||||
|
||||
template<typename DerivedV, typename DerivedF>
|
||||
void load_obj_with_material(
|
||||
const std::string& filename,
|
||||
std::vector<std::vector<DerivedV >> & V,
|
||||
std::vector<std::vector<DerivedV >> & TC,
|
||||
std::vector<std::vector<DerivedV >> & N,
|
||||
std::vector<std::vector<DerivedF >> & F,
|
||||
std::vector<std::vector<DerivedF >> & FTC,
|
||||
std::vector<std::vector<DerivedF >> & FN,
|
||||
std::vector<std::tuple<std::string, DerivedF, DerivedF >> &FM)
|
||||
{
|
||||
igl::readOBJ(data_path(filename), V, TC, N, F, FTC, FN, FM);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// TODO: this seems like a pointless indirection. Should just find and
|
||||
// replace test_common::load_matrix(X,...) with
|
||||
// igl::readDMAT(test_common::data_path(X),...)
|
||||
template<typename Derived>
|
||||
void load_matrix(
|
||||
const std::string& filename,
|
||||
Eigen::PlainObjectBase<Derived>& M)
|
||||
{
|
||||
igl::readDMAT(data_path(filename), M);
|
||||
}
|
||||
|
||||
template <typename DerivedA, typename DerivedB>
|
||||
void assert_eq(
|
||||
const Eigen::MatrixBase<DerivedA> & A,
|
||||
|
||||
Reference in New Issue
Block a user