Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::BuildVolume Class Reference

#include <src/libslic3r/BuildVolume.hpp>

+ Collaboration diagram for Slic3r::BuildVolume:

Public Types

enum class  Type : unsigned char {
  Invalid , Rectangle , Circle , Convex ,
  Custom
}
 
enum class  ObjectState : unsigned char { Inside , Colliding , Outside , Below }
 

Public Member Functions

 BuildVolume ()
 
 BuildVolume (const std::vector< Vec2d > &bed_shape, const double max_print_height)
 
const std::vector< Vec2d > & bed_shape () const
 
double max_print_height () const
 
Type type () const
 
std::string_view type_name () const
 
bool valid () const
 
const Polygonpolygon () const
 
const BoundingBoxbounding_box () const
 
const BoundingBoxf3bounding_volume () const
 
BoundingBoxf bounding_volume2d () const
 
Vec2d bed_center () const
 
const Polygonconvex_hull () const
 
const Geometry::Circledcircle () const
 
ObjectState object_state (const indexed_triangle_set &its, const Transform3f &trafo, bool may_be_below_bed, bool ignore_bottom=true) const
 
ObjectState volume_state_bbox (const BoundingBoxf3 &volume_bbox, bool ignore_bottom=true) const
 
bool all_paths_inside (const GCodeProcessorResult &paths, const BoundingBoxf3 &paths_bbox, bool ignore_bottom=true) const
 
bool all_paths_inside_vertices_and_normals_interleaved (const std::vector< float > &paths, const Eigen::AlignedBox< float, 3 > &bbox, bool ignore_bottom=true) const
 
const std::pair< std::vector< Vec2d >, std::vector< Vec2d > > & top_bottom_convex_hull_decomposition_scene () const
 
const std::pair< std::vector< Vec2d >, std::vector< Vec2d > > & top_bottom_convex_hull_decomposition_bed () const
 

Static Public Member Functions

static std::string_view type_name (Type type)
 

Static Public Attributes

static constexpr const double SceneEpsilon = EPSILON
 
static constexpr const double BedEpsilon = 3. * EPSILON
 

Private Attributes

std::vector< Vec2dm_bed_shape
 
double m_max_print_height
 
Type m_type { Type::Invalid }
 
Polygon m_polygon
 
BoundingBox m_bbox
 
BoundingBoxf3 m_bboxf
 
double m_area { 0. }
 
Polygon m_convex_hull
 
std::pair< std::vector< Vec2d >, std::vector< Vec2d > > m_top_bottom_convex_hull_decomposition_scene
 
std::pair< std::vector< Vec2d >, std::vector< Vec2d > > m_top_bottom_convex_hull_decomposition_bed
 
Geometry::Circled m_circle { Vec2d::Zero(), 0 }
 

Detailed Description

Member Enumeration Documentation

◆ ObjectState

enum class Slic3r::BuildVolume::ObjectState : unsigned char
strong
Enumerator
Inside 
Colliding 
Outside 
Below 
65 {
66 // Inside the build volume, thus printable.
67 Inside,
68 // Colliding with the build volume boundary, thus not printable and error is shown.
70 // Outside of the build volume means the object is ignored: Not printed and no error is shown.
71 Outside,
72 // Completely below the print bed. The same as Outside, but an object with one printable part below the print bed
73 // and at least one part above the print bed is still printable.
74 Below,
75 };

◆ Type

enum class Slic3r::BuildVolume::Type : unsigned char
strong
Enumerator
Invalid 
Rectangle 
Circle 
Convex 
Custom 
21 {
22 // Not set yet or undefined.
23 Invalid,
24 // Rectangular print bed. Most common, cheap to work with.
26 // Circular print bed. Common on detals, cheap to work with.
27 Circle,
28 // Convex print bed. Complex to process.
29 Convex,
30 // Some non convex shape.
31 Custom
32 };

Constructor & Destructor Documentation

◆ BuildVolume() [1/2]

