Fix build

This commit is contained in:
Filip Sykala 2022-02-23 18:57:27 +01:00
parent c718700629
commit a6a9cf7813
11 changed files with 44 additions and 82 deletions

View File

@ -301,35 +301,35 @@ set(SLIC3R_SOURCES
SLA/Clustering.hpp
SLA/Clustering.cpp
SLA/ReprojectPointsOnMesh.hpp
SLA/SupportIslands/EvaluateNeighbor.cpp"
"SLA/SupportIslands/EvaluateNeighbor.hpp"
"SLA/SupportIslands/ExpandNeighbor.cpp"
"SLA/SupportIslands/ExpandNeighbor.hpp"
"SLA/SupportIslands/IStackFunction.hpp"
"SLA/SupportIslands/LineUtils.cpp"
"SLA/SupportIslands/LineUtils.hpp"
"SLA/SupportIslands/NodeDataWithResult.hpp"
"SLA/SupportIslands/Parabola.hpp"
"SLA/SupportIslands/ParabolaUtils.cpp"
"SLA/SupportIslands/ParabolaUtils.hpp"
"SLA/SupportIslands/PointUtils.cpp"
"SLA/SupportIslands/PointUtils.hpp"
"SLA/SupportIslands/PolygonUtils.cpp"
"SLA/SupportIslands/PolygonUtils.hpp"
"SLA/SupportIslands/PostProcessNeighbor.cpp"
"SLA/SupportIslands/PostProcessNeighbor.hpp"
"SLA/SupportIslands/PostProcessNeighbors.cpp"
"SLA/SupportIslands/PostProcessNeighbors.hpp"
"SLA/SupportIslands/SampleConfig.hpp"
"SLA/SupportIslands/SampleConfigFactory.hpp"
"SLA/SupportIslands/SampleIslandUtils.cpp"
"SLA/SupportIslands/SampleIslandUtils.hpp"
"SLA/SupportIslands/SupportIslandPoint.cpp"
"SLA/SupportIslands/SupportIslandPoint.hpp"
"SLA/SupportIslands/VectorUtils.hpp"
"SLA/SupportIslands/VoronoiGraph.hpp"
"SLA/SupportIslands/VoronoiGraphUtils.cpp"
"SLA/SupportIslands/VoronoiGraphUtils.hpp"
SLA/SupportIslands/EvaluateNeighbor.cpp
SLA/SupportIslands/EvaluateNeighbor.hpp
SLA/SupportIslands/ExpandNeighbor.cpp
SLA/SupportIslands/ExpandNeighbor.hpp
SLA/SupportIslands/IStackFunction.hpp
SLA/SupportIslands/LineUtils.cpp
SLA/SupportIslands/LineUtils.hpp
SLA/SupportIslands/NodeDataWithResult.hpp
SLA/SupportIslands/Parabola.hpp
SLA/SupportIslands/ParabolaUtils.cpp
SLA/SupportIslands/ParabolaUtils.hpp
SLA/SupportIslands/PointUtils.cpp
SLA/SupportIslands/PointUtils.hpp
SLA/SupportIslands/PolygonUtils.cpp
SLA/SupportIslands/PolygonUtils.hpp
SLA/SupportIslands/PostProcessNeighbor.cpp
SLA/SupportIslands/PostProcessNeighbor.hpp
SLA/SupportIslands/PostProcessNeighbors.cpp
SLA/SupportIslands/PostProcessNeighbors.hpp
SLA/SupportIslands/SampleConfig.hpp
SLA/SupportIslands/SampleConfigFactory.hpp
SLA/SupportIslands/SampleIslandUtils.cpp
SLA/SupportIslands/SampleIslandUtils.hpp
SLA/SupportIslands/SupportIslandPoint.cpp
SLA/SupportIslands/SupportIslandPoint.hpp
SLA/SupportIslands/VectorUtils.hpp
SLA/SupportIslands/VoronoiGraph.hpp
SLA/SupportIslands/VoronoiGraphUtils.cpp
SLA/SupportIslands/VoronoiGraphUtils.hpp
)
add_library(libslic3r STATIC ${SLIC3R_SOURCES})

