OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::BoundingBox Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/BoundingBox.hpp>

Inheritance diagram for Slic3r::BoundingBox:
Collaboration diagram for Slic3r::BoundingBox:

Public Types

using PointsType

Public Member Functions

void polygon (Polygon *polygon) const
Polygon polygon () const
BoundingBox rotated (double angle) const
BoundingBox rotated (double angle, const Point &center) const
void rotate (double angle)
void rotate (double angle, const Point &center)
void align_to_grid (const coord_t cell_size)
 BoundingBox ()
 BoundingBox (const Point &pmin, const Point &pmax)
 BoundingBox (const Points &points)
BoundingBox inflated (coordf_t delta) const noexcept
BoundingBox scaled (double factor) const
void reset ()
void merge (const Point &point)
void scale (double factor)
Point size () const
double radius () const
double area () const
void translate (coordf_t x, coordf_t y)
void offset (coordf_t delta)
Point center () const
bool contains (const Point &point) const
bool overlap (const BoundingBoxBase< Point, PointsType > &other) const
Point operator[] (size_t idx) const
bool operator== (const BoundingBoxBase< Point, PointsType > &rhs)
bool operator!= (const BoundingBoxBase< Point, PointsType > &rhs)

Public Attributes

Point min
Point max
bool defined

Static Private Member Functions

static void construct (BoundingBoxType &out, It from, It to)

Friends

BoundingBox get_extents_rotated (const Points &points, double angle)

Detailed Description

Member Typedef Documentation

◆ PointsType

using Slic3r::BoundingBoxBase< Point, Points >::PointsType
inherited

Constructor & Destructor Documentation

◆ BoundingBox() [1/3]

Slic3r::BoundingBox::BoundingBox ( )
inline
BoundingBoxBase()
Definition BoundingBox.hpp:24

References Slic3r::BoundingBoxBase< Point, Points >::BoundingBoxBase().

Referenced by get_extents_rotated, inflated(), rotated(), rotated(), and scaled().

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

◆ BoundingBox() [2/3]

Slic3r::BoundingBox::BoundingBox ( const Point & pmin,
const Point & pmax )
inline
225: BoundingBoxBase<Point, Points>(pmin, pmax) {}

References Slic3r::BoundingBoxBase< Point, Points >::BoundingBoxBase().

Here is the call graph for this function:

◆ BoundingBox() [3/3]

Slic3r::BoundingBox::BoundingBox ( const Points & points)
inline

References Slic3r::BoundingBoxBase< Point, Points >::BoundingBoxBase().

Here is the call graph for this function:

Member Function Documentation

◆ align_to_grid()

void Slic3r::BoundingBox::align_to_grid ( const coord_t cell_size)
254{
255 if (this->defined) {
256 min.x() = Slic3r::align_to_grid(min.x(), cell_size);
257 min.y() = Slic3r::align_to_grid(min.y(), cell_size);
258 }
259}
bool defined
Definition BoundingBox.hpp:22
Point min
Definition BoundingBox.hpp:20
coord_t align_to_grid(const coord_t coord, const coord_t spacing)
Definition Point.hpp:718

References Slic3r::align_to_grid(), Slic3r::BoundingBoxBase< Point, Points >::defined, and Slic3r::BoundingBoxBase< Point, Points >::min.

Referenced by Slic3r::SupportGridPattern::SupportGridPattern().

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

◆ area()

double Slic3r::BoundingBoxBase< Point, Points >::area ( ) const
inlineinherited
45{ return double(this->max(0) - this->min(0)) * (this->max(1) - this->min(1)); } // BBS
Definition BoundingBox.hpp:17
Point max
Definition BoundingBox.hpp:21

◆ center()

template Vec2d Slic3r::BoundingBoxBase< Point, Points >::center ( ) const
inherited
229{
230 return (this->min + this->max) / 2;
231}

References Slic3r::angle(), center(), max, and min.

Referenced by center(), Slic3r::BoundingBox::rotate(), and Slic3r::BoundingBox::rotated().

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

◆ construct()

template void Slic3r::BoundingBoxBase< Point, Points >::construct< 1, BoundingBox, Points::const_iterator > ( BoundingBoxType & out,
It from,
It to )
inlinestaticprivateinherited
100 {
101 if (from != to) {
102 auto it = from;
104 out.max = out.min;
105 for (++ it; it != to; ++ it) {
106 auto vec = it->template cast<typename PointType::Scalar>();
107 out.min = out.min.cwiseMin(vec);
108 out.max = out.max.cwiseMax(vec);
109 }
110 out.defined = IncludeBoundary || (out.min.x() < out.max.x() && out.min.y() < out.max.y());
111 }
112 }
auto cast(const BoundingBoxBase< Tin > &b)
Definition BoundingBox.hpp:299

Referenced by Slic3r::BoundingBoxBase< PointType, APointsType >::get_extents.

Here is the caller graph for this function:

◆ contains()