Slic3r::BuildVolume::BuildVolume ( )
inline
35{}

◆ BuildVolume() [2/2]

Slic3r::BuildVolume::BuildVolume ( const std::vector< Vec2d > &  bed_shape,
const double  max_print_height 
)
12{
13 assert(max_print_height >= 0);
14
16
17 // Calcuate various metrics of the input polygon.
21
22 BoundingBoxf bboxf = get_extents(bed_shape);
23 m_bboxf = BoundingBoxf3{ to_3d(bboxf.min, 0.), to_3d(bboxf.max, max_print_height) };
24
25 if (bed_shape.size() >= 4 && std::abs((m_area - double(m_bbox.size().x()) * double(m_bbox.size().y()))) < sqr(SCALED_EPSILON)) {
26 // Square print bed, use the bounding box for collision detection.
28 m_circle.center = 0.5 * (m_bbox.min.cast<double>() + m_bbox.max.cast<double>());
29 m_circle.radius = 0.5 * m_bbox.size().cast<double>().norm();
30 } else if (bed_shape.size() > 3) {
31 // Circle was discretized, formatted into text with limited accuracy, thus the circle was deformed.
32 // RANSAC is slightly more accurate than the iterative Taubin / Newton method with such an input.
33// m_circle = Geometry::circle_taubin_newton(bed_shape);
35 bool is_circle = true;
36#ifndef NDEBUG
37 // Measuring maximum absolute error of interpolating an input polygon with circle.
38 double max_error = 0;
39#endif // NDEBUG
40 Vec2d prev = bed_shape.back();
41 for (const Vec2d &p : bed_shape) {
42#ifndef NDEBUG
43 max_error = std::max(max_error, std::abs((p - m_circle.center).norm() - m_circle.radius));
44#endif // NDEBUG
45 if (// Polygon vertices must lie very close the circle.
46 std::abs((p - m_circle.center).norm() - m_circle.radius) > 0.005 ||
47 // Midpoints of polygon edges must not undercat more than 3mm. This corresponds to 72 edges per circle generated by BedShapePanel::update_shape().
48 m_circle.radius - (0.5 * (prev + p) - m_circle.center).norm() > 3.) {
49 is_circle = false;
50 break;
51 }
52 prev = p;
53 }
54 if (is_circle) {
56 m_circle.center = scaled<double>(m_circle.center);
57 m_circle.radius = scaled<double>(m_circle.radius);
58 }
59 }
60
61 if (bed_shape.size() >= 3 && m_type == Type::Invalid) {
62 // Circle check is not used for Convex / Custom shapes, fill it with something reasonable.
65 // Initialize the top / bottom decomposition for inside convex polygon check. Do it with two different epsilons applied.
66 auto convex_decomposition = [](const Polygon &in, double epsilon) {
67 Polygon src = expand(in, float(epsilon)).front();
68 std::vector<Vec2d> pts;
69 pts.reserve(src.size());
70 for (const Point &pt : src.points)
71 pts.emplace_back(unscaled<double>(pt.cast<double>().eval()));
73 };
76 }
77
78 BOOST_LOG_TRIVIAL(debug) << "BuildVolume bed_shape clasified as: " << this->type_name();
79}
EIGEN_DEVICE_FUNC CastXpr< NewType >::Type cast() const
Definition CommonCwiseUnaryOps.h:62
PointType max
Definition BoundingBox.hpp:17
PointType size() const
Definition BoundingBox.cpp:144
PointType min
Definition BoundingBox.hpp:16
double max_print_height() const
Definition BuildVolume.hpp:41
static constexpr const double BedEpsilon
Definition BuildVolume.hpp:90
Polygon m_polygon
Definition BuildVolume.hpp:110
std::vector< Vec2d > m_bed_shape
Definition BuildVolume.hpp:103
Geometry::Circled m_circle
Definition BuildVolume.hpp:125
BoundingBoxf3 m_bboxf
Definition BuildVolume.hpp:114
double m_max_print_height
Definition BuildVolume.hpp:105
BoundingBox m_bbox
Definition BuildVolume.hpp:112
Type m_type
Definition BuildVolume.hpp:108
double m_area
Definition BuildVolume.hpp:116
std::string_view type_name() const
Definition BuildVolume.hpp:47
const std::vector< Vec2d > & bed_shape() const
Definition BuildVolume.hpp:40
std::pair< std::vector< Vec2d >, std::vector< Vec2d > > m_top_bottom_convex_hull_decomposition_bed
Definition BuildVolume.hpp:123
Polygon m_convex_hull
Definition BuildVolume.hpp:118
static constexpr const double SceneEpsilon
Definition BuildVolume.hpp:79
std::pair< std::vector< Vec2d >, std::vector< Vec2d > > m_top_bottom_convex_hull_decomposition_scene
Definition BuildVolume.hpp:121
Points points
Definition MultiPoint.hpp:18
static Polygon new_scale(const std::vector< Vec2d > &points)
Definition Polygon.hpp:31
static double area(const Points &pts)
Definition Polygon.cpp:49
#define SCALED_EPSILON
Definition libslic3r.h:71
constexpr double epsilon()
Definition DoubleSlider.hpp:28
Circled circle_ransac(const Vec2ds &input, size_t iterations, double *min_error)
Definition Circle.cpp:111
Polygon convex_hull(Points pts)
Definition ConvexHull.cpp:11
Circle< Vector > smallest_enclosing_circle_welzl(const Points &points, const typename Vector::Scalar epsilon)
Definition Circle.hpp:142
std::pair< std::vector< Vec2d >, std::vector< Vec2d > > decompose_convex_polygon_top_bottom(const std::vector< Vec2d > &src)
Definition ConvexHull.cpp:335
Slic3r::Polygons expand(const Slic3r::Polygon &polygon, const float delta, ClipperLib::JoinType joinType=DefaultJoinType, double miterLimit=DefaultMiterLimit)
Definition ClipperUtils.hpp:363
Eigen::Matrix< typename Derived::Scalar, 3, 1, Eigen::DontAlign > to_3d(const Eigen::MatrixBase< Derived > &pt, const typename Derived::Scalar z)
Definition Point.hpp:127
Eigen::Matrix< double, 2, 1, Eigen::DontAlign > Vec2d
Definition Point.hpp:51
BoundingBox get_extents(const ExPolygon &expolygon)
Definition ExPolygon.cpp:352
constexpr T sqr(T x)
Definition libslic3r.h:258
constexpr Eigen::Matrix< Tout, 2, EigenArgs... > unscaled(const Slic3r::ClipperLib::IntPoint &v) noexcept
Definition Arrange.cpp:55
Slic3r::Polygon Polygon
Definition Emboss.cpp:34
Kernel::Point_2 Point
Definition point_areas.cpp:20
Vector center
Definition Circle.hpp:65
Scalar radius
Definition Circle.hpp:66