View File

@ -287,42 +287,6 @@ bool liang_barsky_line_clipping(
return liang_barsky_line_clipping(x0clip, x1clip, bbox);
}
// Ugly named variant, that accepts the squared line
// Don't call me with a nearly zero length vector!
// sympy:
// factor(solve([a * x + b * y + c, x**2 + y**2 - r**2], [x, y])[0])
// factor(solve([a * x + b * y + c, x**2 + y**2 - r**2], [x, y])[1])
template<typename T>
int ray_circle_intersections_r2_lv2_c(T r2, T a, T b, T lv2, T c, std::pair<Eigen::Matrix<T, 2, 1, Eigen::DontAlign>, Eigen::Matrix<T, 2, 1, Eigen::DontAlign>> &out)
{
T d2 = r2 * lv2 - c * c;
if (d2 < T(0))
return 0;
T x0 = - a * c;
T y0 = - b * c;
T d = sqrt(d2);
out.first.x() = (x0 + b * d) / lv2;
out.first.y() = (y0 - a * d) / lv2;
out.second.x() = (x0 - b * d) / lv2;
out.second.y() = (y0 + a * d) / lv2;
return d == T(0) ? 1 : 2;
}
template<typename T>
int ray_circle_intersections(T r, T a, T b, T c, std::pair<Eigen::Matrix<T, 2, 1, Eigen::DontAlign>, Eigen::Matrix<T, 2, 1, Eigen::DontAlign>> &out)
{
T lv2 = a * a + b * b;
if (lv2 < T(SCALED_EPSILON * SCALED_EPSILON)) {
//FIXME what is the correct epsilon?
// What if the line touches the circle?
return false;
}
return ray_circle_intersections_r2_lv2_c(r * r, a, b, a * a + b * b, c, out);
}
Pointf3s convex_hull(Pointf3s points);
Polygon convex_hull(Points points);
Polygon convex_hull(const Polygons &polygons);
bool directions_parallel(double angle1, double angle2, double max_diff = 0);
bool directions_perpendicular(double angle1, double angle2, double max_diff = 0);
template<class T> bool contains(const std::vector<T> &vector, const Point &point);

View File

@ -179,7 +179,7 @@ int ray_circle_intersections(T r, T a, T b, T c, std::pair<Eigen::Matrix<T, 2, 1
// What if the line touches the circle?
return false;
}
return ray_circle_intersections_r2_lv2_c2(r * r, a, b, a * a + b * b, c, out);
return ray_circle_intersections_r2_lv2_c(r * r, a, b, a * a + b * b, c, out);
}
} } // namespace Slic3r::Geometry

View File

@ -1,5 +1,6 @@
#include "LineUtils.hpp"
#include <libslic3r/Geometry.hpp>
#include <libslic3r/Geometry/Circle.hpp>
#include <functional>
#include "VectorUtils.hpp"
#include "PointUtils.hpp"

View File

@ -4,8 +4,8 @@
// sampling parabola
#include <libslic3r/Geometry.hpp>
#include <libslic3r/VoronoiOffset.hpp>
#include <libslic3r/VoronoiVisualUtils.hpp>
#include <libslic3r/Geometry/VoronoiOffset.hpp>
#include <libslic3r/Geometry/VoronoiVisualUtils.hpp>
using namespace Slic3r::sla;

View File

@ -2,7 +2,7 @@
#include <cmath>
#include <optional>
#include <libslic3r/VoronoiOffset.hpp>
#include <libslic3r/Geometry/VoronoiOffset.hpp>
#include "IStackFunction.hpp"
#include "EvaluateNeighbor.hpp"
#include "ParabolaUtils.hpp"
@ -11,7 +11,7 @@
#include "LineUtils.hpp"
#include "PointUtils.hpp"
#include <libslic3r/VoronoiVisualUtils.hpp>
#include <libslic3r/Geometry/VoronoiVisualUtils.hpp>
#include <libslic3r/ClipperUtils.hpp> // allign