bool Slic3r::BoundingBoxBase< Point, Points >::contains ( const Point & point) const
inlineinherited
51 {
52 return point.x() >= this->min.x() && point.x() <= this->max.x()
53 && point.y() >= this->min.y() && point.y() <= this->max.y();
54 }

◆ inflated()

BoundingBox Slic3r::BoundingBox::inflated ( coordf_t delta) const
inlinenoexcept
228{ BoundingBox out(*this); out.offset(delta); return out; }
BoundingBox()
Definition BoundingBox.hpp:224

References BoundingBox(), and Slic3r::BoundingBoxBase< PointType, APointsType >::offset().

Referenced by Slic3r::FillPlanePath::_fill_surface_single(), Slic3r::clip_inner_walls_over_top(), Slic3r::connect_brim_lines(), Slic3r::ExPolygon::contains(), Slic3r::create_boundary_infill_graph(), Slic3r::generate_extra_perimeters_over_overhangs(), Slic3r::FillLightning::Generator::generateTrees(), Slic3r::FillLightning::Generator::generateTreesforSupport(), Slic3r::mark_boundary_segments_touching_infill(), Slic3r::WipeTower::move_box_inside_polygon(), Slic3r::GCode::needs_retraction(), and Slic3r::PerimeterGenerator::process_classic().

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

◆ merge()

void Slic3r::BoundingBoxBase< Point, Points >::merge ( const Point & point)
inherited
76{
77 if (this->defined) {
78 this->min = this->min.cwiseMin(point);
79 this->max = this->max.cwiseMax(point);
80 } else {
81 this->min = point;
82 this->max = point;
83 this->defined = true;
84 }
85}

References Slic3r::angle(), max, and min.

Here is the call graph for this function:

◆ offset()

template void Slic3r::BoundingBoxBase< Point, Points >::offset ( coordf_t delta)
inherited
210{
212 this->min -= v;
213 this->max += v;
214}

◆ operator!=()

bool Slic3r::BoundingBoxBase< Point, Points >::operator!= ( const BoundingBoxBase< Point, PointsType > & rhs)
inlineinherited
83{ return ! (*this == rhs); }

◆ operator==()

bool Slic3r::BoundingBoxBase< Point, Points >::operator== ( const BoundingBoxBase< Point, PointsType > & rhs)
inlineinherited
82{ return this->min == rhs.min && this->max == rhs.max; }

◆ operator[]()

Point Slic3r::BoundingBoxBase< Point, Points >::operator[] ( size_t idx) const
inlineinherited
62 {
63 switch (idx) {
64 case 0:
65 return min;
66 break;
67 case 1:
68 return PointType(max(0), min(1));
69 break;
70 case 2:
71 return max;
72 break;
73 case 3:
74 return PointType(min(0), max(1));
75 break;
76 default:
77 return PointType();
78 break;
79 }
80 return PointType();
81 }

◆ overlap()

bool Slic3r::BoundingBoxBase< Point, Points >::overlap ( const BoundingBoxBase< Point, PointsType > & other) const
inlineinherited
58 {
59 return ! (this->max.x() < other.min.x() || this->min.x() > other.max.x() ||
60 this->max.y() < other.min.y() || this->min.y() > other.max.y());
61 }

◆ polygon() [1/2]

Polygon Slic3r::BoundingBox::polygon ( ) const
31{
32 Polygon p;
33 this->polygon(&p);
34 return p;
35}
Polygon polygon() const
Definition BoundingBox.cpp:30
Slic3r::Polygon Polygon
Definition Emboss.cpp:101

References polygon().

Referenced by polygon().

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

◆ polygon() [2/2]

void Slic3r::BoundingBox::polygon ( Polygon * polygon) const
21{
22 polygon->points = {
23 this->min,
24 { this->max.x(), this->min.y() },
25 this->max,
26 { this->min.x(), this->max.y() }
27 };
28}
void polygon(Polygon *polygon) const
Definition BoundingBox.cpp:20

References Slic3r::BoundingBoxBase< Point, Points >::max, Slic3r::BoundingBoxBase< Point, Points >::min, and polygon().

Referenced by Slic3r::WipeTowerIntegration::append_tcr(), Slic3r::bed_exclusion_arrange_polygon(), Slic3r::WipeTowerIntegration::generate_path_to_wipe_tower(), Slic3r::WipeTower::move_box_inside_polygon(), Slic3r::GCode::needs_retraction(), polygon(), Slic3r::GUI::ArrangeJob::prepare_belt_regions(), Slic3r::GUI::PartPlateList::preprocess_nonprefered_areas(), and Slic3r::WipeTowerIntegration::travel_to_tower_gap().

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

◆ radius()

template double Slic3r::BoundingBoxBase< Point, Points >::radius ( ) const
inherited
195{
196 assert(this->defined);
197 return 0.5 * (this->max - this->min).template cast<double>().norm();
198}

◆ reset()

void Slic3r::BoundingBoxBase< Point, Points >::reset ( )
inlineinherited
38{ this->defined = false; this->min = PointType::Zero(); this->max = PointType::Zero(); }

◆ rotate() [1/2]

void Slic3r::BoundingBox::rotate ( double angle)
inline
218{ (*this) = this->rotated(angle); }
BoundingBox rotated(double angle) const
Definition BoundingBox.cpp:37
double angle(const Eigen::MatrixBase< Derived > &v1, const Eigen::MatrixBase< Derived2 > &v2)
Definition Point.hpp:138

References Slic3r::angle().

Here is the call graph for this function:

◆ rotate() [2/2]

void Slic3r::BoundingBox::rotate ( double angle,
const Point & center )
inline
219{ (*this) = this->rotated(angle, center); }
Point center() const
Definition BoundingBox.cpp:228

References Slic3r::angle(), and Slic3r::BoundingBoxBase< Point, Points >::center().

Here is the call graph for this function:

◆ rotated() [1/2]

BoundingBox Slic3r::BoundingBox::rotated ( double angle) const
38{
39 BoundingBox out;
40 out.merge(this->min.rotated(angle));
41 out.merge(this->max.rotated(angle));
42 out.merge(Point(this->min.x(), this->max.y()).rotated(angle));
43 out.merge(Point(this->max.x(), this->min.y()).rotated(angle));
44 return out;
45}
Kernel::Point_3 Point
Definition MeshRepair.cpp:81

References BoundingBox(), and Slic3r::angle().

Referenced by Slic3r::FillPlanePath::_fill_surface_single().

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

◆ rotated() [2/2]

BoundingBox Slic3r::BoundingBox::rotated ( double angle,
const Point & center ) const
48{
49 BoundingBox out;
50 out.merge(this->min.rotated(angle, center));
51 out.merge(this->max.rotated(angle, center));
52 out.merge(Point(this->min.x(), this->max.y()).rotated(angle, center));
53 out.merge(Point(this->max.x(), this->min.y()).rotated(angle, center));
54 return out;
55}

References BoundingBox(), Slic3r::angle(), and Slic3r::BoundingBoxBase< Point, Points >::center().

Here is the call graph for this function:

◆ scale()

template void Slic3r::BoundingBoxBase< Point, Points >::scale ( double factor)
inherited
66{
67 this->min *= factor;
68 this->max *= factor;
69}

References Slic3r::angle(), and min.

Here is the call graph for this function:

◆ scaled()

BoundingBox Slic3r::BoundingBox::scaled ( double factor) const
58{
59 BoundingBox out(*this);
60 out.scale(factor);
61 return out;
62}

References BoundingBox(), and Slic3r::BoundingBoxBase< PointType, APointsType >::scale().

Referenced by Slic3r::Fill::extended_object_bounding_box().

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

◆ size()

template Vec2d Slic3r::BoundingBoxBase< Point, Points >::size ( ) const
inherited
179{
180 return this->max - this->min;
181}

References Slic3r::angle(), and max.

Here is the call graph for this function:

◆ translate()

void Slic3r::BoundingBoxBase< Point, Points >::translate ( coordf_t x,
coordf_t y )
inlineinherited
46{ assert(this->defined); PointType v(x, y); this->min += v; this->max += v; }

◆ get_extents_rotated

BoundingBox get_extents_rotated ( const Points & points,
double angle )
friend
551{
552 BoundingBox bbox;
553 if (! points.empty()) {
554 double s = sin(angle);
555 double c = cos(angle);
556 Points::const_iterator it = points.begin();
557 double cur_x = (double)(*it)(0);
558 double cur_y = (double)(*it)(1);
559 bbox.min(0) = bbox.max(0) = (coord_t)round(c * cur_x - s * cur_y);
560 bbox.min(1) = bbox.max(1) = (coord_t)round(c * cur_y + s * cur_x);
561 for (++it; it != points.end(); ++it) {
562 double cur_x = (double)(*it)(0);
563 double cur_y = (double)(*it)(1);
564 coord_t x = (coord_t)round(c * cur_x - s * cur_y);
565 coord_t y = (coord_t)round(c * cur_y + s * cur_x);
566 bbox.min(0) = std::min(x, bbox.min(0));
567 bbox.min(1) = std::min(y, bbox.min(1));
568 bbox.max(0) = std::max(x, bbox.max(0));
569 bbox.max(1) = std::max(y, bbox.max(1));
570 }
571 bbox.defined = true;
572 }
573 return bbox;
574}
int64_t coord_t
Definition libslic3r.h:48

References BoundingBox(), Slic3r::angle(), Slic3r::BoundingBoxBase< PointType, APointsType >::defined, Slic3r::BoundingBoxBase< PointType, APointsType >::max, and Slic3r::BoundingBoxBase< PointType, APointsType >::min.

Member Data Documentation

◆ defined

bool Slic3r::BoundingBoxBase< Point, Points >::defined
inherited

◆ max

◆ min


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