References Slic3r::Polygon::area(), bed_shape(), BedEpsilon, Slic3r::Geometry::Circle< Vector >::center, Circle, Slic3r::Geometry::circle_ransac(), Convex, Slic3r::Geometry::convex_hull(), Custom, Slic3r::Geometry::decompose_convex_polygon_top_bottom(), Slic3r::expand(), Slic3r::get_extents(), Invalid, m_area, m_bbox, m_bboxf, m_circle, m_convex_hull, m_polygon, m_top_bottom_convex_hull_decomposition_bed, m_top_bottom_convex_hull_decomposition_scene, m_type, Slic3r::BoundingBoxBase< PointType, APointsType >::max, max_print_height(), Slic3r::BoundingBoxBase< PointType, APointsType >::min, Slic3r::Polygon::new_scale(), Slic3r::MultiPoint::points, Slic3r::Geometry::Circle< Vector >::radius, Rectangle, SCALED_EPSILON, SceneEpsilon, Slic3r::BoundingBoxBase< PointType, APointsType >::size(), Slic3r::MultiPoint::size(), Slic3r::Geometry::smallest_enclosing_circle_welzl(), Slic3r::sqr(), Slic3r::to_3d(), and type_name().

+ Here is the call graph for this function:

Member Function Documentation

◆ all_paths_inside()

bool Slic3r::BuildVolume::all_paths_inside ( const GCodeProcessorResult paths,
const BoundingBoxf3 paths_bbox,
bool  ignore_bottom = true 
) const
321{
322 auto move_valid = [](const GCodeProcessorResult::MoveVertex &move) {
323 return move.type == EMoveType::Extrude && move.extrusion_role != GCodeExtrusionRole::Custom && move.width != 0.f && move.height != 0.f;
324 };
325 static constexpr const double epsilon = BedEpsilon;
326
327 switch (m_type) {
328 case Type::Rectangle:
329 {
330 BoundingBox3Base<Vec3d> build_volume = this->bounding_volume().inflated(epsilon);
331 if (m_max_print_height == 0.0)
332 build_volume.max.z() = std::numeric_limits<double>::max();
333 if (ignore_bottom)
334 build_volume.min.z() = -std::numeric_limits<double>::max();
335 return build_volume.contains(paths_bbox);
336 }
337 case Type::Circle:
338 {
339 const Vec2f c = unscaled<float>(m_circle.center);
340 const float r = unscaled<double>(m_circle.radius) + epsilon;
341 const float r2 = sqr(r);
342 return m_max_print_height == 0.0 ?
343 std::all_of(paths.moves.begin(), paths.moves.end(), [move_valid, c, r2](const GCodeProcessorResult::MoveVertex &move)
344 { return ! move_valid(move) || (to_2d(move.position) - c).squaredNorm() <= r2; }) :
345 std::all_of(paths.moves.begin(), paths.moves.end(), [move_valid, c, r2, z = m_max_print_height + epsilon](const GCodeProcessorResult::MoveVertex& move)
346 { return ! move_valid(move) || ((to_2d(move.position) - c).squaredNorm() <= r2 && move.position.z() <= z); });
347 }
348 case Type::Convex:
349 //FIXME doing test on convex hull until we learn to do test on non-convex polygons efficiently.
350 case Type::Custom:
351 return m_max_print_height == 0.0 ?
352 std::all_of(paths.moves.begin(), paths.moves.end(), [move_valid, this](const GCodeProcessorResult::MoveVertex &move)
353 { return ! move_valid(move) || Geometry::inside_convex_polygon(m_top_bottom_convex_hull_decomposition_bed, to_2d(move.position).cast<double>()); }) :
354 std::all_of(paths.moves.begin(), paths.moves.end(), [move_valid, this, z = m_max_print_height + epsilon](const GCodeProcessorResult::MoveVertex &move)
355 { return ! move_valid(move) || (Geometry::inside_convex_polygon(m_top_bottom_convex_hull_decomposition_bed, to_2d(move.position).cast<double>()) && move.position.z() <= z); });
356 default:
357 return true;
358 }
359}
BoundingBox3Base< PointType > inflated(coordf_t delta) const
Definition BoundingBox.hpp:126
const BoundingBoxf3 & bounding_volume() const
Definition BuildVolume.hpp:54
#define const
Definition getopt.c:38
Eigen::Matrix< typename Derived::Scalar, 2, 1, Eigen::DontAlign > to_2d(const Eigen::MatrixBase< Derived > &ptN)
Definition Point.hpp:121
Eigen::Matrix< float, 2, 1, Eigen::DontAlign > Vec2f
Definition Point.hpp:48
bool all_of(const C &container)
Definition MTUtils.hpp:77
S::iterator begin(S &sh, const PathTag &)
Definition geometry_traits.hpp:614
S::iterator end(S &sh, const PathTag &)
Definition geometry_traits.hpp:620
STL namespace.

References BedEpsilon, bounding_volume(), Slic3r::Geometry::Circle< Vector >::center, Circle, Slic3r::BoundingBox3Base< PointType >::contains(), Convex, Custom, Slic3r::Custom, Slic3r::Extrude, Slic3r::BoundingBox3Base< PointType >::inflated(), m_circle, m_max_print_height, m_type, Slic3r::BoundingBoxBase< PointType, APointsType >::max, Slic3r::BoundingBoxBase< PointType, APointsType >::min, Slic3r::GCodeProcessorResult::moves, Slic3r::Geometry::Circle< Vector >::radius, Rectangle, and Slic3r::sqr().

+ Here is the call graph for this function:

◆ all_paths_inside_vertices_and_normals_interleaved()

bool Slic3r::BuildVolume::all_paths_inside_vertices_and_normals_interleaved ( const std::vector< float > &  paths,
const Eigen::AlignedBox< float, 3 > &  bbox,
bool  ignore_bottom = true 
) const
374{
375 assert(paths.size() % 6 == 0);
376 static constexpr const double epsilon = BedEpsilon;
377 switch (m_type) {
378 case Type::Rectangle:
379 {
380 BoundingBox3Base<Vec3d> build_volume = this->bounding_volume().inflated(epsilon);
381 if (m_max_print_height == 0.0)
382 build_volume.max.z() = std::numeric_limits<double>::max();
383 if (ignore_bottom)
384 build_volume.min.z() = -std::numeric_limits<double>::max();
385 return build_volume.contains(paths_bbox.min().cast<double>()) && build_volume.contains(paths_bbox.max().cast<double>());
386 }
387 case Type::Circle:
388 {
389 const Vec2f c = unscaled<float>(m_circle.center);
390 const float r = unscaled<double>(m_circle.radius) + float(epsilon);
391 const float r2 = sqr(r);
392 return m_max_print_height == 0.0 ?
393 all_inside_vertices_normals_interleaved(paths, [c, r2](Vec3f p) { return (to_2d(p) - c).squaredNorm() <= r2; }) :
394 all_inside_vertices_normals_interleaved(paths, [c, r2, z = m_max_print_height + epsilon](Vec3f p) { return (to_2d(p) - c).squaredNorm() <= r2 && p.z() <= z; });
395 }
396 case Type::Convex:
397 //FIXME doing test on convex hull until we learn to do test on non-convex polygons efficiently.
398 case Type::Custom:
399 return m_max_print_height == 0.0 ?
402 default:
403 return true;
404 }
405}
bool inside_convex_polygon(const std::pair< std::vector< Vec2d >, std::vector< Vec2d > > &top_bottom_decomposition, const Vec2d &pt)
Definition ConvexHull.cpp:382
Eigen::Matrix< float, 3, 1, Eigen::DontAlign > Vec3f
Definition Point.hpp:49
bool all_inside_vertices_normals_interleaved(const std::vector< float > &paths, Fn fn)
Definition BuildVolume.cpp:362

References Slic3r::all_inside_vertices_normals_interleaved(), BedEpsilon, bounding_volume(), Slic3r::Geometry::Circle< Vector >::center, Circle, Slic3r::BoundingBox3Base< PointType >::contains(), Convex, Custom, Slic3r::BoundingBox3Base< PointType >::inflated(), Slic3r::Geometry::inside_convex_polygon(), m_circle, m_max_print_height, m_top_bottom_convex_hull_decomposition_bed, m_type, Eigen::AlignedBox< _Scalar, _AmbientDim >::max(), Slic3r::BoundingBoxBase< PointType, APointsType >::max, Eigen::AlignedBox< _Scalar, _AmbientDim >::min(), Slic3r::BoundingBoxBase< PointType, APointsType >::min, Slic3r::Geometry::Circle< Vector >::radius, Rectangle, Slic3r::sqr(), and Slic3r::to_2d().

+ Here is the call graph for this function:

◆ bed_center()

Vec2d Slic3r::BuildVolume::bed_center ( ) const
inline
58{ return to_2d(m_bboxf.center()); }
PointType center() const
Definition BoundingBox.cpp:203

References Slic3r::BoundingBox3Base< PointType >::center(), m_bboxf, and Slic3r::to_2d().

+ Here is the call graph for this function:

◆ bed_shape()

const std::vector< Vec2d > & Slic3r::BuildVolume::bed_shape ( ) const
inline
40{ return m_bed_shape; }

References m_bed_shape.

Referenced by BuildVolume(), Slic3r::GUI::Bed3D::set_shape(), and priv::start_create_object_job().

+ Here is the caller graph for this function:

◆ bounding_box()

const BoundingBox & Slic3r::BuildVolume::bounding_box ( ) const
inline
52{ return m_bbox; }

References m_bbox.

◆ bounding_volume()

◆ bounding_volume2d()

BoundingBoxf Slic3r::BuildVolume::bounding_volume2d ( ) const
inline
55{ return { to_2d(m_bboxf.min), to_2d(m_bboxf.max) }; }

References m_bboxf, Slic3r::BoundingBoxBase< PointType, APointsType >::max, Slic3r::BoundingBoxBase< PointType, APointsType >::min, and Slic3r::to_2d().

Referenced by Slic3r::GUI::GLCanvas3D::get_size_proportional_to_max_bed_size(), and Slic3r::GUI::Bed3D::render_model().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ circle()

const Geometry::Circled & Slic3r::BuildVolume::circle ( ) const
inline
62{ return m_circle; }

References m_circle.

Referenced by Slic3r::GUI::BedShape::apply_optgroup_values(), Slic3r::GUI::BedShape::get_full_name_with_params(), and object_state().

+ Here is the caller graph for this function:

◆ convex_hull()

const Polygon & Slic3r::BuildVolume::convex_hull ( ) const
inline
60{ return m_convex_hull; }

References m_convex_hull.

◆ max_print_height()

double Slic3r::BuildVolume::max_print_height ( ) const
inline
41{ return m_max_print_height; }

References m_max_print_height.

Referenced by BuildVolume(), Slic3r::GUI::GLCanvas3D::scene_bounding_box(), and Slic3r::GUI::Bed3D::set_shape().

+ Here is the caller graph for this function:

◆ object_state()

BuildVolume::ObjectState Slic3r::BuildVolume::object_state ( const indexed_triangle_set its,
const Transform3f trafo,
bool  may_be_below_bed,
bool  ignore_bottom = true 
) const
273{
274 switch (m_type) {
275 case Type::Rectangle:
276 {
277 BoundingBox3Base<Vec3d> build_volume = this->bounding_volume().inflated(SceneEpsilon);
278 if (m_max_print_height == 0.0)
279 build_volume.max.z() = std::numeric_limits<double>::max();
280 if (ignore_bottom)
281 build_volume.min.z() = -std::numeric_limits<double>::max();
282 BoundingBox3Base<Vec3f> build_volumef(build_volume.min.cast<float>(), build_volume.max.cast<float>());
283 // The following test correctly interprets intersection of a non-convex object with a rectangular build volume.
284 //return rectangle_test(its, trafo, to_2d(build_volume.min), to_2d(build_volume.max), build_volume.max.z());
285 //FIXME This test does NOT correctly interprets intersection of a non-convex object with a rectangular build volume.
286 return object_state_templ(its, trafo, may_be_below_bed, [build_volumef](const Vec3f &pt) { return build_volumef.contains(pt); });
287 }
288 case Type::Circle:
289 {
290 Geometry::Circlef circle { unscaled<float>(m_circle.center), unscaled<float>(m_circle.radius + SceneEpsilon) };
291 return m_max_print_height == 0.0 ?
292 object_state_templ(its, trafo, may_be_below_bed, [circle](const Vec3f &pt) { return circle.contains(to_2d(pt)); }) :
293 object_state_templ(its, trafo, may_be_below_bed, [circle, z = m_max_print_height + SceneEpsilon](const Vec3f &pt) { return pt.z() < z && circle.contains(to_2d(pt)); });
294 }
295 case Type::Convex:
296 //FIXME doing test on convex hull until we learn to do test on non-convex polygons efficiently.
297 case Type::Custom:
298 return m_max_print_height == 0.0 ?
299 object_state_templ(its, trafo, may_be_below_bed, [this](const Vec3f &pt) { return Geometry::inside_convex_polygon(m_top_bottom_convex_hull_decomposition_scene, to_2d(pt).cast<double>()); }) :
300 object_state_templ(its, trafo, may_be_below_bed, [this, z = m_max_print_height + SceneEpsilon](const Vec3f &pt) { return pt.z() < z && Geometry::inside_convex_polygon(m_top_bottom_convex_hull_decomposition_scene, to_2d(pt).cast<double>()); });
301 case Type::Invalid:
302 default:
303 return ObjectState::Inside;
304 }
305}
const Geometry::Circled & circle() const
Definition BuildVolume.hpp:62
Circle< Vec2f > Circlef
Definition Circle.hpp:90
BuildVolume::ObjectState object_state_templ(const indexed_triangle_set &its, const Transform3f &trafo, bool may_be_below_bed, InsideFn is_inside)
Definition BuildVolume.cpp:190
bool contains(const Vector &p) const
Definition Circle.hpp:81