View File

@ -3,6 +3,7 @@
#include <map>
#include <libslic3r/Geometry.hpp>
#include <libslic3r/Geometry/Voronoi.hpp>
#include <numeric>
namespace Slic3r::sla {

View File

@ -2,7 +2,7 @@
#include <cmath>
#include <set>
#include <libslic3r/VoronoiOffset.hpp>
#include <libslic3r/Geometry/VoronoiOffset.hpp>
#include "IStackFunction.hpp"
#include "EvaluateNeighbor.hpp"
#include "ParabolaUtils.hpp"
@ -10,7 +10,7 @@
#include "PointUtils.hpp"
#include "PolygonUtils.hpp"
#include <libslic3r/VoronoiVisualUtils.hpp>
#include <libslic3r/Geometry/VoronoiVisualUtils.hpp>
// comment definition of NDEBUG to enable assert()
//#define NDEBUG

View File

@ -18,7 +18,7 @@
#include "libnest2d/utils/rotcalipers.hpp"
#include "libslic3r/EdgeGrid.hpp"
#include "libslic3r/VoronoiOffset.hpp"
#include "libslic3r/Geometry/VoronoiOffset.hpp"
#include "libslic3r/SLA/SupportIslands/VoronoiGraphUtils.hpp"
#include "libslic3r/SLA/SupportIslands/SampleIslandUtils.hpp"

View File

@ -4,6 +4,7 @@
#include <libslic3r/ExPolygon.hpp>
#include <libslic3r/BoundingBox.hpp>
#include <libslic3r/ClipperUtils.hpp>
#include <libslic3r/TriangleMeshSlicer.hpp>
#include <libslic3r/SLA/SupportIslands/SampleConfig.hpp>
#include <libslic3r/SLA/SupportIslands/VoronoiGraphUtils.hpp>
@ -356,10 +357,7 @@ ExPolygons createTestIslands(double size)
if (useFrogLeg) {
TriangleMesh mesh = load_model("frog_legs.obj");
TriangleMeshSlicer slicer{&mesh};
std::vector<float> grid({0.1f});
std::vector<ExPolygons> slices;
slicer.slice(grid, SlicingMode::Regular, 0.05f, &slices, [] {});
std::vector<ExPolygons> slices = slice_mesh_ex(mesh.its, {0.1f});
ExPolygon frog_leg = slices.front()[1];
result.push_back(frog_leg);
}
@ -487,14 +485,12 @@ SampleConfig create_sample_config(double size) {
}
#include <libslic3r/Geometry.hpp>
#include <libslic3r/VoronoiOffset.hpp>
#include <libslic3r/Geometry/VoronoiOffset.hpp>
TEST_CASE("Sampling speed test on FrogLegs", "[hide], [VoronoiSkeleton]")
{
TriangleMesh mesh = load_model("frog_legs.obj");
TriangleMeshSlicer slicer{&mesh};
std::vector<float> grid({0.1f});
std::vector<ExPolygons> slices;
slicer.slice(grid, SlicingMode::Regular, 0.05f, &slices, [] {});
std::vector<ExPolygons> slices = slice_mesh_ex(mesh.its, {0.1f});
ExPolygon frog_leg = slices.front()[1];
SampleConfig cfg = create_sample_config(3e7);

View File

@ -1,6 +1,6 @@
#include "sla_test_utils.hpp"
#include <libslic3r/SLA/SupportIslands/VoronoiGraphUtils.hpp>
#include <libslic3r/VoronoiVisualUtils.hpp>
#include <libslic3r/Geometry/VoronoiVisualUtils.hpp>
using namespace Slic3r;
using namespace Slic3r::sla;