Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVojtech Bubnik <bubnikv@gmail.com>2021-11-16 12:15:51 +0300
committerVojtech Bubnik <bubnikv@gmail.com>2021-11-16 12:15:51 +0300
commitcc44089440750e3a0ce3db5a9509519f7de68811 (patch)
tree5c47217b5ff3542c24ff910347813f21acd8c6c5 /src/slic3r/GUI/BedShapeDialog.hpp
parentb431fd1f7ea2ae7bbb5034869f9b2b509511e06f (diff)
New BuildVolume class was created, which detects build volume type (rectangular,
circular, convex, concave) and performs efficient collision detection agains these build volumes. As of now, collision detection is performed against a convex hull of a concave build volume for efficency. GCodeProcessor::Result renamed out of GCodeProcessor to GCodeProcessorResult, so it could be forward declared. Plater newly exports BuildVolume, not Bed3D. Bed3D is a rendering class, while BuildVolume is a purely geometric class. Reduced usage of global wxGetApp, the Bed3D is passed as a parameter to View3D/Preview/GLCanvas. Convex hull code was extracted from Geometry.cpp/hpp to Geometry/ConvexHulll.cpp,hpp. New test inside_convex_polygon(). New efficent point inside polygon test: Decompose convex hull to bottom / top parts and use the decomposition to detect point inside a convex polygon in O(log n). decompose_convex_polygon_top_bottom(), inside_convex_polygon(). New Circle constructing functions: circle_ransac() and circle_taubin_newton(). New polygon_is_convex() test with unit tests.
Diffstat (limited to 'src/slic3r/GUI/BedShapeDialog.hpp')
-rw-r--r--src/slic3r/GUI/BedShapeDialog.hpp40
1 files changed, 10 insertions, 30 deletions
diff --git a/src/slic3r/GUI/BedShapeDialog.hpp b/src/slic3r/GUI/BedShapeDialog.hpp
index af84ffb95..032aa2880 100644
--- a/src/slic3r/GUI/BedShapeDialog.hpp
+++ b/src/slic3r/GUI/BedShapeDialog.hpp
@@ -5,11 +5,10 @@
#include "GUI_Utils.hpp"
#include "2DBed.hpp"
-#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
-#include "3DBed.hpp"
-#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
#include "I18N.hpp"
+#include <libslic3r/BuildVolume.hpp>
+
#include <wx/dialog.h>
#include <wx/choicebk.h>
@@ -22,14 +21,11 @@ using ConfigOptionsGroupShp = std::shared_ptr<ConfigOptionsGroup>;
struct BedShape
{
-#if !ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
- enum class Type {
- Rectangular = 0,
- Circular,
- Custom,
- Invalid
+ enum class PageType {
+ Rectangle,
+ Circle,
+ Custom
};
-#endif // !ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
enum class Parameter {
RectSize,
@@ -39,34 +35,18 @@ struct BedShape
BedShape(const ConfigOptionPoints& points);
-#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
- bool is_custom() { return m_type == Bed3D::EShapeType::Custom; }
-#else
- bool is_custom() { return m_type == Type::Custom; }
-#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
+ bool is_custom() { return m_build_volume.type() == BuildVolume::Type::Convex || m_build_volume.type() == BuildVolume::Type::Custom; }
static void append_option_line(ConfigOptionsGroupShp optgroup, Parameter param);
-#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
- static wxString get_name(Bed3D::EShapeType type);
-#else
- static wxString get_name(Type type);
-#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
+ static wxString get_name(PageType type);
- // convert Type to size_t
- size_t get_type();
+ PageType get_page_type();
wxString get_full_name_with_params();
void apply_optgroup_values(ConfigOptionsGroupShp optgroup);
private:
-#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
- Bed3D::EShapeType m_type{ Bed3D::EShapeType::Invalid };
-#else
- Type m_type {Type::Invalid};
-#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
- Vec2d m_rectSize {200, 200};
- Vec2d m_rectOrigin {0, 0};
- double m_diameter {0};
+ BuildVolume m_build_volume;
};
class BedShapePanel : public wxPanel