mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-08 22:35:15 -06:00
Rename EigenMesh3D to IndexedMesh and SupportConfig to SupportTreeConfig
This commit is contained in:
parent
645fbed88b
commit
1eec6c473c
21 changed files with 269 additions and 263 deletions
|
@ -37,9 +37,9 @@ TEST_CASE("Support point generator should be deterministic if seeded",
|
|||
"[SLASupportGeneration], [SLAPointGen]") {
|
||||
TriangleMesh mesh = load_model("A_upsidedown.obj");
|
||||
|
||||
sla::EigenMesh3D emesh{mesh};
|
||||
sla::IndexedMesh emesh{mesh};
|
||||
|
||||
sla::SupportConfig supportcfg;
|
||||
sla::SupportTreeConfig supportcfg;
|
||||
sla::SupportPointGenerator::Config autogencfg;
|
||||
autogencfg.head_diameter = float(2 * supportcfg.head_front_radius_mm);
|
||||
sla::SupportPointGenerator point_gen{emesh, autogencfg, [] {}, [](int) {}};
|
||||
|
@ -124,14 +124,14 @@ TEST_CASE("WingedPadAroundObjectIsValid", "[SLASupportGeneration]") {
|
|||
}
|
||||
|
||||
TEST_CASE("ElevatedSupportGeometryIsValid", "[SLASupportGeneration]") {
|
||||
sla::SupportConfig supportcfg;
|
||||
sla::SupportTreeConfig supportcfg;
|
||||
supportcfg.object_elevation_mm = 5.;
|
||||
|
||||
for (auto fname : SUPPORT_TEST_MODELS) test_supports(fname);
|
||||
}
|
||||
|
||||
TEST_CASE("FloorSupportGeometryIsValid", "[SLASupportGeneration]") {
|
||||
sla::SupportConfig supportcfg;
|
||||
sla::SupportTreeConfig supportcfg;
|
||||
supportcfg.object_elevation_mm = 0;
|
||||
|
||||
for (auto &fname: SUPPORT_TEST_MODELS) test_supports(fname, supportcfg);
|
||||
|
@ -139,7 +139,7 @@ TEST_CASE("FloorSupportGeometryIsValid", "[SLASupportGeneration]") {
|
|||
|
||||
TEST_CASE("ElevatedSupportsDoNotPierceModel", "[SLASupportGeneration]") {
|
||||
|
||||
sla::SupportConfig supportcfg;
|
||||
sla::SupportTreeConfig supportcfg;
|
||||
|
||||
for (auto fname : SUPPORT_TEST_MODELS)
|
||||
test_support_model_collision(fname, supportcfg);
|
||||
|
@ -147,7 +147,7 @@ TEST_CASE("ElevatedSupportsDoNotPierceModel", "[SLASupportGeneration]") {
|
|||
|
||||
TEST_CASE("FloorSupportsDoNotPierceModel", "[SLASupportGeneration]") {
|
||||
|
||||
sla::SupportConfig supportcfg;
|
||||
sla::SupportTreeConfig supportcfg;
|
||||
supportcfg.object_elevation_mm = 0;
|
||||
|
||||
for (auto fname : SUPPORT_TEST_MODELS)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <catch2/catch.hpp>
|
||||
#include <test_utils.hpp>
|
||||
|
||||
#include <libslic3r/SLA/EigenMesh3D.hpp>
|
||||
#include <libslic3r/SLA/IndexedMesh.hpp>
|
||||
#include <libslic3r/SLA/Hollowing.hpp>
|
||||
|
||||
#include "sla_test_utils.hpp"
|
||||
|
@ -65,7 +65,7 @@ TEST_CASE("Raycaster with loaded drillholes", "[sla_raycast]")
|
|||
cube.merge(*cube_inside);
|
||||
cube.require_shared_vertices();
|
||||
|
||||
sla::EigenMesh3D emesh{cube};
|
||||
sla::IndexedMesh emesh{cube};
|
||||
emesh.load_holes(holes);
|
||||
|
||||
Vec3d s = center.cast<double>();
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
#include "libslic3r/SLA/AGGRaster.hpp"
|
||||
|
||||
void test_support_model_collision(const std::string &obj_filename,
|
||||
const sla::SupportConfig &input_supportcfg,
|
||||
const sla::SupportTreeConfig &input_supportcfg,
|
||||
const sla::HollowingConfig &hollowingcfg,
|
||||
const sla::DrainHoles &drainholes)
|
||||
{
|
||||
SupportByproducts byproducts;
|
||||
|
||||
sla::SupportConfig supportcfg = input_supportcfg;
|
||||
sla::SupportTreeConfig supportcfg = input_supportcfg;
|
||||
|
||||
// Set head penetration to a small negative value which should ensure that
|
||||
// the supports will not touch the model body.
|
||||
|
@ -73,7 +73,7 @@ void export_failed_case(const std::vector<ExPolygons> &support_slices, const Sup
|
|||
}
|
||||
|
||||
void test_supports(const std::string &obj_filename,
|
||||
const sla::SupportConfig &supportcfg,
|
||||
const sla::SupportTreeConfig &supportcfg,
|
||||
const sla::HollowingConfig &hollowingcfg,
|
||||
const sla::DrainHoles &drainholes,
|
||||
SupportByproducts &out)
|
||||
|
@ -104,7 +104,7 @@ void test_supports(const std::string &obj_filename,
|
|||
|
||||
// Create the special index-triangle mesh with spatial indexing which
|
||||
// is the input of the support point and support mesh generators
|
||||
sla::EigenMesh3D emesh{mesh};
|
||||
sla::IndexedMesh emesh{mesh};
|
||||
|
||||
#ifdef SLIC3R_HOLE_RAYCASTER
|
||||
if (hollowingcfg.enabled)
|
||||
|
@ -168,7 +168,7 @@ void test_supports(const std::string &obj_filename,
|
|||
}
|
||||
|
||||
void check_support_tree_integrity(const sla::SupportTreeBuilder &stree,
|
||||
const sla::SupportConfig &cfg)
|
||||
const sla::SupportTreeConfig &cfg)
|
||||
{
|
||||
double gnd = stree.ground_level;
|
||||
double H1 = cfg.max_solo_pillar_height_mm;
|
||||
|
|
|
@ -67,16 +67,16 @@ struct SupportByproducts
|
|||
const constexpr float CLOSING_RADIUS = 0.005f;
|
||||
|
||||
void check_support_tree_integrity(const sla::SupportTreeBuilder &stree,
|
||||
const sla::SupportConfig &cfg);
|
||||
const sla::SupportTreeConfig &cfg);
|
||||
|
||||
void test_supports(const std::string &obj_filename,
|
||||
const sla::SupportConfig &supportcfg,
|
||||
const sla::SupportTreeConfig &supportcfg,
|
||||
const sla::HollowingConfig &hollowingcfg,
|
||||
const sla::DrainHoles &drainholes,
|
||||
SupportByproducts &out);
|
||||
|
||||
inline void test_supports(const std::string &obj_filename,
|
||||
const sla::SupportConfig &supportcfg,
|
||||
const sla::SupportTreeConfig &supportcfg,
|
||||
SupportByproducts &out)
|
||||
{
|
||||
sla::HollowingConfig hcfg;
|
||||
|
@ -85,7 +85,7 @@ inline void test_supports(const std::string &obj_filename,
|
|||
}
|
||||
|
||||
inline void test_supports(const std::string &obj_filename,
|
||||
const sla::SupportConfig &supportcfg = {})
|
||||
const sla::SupportTreeConfig &supportcfg = {})
|
||||
{
|
||||
SupportByproducts byproducts;
|
||||
test_supports(obj_filename, supportcfg, byproducts);
|
||||
|
@ -97,13 +97,13 @@ void export_failed_case(const std::vector<ExPolygons> &support_slices,
|
|||
|
||||
void test_support_model_collision(
|
||||
const std::string &obj_filename,
|
||||
const sla::SupportConfig &input_supportcfg,
|
||||
const sla::SupportTreeConfig &input_supportcfg,
|
||||
const sla::HollowingConfig &hollowingcfg,
|
||||
const sla::DrainHoles &drainholes);
|
||||
|
||||
inline void test_support_model_collision(
|
||||
const std::string &obj_filename,
|
||||
const sla::SupportConfig &input_supportcfg = {})
|
||||
const sla::SupportTreeConfig &input_supportcfg = {})
|
||||
{
|
||||
sla::HollowingConfig hcfg;
|
||||
hcfg.enabled = false;
|
||||
|
|
|
@ -1,99 +1,99 @@
|
|||
#include <catch2/catch.hpp>
|
||||
#include <test_utils.hpp>
|
||||
//#include <catch2/catch.hpp>
|
||||
//#include <test_utils.hpp>
|
||||
|
||||
#include "libslic3r/TriangleMesh.hpp"
|
||||
#include "libslic3r/SLA/SupportTreeBuildsteps.hpp"
|
||||
#include "libslic3r/SLA/SupportTreeMesher.hpp"
|
||||
//#include "libslic3r/TriangleMesh.hpp"
|
||||
//#include "libslic3r/SLA/SupportTreeBuildsteps.hpp"
|
||||
//#include "libslic3r/SLA/SupportTreeMesher.hpp"
|
||||
|
||||
TEST_CASE("Test bridge_mesh_intersect on a cube's wall", "[SLABridgeMeshInters]") {
|
||||
using namespace Slic3r;
|
||||
//TEST_CASE("Test bridge_mesh_intersect on a cube's wall", "[SLABridgeMeshInters]") {
|
||||
// using namespace Slic3r;
|
||||
|
||||
TriangleMesh cube = make_cube(10., 10., 10.);
|
||||
// TriangleMesh cube = make_cube(10., 10., 10.);
|
||||
|
||||
sla::SupportConfig cfg = {}; // use default config
|
||||
sla::SupportPoints pts = {{10.f, 5.f, 5.f, float(cfg.head_front_radius_mm), false}};
|
||||
sla::SupportableMesh sm{cube, pts, cfg};
|
||||
// sla::SupportConfig cfg = {}; // use default config
|
||||
// sla::SupportPoints pts = {{10.f, 5.f, 5.f, float(cfg.head_front_radius_mm), false}};
|
||||
// sla::SupportableMesh sm{cube, pts, cfg};
|
||||
|
||||
size_t steps = 45;
|
||||
SECTION("Bridge is straight horizontal and pointing away from the cube") {
|
||||
// size_t steps = 45;
|
||||
// SECTION("Bridge is straight horizontal and pointing away from the cube") {
|
||||
|
||||
sla::Bridge bridge(pts[0].pos.cast<double>(), Vec3d{15., 5., 5.},
|
||||
pts[0].head_front_radius);
|
||||
// sla::Bridge bridge(pts[0].pos.cast<double>(), Vec3d{15., 5., 5.},
|
||||
// pts[0].head_front_radius);
|
||||
|
||||
auto hit = sla::query_hit(sm, bridge);
|
||||
// auto hit = sla::query_hit(sm, bridge);
|
||||
|
||||
REQUIRE(std::isinf(hit.distance()));
|
||||
// REQUIRE(std::isinf(hit.distance()));
|
||||
|
||||
cube.merge(sla::to_triangle_mesh(get_mesh(bridge, steps)));
|
||||
cube.require_shared_vertices();
|
||||
cube.WriteOBJFile("cube1.obj");
|
||||
}
|
||||
// cube.merge(sla::to_triangle_mesh(get_mesh(bridge, steps)));
|
||||
// cube.require_shared_vertices();
|
||||
// cube.WriteOBJFile("cube1.obj");
|
||||
// }
|
||||
|
||||
SECTION("Bridge is tilted down in 45 degrees, pointing away from the cube") {
|
||||
sla::Bridge bridge(pts[0].pos.cast<double>(), Vec3d{15., 5., 0.},
|
||||
pts[0].head_front_radius);
|
||||
// SECTION("Bridge is tilted down in 45 degrees, pointing away from the cube") {
|
||||
// sla::Bridge bridge(pts[0].pos.cast<double>(), Vec3d{15., 5., 0.},
|
||||
// pts[0].head_front_radius);
|
||||
|
||||
auto hit = sla::query_hit(sm, bridge);
|
||||
// auto hit = sla::query_hit(sm, bridge);
|
||||
|
||||
REQUIRE(std::isinf(hit.distance()));
|
||||
// REQUIRE(std::isinf(hit.distance()));
|
||||
|
||||
cube.merge(sla::to_triangle_mesh(get_mesh(bridge, steps)));
|
||||
cube.require_shared_vertices();
|
||||
cube.WriteOBJFile("cube2.obj");
|
||||
}
|
||||
}
|
||||
// cube.merge(sla::to_triangle_mesh(get_mesh(bridge, steps)));
|
||||
// cube.require_shared_vertices();
|
||||
// cube.WriteOBJFile("cube2.obj");
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
TEST_CASE("Test bridge_mesh_intersect on a sphere", "[SLABridgeMeshInters]") {
|
||||
using namespace Slic3r;
|
||||
//TEST_CASE("Test bridge_mesh_intersect on a sphere", "[SLABridgeMeshInters]") {
|
||||
// using namespace Slic3r;
|
||||
|
||||
TriangleMesh sphere = make_sphere(1.);
|
||||
// TriangleMesh sphere = make_sphere(1.);
|
||||
|
||||
sla::SupportConfig cfg = {}; // use default config
|
||||
cfg.head_back_radius_mm = cfg.head_front_radius_mm;
|
||||
sla::SupportPoints pts = {{1.f, 0.f, 0.f, float(cfg.head_front_radius_mm), false}};
|
||||
sla::SupportableMesh sm{sphere, pts, cfg};
|
||||
// sla::SupportConfig cfg = {}; // use default config
|
||||
// cfg.head_back_radius_mm = cfg.head_front_radius_mm;
|
||||
// sla::SupportPoints pts = {{1.f, 0.f, 0.f, float(cfg.head_front_radius_mm), false}};
|
||||
// sla::SupportableMesh sm{sphere, pts, cfg};
|
||||
|
||||
size_t steps = 45;
|
||||
SECTION("Bridge is straight horizontal and pointing away from the sphere") {
|
||||
// size_t steps = 45;
|
||||
// SECTION("Bridge is straight horizontal and pointing away from the sphere") {
|
||||
|
||||
sla::Bridge bridge(pts[0].pos.cast<double>(), Vec3d{2., 0., 0.},
|
||||
pts[0].head_front_radius);
|
||||
// sla::Bridge bridge(pts[0].pos.cast<double>(), Vec3d{2., 0., 0.},
|
||||
// pts[0].head_front_radius);
|
||||
|
||||
auto hit = sla::query_hit(sm, bridge);
|
||||
// auto hit = sla::query_hit(sm, bridge);
|
||||
|
||||
sphere.merge(sla::to_triangle_mesh(get_mesh(bridge, steps)));
|
||||
sphere.require_shared_vertices();
|
||||
sphere.WriteOBJFile("sphere1.obj");
|
||||
// sphere.merge(sla::to_triangle_mesh(get_mesh(bridge, steps)));
|
||||
// sphere.require_shared_vertices();
|
||||
// sphere.WriteOBJFile("sphere1.obj");
|
||||
|
||||
REQUIRE(std::isinf(hit.distance()));
|
||||
}
|
||||
// REQUIRE(std::isinf(hit.distance()));
|
||||
// }
|
||||
|
||||
SECTION("Bridge is tilted down 45 deg and pointing away from the sphere") {
|
||||
// SECTION("Bridge is tilted down 45 deg and pointing away from the sphere") {
|
||||
|
||||
sla::Bridge bridge(pts[0].pos.cast<double>(), Vec3d{2., 0., -2.},
|
||||
pts[0].head_front_radius);
|
||||
// sla::Bridge bridge(pts[0].pos.cast<double>(), Vec3d{2., 0., -2.},
|
||||
// pts[0].head_front_radius);
|
||||
|
||||
auto hit = sla::query_hit(sm, bridge);
|
||||
// auto hit = sla::query_hit(sm, bridge);
|
||||
|
||||
sphere.merge(sla::to_triangle_mesh(get_mesh(bridge, steps)));
|
||||
sphere.require_shared_vertices();
|
||||
sphere.WriteOBJFile("sphere2.obj");
|
||||
// sphere.merge(sla::to_triangle_mesh(get_mesh(bridge, steps)));
|
||||
// sphere.require_shared_vertices();
|
||||
// sphere.WriteOBJFile("sphere2.obj");
|
||||
|
||||
REQUIRE(std::isinf(hit.distance()));
|
||||
}
|
||||
// REQUIRE(std::isinf(hit.distance()));
|
||||
// }
|
||||
|
||||
SECTION("Bridge is tilted down 90 deg and pointing away from the sphere") {
|
||||
// SECTION("Bridge is tilted down 90 deg and pointing away from the sphere") {
|
||||
|
||||
sla::Bridge bridge(pts[0].pos.cast<double>(), Vec3d{1., 0., -2.},
|
||||
pts[0].head_front_radius);
|
||||
// sla::Bridge bridge(pts[0].pos.cast<double>(), Vec3d{1., 0., -2.},
|
||||
// pts[0].head_front_radius);
|
||||
|
||||
auto hit = sla::query_hit(sm, bridge);
|
||||
// auto hit = sla::query_hit(sm, bridge);
|
||||
|
||||
sphere.merge(sla::to_triangle_mesh(get_mesh(bridge, steps)));
|
||||
sphere.require_shared_vertices();
|
||||
sphere.WriteOBJFile("sphere3.obj");
|
||||
// sphere.merge(sla::to_triangle_mesh(get_mesh(bridge, steps)));
|
||||
// sphere.require_shared_vertices();
|
||||
// sphere.WriteOBJFile("sphere3.obj");
|
||||
|
||||
REQUIRE(std::isinf(hit.distance()));
|
||||
}
|
||||
}
|
||||
// REQUIRE(std::isinf(hit.distance()));
|
||||
// }
|
||||
//}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue