#include <limits>
#include "./impl.h"
#include "./parallel.h"
#include "./tri_dist.h"
namespace {
usingnamespacemanifold;
struct CurvatureAngles { … };
struct UpdateProperties { … };
struct CheckHalfedges { … };
struct CheckCCW { … };
}
namespace manifold {
bool Manifold::Impl::IsManifold() const { … }
bool Manifold::Impl::Is2Manifold() const { … }
bool Manifold::Impl::MatchesTriNormals() const { … }
int Manifold::Impl::NumDegenerateTris() const { … }
double Manifold::Impl::GetProperty(Property prop) const { … }
void Manifold::Impl::CalculateCurvature(int gaussianIdx, int meanIdx) { … }
void Manifold::Impl::CalculateBBox() { … }
bool Manifold::Impl::IsFinite() const { … }
bool Manifold::Impl::IsIndexInBounds(VecView<const ivec3> triVerts) const { … }
double Manifold::Impl::MinGap(const Manifold::Impl& other,
double searchLength) const {
ZoneScoped;
Vec<Box> faceBoxOther;
Vec<uint32_t> faceMortonOther;
other.GetFaceBoxMorton(faceBoxOther, faceMortonOther);
transform(faceBoxOther.begin(), faceBoxOther.end(), faceBoxOther.begin(),
[searchLength](const Box& box) {
return Box(box.min - vec3(searchLength),
box.max + vec3(searchLength));
});
SparseIndices collisions = collider_.Collisions(faceBoxOther.cview());
double minDistanceSquared = transform_reduce(
countAt(0_uz), countAt(collisions.size()), searchLength * searchLength,
[](double a, double b) { return std::min(a, b); },
[&collisions, this, &other](int i) {
const int tri = collisions.Get(i, 1);
const int triOther = collisions.Get(i, 0);
std::array<vec3, 3> p;
std::array<vec3, 3> q;
for (const int j : {0, 1, 2}) {
p[j] = vertPos_[halfedge_[3 * tri + j].startVert];
q[j] = other.vertPos_[other.halfedge_[3 * triOther + j].startVert];
}
return DistanceTriangleTriangleSquared(p, q);
});
return sqrt(minDistanceSquared);
};
}