Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmake/recipes/predicates.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ include(CPM)
CPMAddPackage(
NAME predicates
GITHUB_REPOSITORY wildmeshing/libigl-predicates
GIT_TAG f1fcce5d20d5a8e887cb694dc6aeaafab9ca1e29
GIT_TAG 83b924928a12d9b578968508b303f90c738d6deb
)

FetchContent_MakeAvailable(predicates)
add_library(predicates::predicates ALIAS predicates)

set_target_properties(predicates PROPERTIES FOLDER third_party)
set_target_properties(predicates PROPERTIES FOLDER third_party)
6 changes: 3 additions & 3 deletions src/wmtk/io/MshReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <wmtk/utils/mesh_type_from_primitive_type.hpp>

#include <set>
#include <predicates.h>

#include <wmtk/EdgeMesh.hpp>
#include <wmtk/PointMesh.hpp>
Expand All @@ -13,7 +14,6 @@
#include <wmtk/utils/orient.hpp>

#include "mshio/MshSpec.h"
#include "predicates.h"

namespace wmtk::io {
MshReader::MshReader() = default;
Expand Down Expand Up @@ -372,7 +372,7 @@ template <>
void MshReader::validate<3>()
{
assert(V.cols() == 3);
exactinit();
igl_predicates::exactinit();
{
// check inversion

Expand Down Expand Up @@ -423,4 +423,4 @@ void MshReader::validate<3>()
}
}
}
} // namespace wmtk::io
} // namespace wmtk::io
8 changes: 4 additions & 4 deletions src/wmtk/utils/orient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void exactinit()
}

private:
MySingleton() { ::exactinit(); }
MySingleton() { igl_predicates::exactinit(); }
};
MySingleton::instance();
}
Expand Down Expand Up @@ -164,7 +164,7 @@ int wmtk_orient3d(
Eigen::Vector3d p3nc = p3;

exactinit();
const auto res = orient3d(p0nc.data(), p1nc.data(), p2nc.data(), p3nc.data());
const auto res = igl_predicates::orient3d(p0nc.data(), p1nc.data(), p2nc.data(), p3nc.data());

if (res > 0)
return 1;
Expand All @@ -181,7 +181,7 @@ int wmtk_orient2d(double p0x, double p0y, double p1x, double p1y, double p2x, do
double p0[2]{p0x, p0y};
double p1[2]{p1x, p1y};
double p2[2]{p2x, p2y};
const auto res = orient2d(p0, p1, p2);
const auto res = igl_predicates::orient2d(p0, p1, p2);

if (res > 0)
return 1;
Expand Down Expand Up @@ -254,7 +254,7 @@ int wmtk_orient2d(
Eigen::Vector2d p2nc = p2;

exactinit();
const auto res = orient2d(p0nc.data(), p1nc.data(), p2nc.data());
const auto res = igl_predicates::orient2d(p0nc.data(), p1nc.data(), p2nc.data());

if (res > 0)
return 1;
Expand Down
10 changes: 5 additions & 5 deletions tests/test_3d_invariants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ using namespace wmtk::invariants;

TEST_CASE("tet_inversion_invariant", "[invariants][3D]")
{
exactinit();
igl_predicates::exactinit();
DEBUG_TetMesh m = single_tet();
auto position_handle = m.register_attribute<double>("vertices", PrimitiveType::Vertex, 3);
auto position_accessor = m.create_accessor<double>(position_handle);
Expand Down Expand Up @@ -47,8 +47,8 @@ TEST_CASE("tet_inversion_invariant", "[invariants][3D]")
Tuple t = v0;


std::cout << orient3d(p0.data(), p1.data(), p2.data(), p3.data()) << std::endl;
CHECK(orient3d(p0.data(), p1.data(), p2.data(), p3.data()) > 0);
std::cout << igl_predicates::orient3d(p0.data(), p1.data(), p2.data(), p3.data()) << std::endl;
CHECK(igl_predicates::orient3d(p0.data(), p1.data(), p2.data(), p3.data()) > 0);
CHECK(wmtk::utils::wmtk_orient3d(p0, p1, p2, p3) > 0);

for (const auto& t : m.get_all(PrimitiveType::Triangle)) {
Expand Down Expand Up @@ -80,7 +80,7 @@ TEST_CASE("tet_inversion_invariant", "[invariants][3D]")

TEST_CASE("tet_rational_inversion_invariant", "[invariants][3D]")
{
exactinit();
igl_predicates::exactinit();
DEBUG_TetMesh m = single_tet();
auto position_handle = m.register_attribute<Rational>("vertices", PrimitiveType::Vertex, 3);
auto position_accessor = m.create_accessor<Rational>(position_handle);
Expand Down Expand Up @@ -143,4 +143,4 @@ TEST_CASE("orient3d", "[invariants][3D]")

REQUIRE(utils::wmtk_orient3d(v0, v1, v2, v3) == utils::wmtk_orient3d(v0d, v1d, v2d, v3d));
REQUIRE(utils::wmtk_orient3d(v0, v2, v1, v3) == utils::wmtk_orient3d(v0d, v2d, v1d, v3d));
}
}
Loading