mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-11-01 21:21:10 -06:00
Merge branch 'master' into lm_tm_hollowing
This commit is contained in:
commit
537260494d
185 changed files with 83280 additions and 4591 deletions
|
|
@ -27,4 +27,5 @@ add_subdirectory(libslic3r)
|
|||
add_subdirectory(timeutils)
|
||||
add_subdirectory(fff_print)
|
||||
add_subdirectory(sla_print)
|
||||
add_subdirectory(cpp17 EXCLUDE_FROM_ALL) # does not have to be built all the time
|
||||
# add_subdirectory(example)
|
||||
|
|
|
|||
9
tests/cpp17/CMakeLists.txt
Normal file
9
tests/cpp17/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.1)
|
||||
|
||||
project(Cpp17Test)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
add_executable(cpp17test main.cpp)
|
||||
|
||||
80
tests/cpp17/main.cpp
Normal file
80
tests/cpp17/main.cpp
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <tuple>
|
||||
#include <string>
|
||||
|
||||
// Test new headers in cpp17
|
||||
#include <variant>
|
||||
#include <optional>
|
||||
#include <any>
|
||||
#include <string_view>
|
||||
|
||||
// Test for nested namespace definition
|
||||
namespace PrusaSlicer::Cpp17 {
|
||||
|
||||
template<class T> class Foo
|
||||
{
|
||||
T m_arg;
|
||||
public:
|
||||
|
||||
explicit Foo(T &&arg): m_arg{arg} {}
|
||||
};
|
||||
|
||||
} // namespace PrusaSlicer::Cpp17
|
||||
|
||||
template<class T> std::string get_type(const T &v);
|
||||
|
||||
template<> std::string get_type(const int &) { return "int"; }
|
||||
template<> std::string get_type(const double &) { return "double"; }
|
||||
template<> std::string get_type(const float &) { return "double"; }
|
||||
|
||||
int main()
|
||||
{
|
||||
// /////////////////////////////////////////////////////////////////////////
|
||||
// Template argument deduction for class templates
|
||||
// /////////////////////////////////////////////////////////////////////////
|
||||
|
||||
auto foo = PrusaSlicer::Cpp17::Foo{1.f};
|
||||
|
||||
// /////////////////////////////////////////////////////////////////////////
|
||||
// Structured bindings:
|
||||
// /////////////////////////////////////////////////////////////////////////
|
||||
|
||||
auto my_tuple = std::make_tuple(0.2, 10);
|
||||
|
||||
auto [a, b] = my_tuple;
|
||||
|
||||
std::cout << "a is " << get_type(a) << std::endl;
|
||||
std::cout << "b is " << get_type(b) << std::endl;
|
||||
|
||||
// /////////////////////////////////////////////////////////////////////////
|
||||
// Test for std::apply()
|
||||
// /////////////////////////////////////////////////////////////////////////
|
||||
|
||||
auto fun = [] (auto a, auto b) {
|
||||
std::cout << "a (" << get_type(a) << ") = " << a << std::endl;
|
||||
std::cout << "b (" << get_type(b) << ") = " << b << std::endl;
|
||||
};
|
||||
|
||||
std::apply(fun, my_tuple);
|
||||
|
||||
// /////////////////////////////////////////////////////////////////////////
|
||||
// constexpr lambda and if
|
||||
// /////////////////////////////////////////////////////////////////////////
|
||||
|
||||
auto isIntegral = [](auto v) constexpr -> bool {
|
||||
if constexpr (std::is_integral_v<decltype(v)>) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
static_assert (isIntegral(10), "" );
|
||||
// would fail to compile: static_assert (isIntegral(10.0), "" );
|
||||
|
||||
std::cout << "Integer is integral: " << isIntegral(0) << std::endl;
|
||||
std::cout << "Floating point is not integral: " << isIntegral(0.0) << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
@ -263,6 +263,42 @@ SCENARIO("Path chaining", "[Geometry]") {
|
|||
}
|
||||
}
|
||||
}
|
||||
GIVEN("Gyroid infill end points") {
|
||||
Polylines polylines = {
|
||||
{ {28122608, 3221037}, {27919139, 56036027} },
|
||||
{ {33642863, 3400772}, {30875220, 56450360} },
|
||||
{ {34579315, 3599827}, {35049758, 55971572} },
|
||||
{ {26483070, 3374004}, {23971830, 55763598} },
|
||||
{ {38931405, 4678879}, {38740053, 55077714} },
|
||||
{ {20311895, 5015778}, {20079051, 54551952} },
|
||||
{ {16463068, 6773342}, {18823514, 53992958} },
|
||||
{ {44433771, 7424951}, {42629462, 53346059} },
|
||||
{ {15697614, 7329492}, {15350896, 52089991} },
|
||||
{ {48085792, 10147132}, {46435427, 50792118} },
|
||||
{ {48828819, 10972330}, {49126582, 48368374} },
|
||||
{ {9654526, 12656711}, {10264020, 47691584} },
|
||||
{ {5726905, 18648632}, {8070762, 45082416} },
|
||||
{ {54818187, 39579970}, {52974912, 43271272} },
|
||||
{ {4464342, 37371742}, {5027890, 39106220} },
|
||||
{ {54139746, 18417661}, {55177987, 38472580} },
|
||||
{ {56527590, 32058461}, {56316456, 34067185} },
|
||||
{ {3303988, 29215290}, {3569863, 32985633} },
|
||||
{ {56255666, 25025857}, {56478310, 27144087} },
|
||||
{ {4300034, 22805361}, {3667946, 25752601} },
|
||||
{ {8266122, 14250611}, {6244813, 17751595} },
|
||||
{ {12177955, 9886741}, {10703348, 11491900} }
|
||||
};
|
||||
Polylines chained = chain_polylines(polylines);
|
||||
THEN("Chained taking the shortest path") {
|
||||
double connection_length = 0.;
|
||||
for (size_t i = 1; i < chained.size(); ++i) {
|
||||
const Polyline &pl1 = chained[i - 1];
|
||||
const Polyline &pl2 = chained[i];
|
||||
connection_length += (pl2.first_point() - pl1.last_point()).cast<double>().norm();
|
||||
}
|
||||
REQUIRE(connection_length < 85206000.);
|
||||
}
|
||||
}
|
||||
GIVEN("Loop pieces") {
|
||||
Point a { 2185796, 19058485 };
|
||||
Point b { 3957902, 18149382 };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue