14#include <lagrange/ExactPredicates.h>
15#include <lagrange/legacy/inline.h>
16#include <lagrange/utils/range.h>
34template <
typename UVArray,
typename UVIndices,
typename T =
void>
35size_t check_flipped_uv(
36 const Eigen::PlainObjectBase<UVArray>& uv,
37 const Eigen::PlainObjectBase<UVIndices>& uv_indices,
40 const auto num_facets = uv_indices.rows();
42 size_t num_flipped = 0;
43 double uv0[2], uv1[2], uv2[2];
44 for (
auto i :
range(num_facets)) {
46 uv0[0] =
static_cast<double>(uv(uv_indices(i, 0), 0));
47 uv0[1] =
static_cast<double>(uv(uv_indices(i, 0), 1));
48 uv1[0] =
static_cast<double>(uv(uv_indices(i, 1), 0));
49 uv1[1] =
static_cast<double>(uv(uv_indices(i, 1), 1));
50 uv2[0] =
static_cast<double>(uv(uv_indices(i, 2), 0));
51 uv2[1] =
static_cast<double>(uv(uv_indices(i, 2), 1));
52 auto r = predicates->orient2D(uv0, uv1, uv2);
53 if (r <= 0) num_flipped++;
54 if (flipped) flipped[i] = r <= 0;
static std::unique_ptr< ExactPredicates > create(const std::string &engine)
Factory method to create an exact predicate engine.
Definition: ExactPredicates.cpp:20
internal::Range< Index > range(Index end)
Returns an iterable object representing the range [0, end).
Definition: range.h:176
Main namespace for Lagrange.
Definition: AABBIGL.h:30