Medusa  1.1
Coordinate Free Mehless Method implementation
test/domains/STLShape_test.cpp
#include "gtest/gtest.h"
namespace mm {
TEST(Domains, STLShape) {
auto data = STL::read("test/testdata/tetrahedron.stl");
STLShape<Vec3d> shape(data);
auto dx = [](const Vec3d& p) { return 0.005 + (p-Vec3d(0.5, 0.5, 0.5)).norm()/50; };
auto d = shape.discretizeBoundaryWithDensity(dx);
EXPECT_GT(d.size(), 5000);
d.findSupport(FindClosest(2));
for (int i = 0; i < d.size(); ++i) {
ASSERT_NEAR(d.dr(i), dx(d.pos(i)), 2e-2);
}
auto bbox = shape.bbox();
EXPECT_EQ(Vec3d(0.5, 0.5, 0.5), bbox.first);
EXPECT_EQ(Vec3d(1.5, 1.5, 1.5), bbox.second);
}
} // namespace mm
mm
Root namespace for the whole library.
Definition: Gaussian.hpp:14
STLShape.hpp
mm::STL::read
static std::vector< Triangle > read(const std::string &filename)
Read a binary STL file.
Definition: STL.cpp:14
FindClosest.hpp
mm::Vec3d
Vec< double, 3 > Vec3d
Convenience typedef for 3d vector of doubles.
Definition: Vec_fwd.hpp:35
DomainDiscretization_fwd.hpp