References bounding_volume(), Slic3r::Geometry::Circle< Vector >::center, Circle, circle(), Slic3r::BoundingBox3Base< PointType >::contains(), Slic3r::Geometry::Circle< Vector >::contains(), Convex, Custom, Slic3r::BoundingBox3Base< PointType >::inflated(), Inside, Slic3r::Geometry::inside_convex_polygon(), Invalid, m_circle, m_max_print_height, m_top_bottom_convex_hull_decomposition_scene, m_type, Slic3r::BoundingBoxBase< PointType, APointsType >::max, Slic3r::BoundingBoxBase< PointType, APointsType >::min, Slic3r::object_state_templ(), Slic3r::Geometry::Circle< Vector >::radius, Rectangle, SceneEpsilon, and Slic3r::to_2d().

Referenced by Slic3r::GUI::GLCanvas3D::check_volumes_outside_state(), and Slic3r::ModelObject::update_instances_print_volume_state().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ polygon()

const Polygon & Slic3r::BuildVolume::polygon ( ) const
inline
50{ return m_polygon; }

References m_polygon.

◆ top_bottom_convex_hull_decomposition_bed()

const std::pair< std::vector< Vec2d >, std::vector< Vec2d > > & Slic3r::BuildVolume::top_bottom_convex_hull_decomposition_bed ( ) const
inline

◆ top_bottom_convex_hull_decomposition_scene()

const std::pair< std::vector< Vec2d >, std::vector< Vec2d > > & Slic3r::BuildVolume::top_bottom_convex_hull_decomposition_scene ( ) const
inline

◆ type()

Type Slic3r::BuildVolume::type ( ) const
inline
44{ return m_type; }

References m_type.

Referenced by Slic3r::GUI::BedShape::apply_optgroup_values(), Slic3r::GUI::GLCanvas3D::check_volumes_outside_state(), Slic3r::GUI::BedShape::get_full_name_with_params(), Slic3r::GUI::BedShape::get_page_type(), Slic3r::GUI::BedShape::is_custom(), and type_name().

+ Here is the caller graph for this function:

◆ type_name() [1/2]

std::string_view Slic3r::BuildVolume::type_name ( ) const
inline
47{ return type_name(m_type); }

References m_type, and type_name().

Referenced by BuildVolume(), and type_name().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ type_name() [2/2]

std::string_view Slic3r::BuildVolume::type_name ( Type  type)
static
408{
409 using namespace std::literals;
410 switch (type) {
411 case Type::Invalid: return "Invalid"sv;
412 case Type::Rectangle: return "Rectangle"sv;
413 case Type::Circle: return "Circle"sv;
414 case Type::Convex: return "Convex"sv;
415 case Type::Custom: return "Custom"sv;
416 }
417 // make visual studio happy
418 assert(false);
419 return {};
420}
Type type() const
Definition BuildVolume.hpp:44

References Circle, Convex, Custom, Invalid, Rectangle, and type().

+ Here is the call graph for this function:

◆ valid()

bool Slic3r::BuildVolume::valid ( ) const
inline
48{ return m_type != Type::Invalid; }

References Invalid, and m_type.

Referenced by Slic3r::GUI::GLCanvas3D::_render_objects(), Slic3r::GUI::GLCanvas3D::render(), and Slic3r::GUI::Bed3D::render_axes().

+ Here is the caller graph for this function:

◆ volume_state_bbox()

BuildVolume::ObjectState Slic3r::BuildVolume::volume_state_bbox ( const BoundingBoxf3 volume_bbox,
bool  ignore_bottom = true 
) const
308{
309 assert(m_type == Type::Rectangle);
310 BoundingBox3Base<Vec3d> build_volume = this->bounding_volume().inflated(SceneEpsilon);
311 if (m_max_print_height == 0.0)
312 build_volume.max.z() = std::numeric_limits<double>::max();
313 if (ignore_bottom)
314 build_volume.min.z() = -std::numeric_limits<double>::max();
315 return build_volume.max.z() <= - SceneEpsilon ? ObjectState::Below :
316 build_volume.contains(volume_bbox) ? ObjectState::Inside :
317 build_volume.intersects(volume_bbox) ? ObjectState::Colliding : ObjectState::Outside;
318}

References Below, bounding_volume(), Colliding, Slic3r::BoundingBox3Base< PointType >::contains(), Slic3r::BoundingBox3Base< PointType >::inflated(), Inside, Slic3r::BoundingBox3Base< PointType >::intersects(), m_max_print_height, m_type, Slic3r::BoundingBoxBase< PointType, APointsType >::max, Slic3r::BoundingBoxBase< PointType, APointsType >::min, Outside, Rectangle, and SceneEpsilon.

Referenced by Slic3r::GUI::GLCanvas3D::check_volumes_outside_state().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ BedEpsilon

◆ m_area

double Slic3r::BuildVolume::m_area { 0. }
private

Referenced by BuildVolume().

◆ m_bbox

BoundingBox Slic3r::BuildVolume::m_bbox
private

Referenced by BuildVolume(), and bounding_box().

◆ m_bboxf

BoundingBoxf3 Slic3r::BuildVolume::m_bboxf
private

◆ m_bed_shape

std::vector<Vec2d> Slic3r::BuildVolume::m_bed_shape
private

Referenced by bed_shape().

◆ m_circle

Geometry::Circled Slic3r::BuildVolume::m_circle { Vec2d::Zero(), 0 }
private

◆ m_convex_hull

Polygon Slic3r::BuildVolume::m_convex_hull
private

Referenced by BuildVolume(), and convex_hull().

◆ m_max_print_height

double Slic3r::BuildVolume::m_max_print_height
private

◆ m_polygon

Polygon Slic3r::BuildVolume::m_polygon
private

Referenced by BuildVolume(), and polygon().

◆ m_top_bottom_convex_hull_decomposition_bed

std::pair<std::vector<Vec2d>, std::vector<Vec2d> > Slic3r::BuildVolume::m_top_bottom_convex_hull_decomposition_bed
private

◆ m_top_bottom_convex_hull_decomposition_scene

std::pair<std::vector<Vec2d>, std::vector<Vec2d> > Slic3r::BuildVolume::m_top_bottom_convex_hull_decomposition_scene
private

◆ m_type

◆ SceneEpsilon

constexpr const double Slic3r::BuildVolume::SceneEpsilon = EPSILON
staticconstexpr

The documentation for this class was generated from the following files: