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

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

Inheritance diagram for Slic3r::BoundingBox3:
Collaboration diagram for Slic3r::BoundingBox3:

Public Types

using PointsType

Public Member Functions

 BoundingBox3 ()
 BoundingBox3 (const Vec3crd &pmin, const Vec3crd &pmax)
 BoundingBox3 (const Points3 &points)
 BoundingBox3 (const std::vector< Vec3crd > &points)
Polygon polygon (bool is_scaled=false) const
void merge (const Vec3crd &point)
Vec3crd size () const
double radius () const
void translate (coordf_t x, coordf_t y, coordf_t z)
void translate (coordf_t x, coordf_t y)
void offset (coordf_t delta)
BoundingBox3Base< Vec3crd > inflated (coordf_t delta) const throw ()
Vec3crd center () const
coordf_t max_size () const
bool contains (const Vec3crd &point) const
bool intersects (const BoundingBox3Base< Vec3crd > &other) const
void reset ()
void scale (double factor)
double area () const
bool overlap (const BoundingBoxBase< Vec3crd, PointsType > &other) const
Vec3crd operator[] (size_t idx) const
bool operator== (const BoundingBoxBase< Vec3crd, PointsType > &rhs)
bool operator!= (const BoundingBoxBase< Vec3crd, PointsType > &rhs)

Public Attributes

Vec3crd min
Vec3crd max
bool defined

Static Private Member Functions

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

Detailed Description

Member Typedef Documentation

◆ PointsType

using Slic3r::BoundingBox3Base< Vec3crd >::PointsType
inherited

Constructor & Destructor Documentation

◆ BoundingBox3() [1/4]

Slic3r::BoundingBox3::BoundingBox3 ( )
inline
BoundingBox3Base()
Definition BoundingBox.hpp:121

References Slic3r::BoundingBox3Base< Vec3crd >::BoundingBox3Base().

Here is the call graph for this function:

◆ BoundingBox3() [2/4]

Slic3r::BoundingBox3::BoundingBox3 ( const Vec3crd & pmin,
const Vec3crd & pmax )
inline
241: BoundingBox3Base<Vec3crd>(pmin, pmax) {}

References Slic3r::BoundingBox3Base< Vec3crd >::BoundingBox3Base().

Here is the call graph for this function:

◆ BoundingBox3() [3/4]

Slic3r::BoundingBox3::BoundingBox3 ( const Points3 & points)
inline
243 if (!points.empty()) {
244 this->min = points.front();
245 this->max = points.front();
246 for (const auto &p : points) {
247 this->min = this->min.cwiseMin(static_cast<const Vec3crd&>(p));
248 this->max = this->max.cwiseMax(static_cast<const Vec3crd&>(p));
249 }
250 this->defined = true;
251 }
252 }
Eigen::Matrix< coord_t, 3, 1, Eigen::DontAlign > Vec3crd
Definition Point.hpp:53

References Slic3r::BoundingBox3Base< Vec3crd >::BoundingBox3Base().

Here is the call graph for this function:

◆ BoundingBox3() [4/4]

Slic3r::BoundingBox3::BoundingBox3 ( const std::vector< Vec3crd > & points)
inline
253: BoundingBox3Base<Vec3crd>(points) {}

References Slic3r::BoundingBox3Base< Vec3crd >::BoundingBox3Base().

Here is the call graph for this function:

Member Function Documentation

◆ area()

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

◆ center()

template Vec3d Slic3r::BoundingBox3Base< Vec3crd >::center ( ) const
inherited
238{
239 return (this->min + this->max) / 2;
240}
Definition BoundingBox.hpp:117

◆ construct()

template void Slic3r::BoundingBoxBase< Vec3crd, std::vector< Vec3crd > >::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

◆ contains()

bool Slic3r::BoundingBox3Base< Vec3crd >::contains ( const Vec3crd & point) const
inlineinherited
161 {
162 return BoundingBoxBase<PointType>::contains(point) && point.z() >= this->min.z() && point.z() <= this->max.z();
163 }
bool contains(const PointType &point) const
Definition BoundingBox.hpp:51

◆ inflated()

BoundingBox3Base< Vec3crd > Slic3r::BoundingBox3Base< Vec3crd >::inflated ( coordf_t delta) const
throw ( )
inlineinherited
void offset(coordf_t delta)
Definition BoundingBox.cpp:219

◆ intersects()

bool Slic3r::BoundingBox3Base< Vec3crd >::intersects ( const BoundingBox3Base< Vec3crd > & other) const
inlineinherited
170 {
171 return this->min.x() < other.max.x() && this->max.x() > other.min.x() && this->min.y() < other.max.y() && this->max.y() > other.min.y() &&
172 this->min.z() < other.max.z() && this->max.z() > other.min.z();
173 }

◆ max_size()

template coordf_t Slic3r::BoundingBox3Base< Vec3crd >::max_size ( ) const
inherited
246{
247 PointType s = size();
248 return std::max(s.x(), std::max(s.y(), s.z()));
249}
Vec3crd size() const
Definition BoundingBox.cpp:187

◆ merge()

void Slic3r::BoundingBox3Base< Vec3crd >::merge ( const Vec3crd & point)
inherited
140{
141 if (this->defined) {
142 this->min = this->min.cwiseMin(point);
143 this->max = this->max.cwiseMax(point);
144 } else {
145 this->min = point;
146 this->max = point;
147 this->defined = true;
148 }
149}

Referenced by offset().

Here is the caller graph for this function:

◆ offset()

template void Slic3r::BoundingBox3Base< Vec3crd >::offset ( coordf_t delta)
inherited
220{
222 this->min -= v;
223 this->max += v;
224}

References BoundingBox3Base(), and merge().

Here is the call graph for this function:

◆ operator!=()

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

◆ operator==()

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

◆ operator[]()

Vec3crd Slic3r::BoundingBoxBase< Vec3crd, std::vector< Vec3crd > >::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< Vec3crd, std::vector< Vec3crd > >::overlap ( const BoundingBoxBase< Vec3crd, 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()

template Polygon Slic3r::BoundingBox3Base< Vec3crd >::polygon ( bool is_scaled = false) const
inherited
120{
122 polygon.points.clear();
123 polygon.points.resize(4);
124 double scale_factor = 1 / (is_scaled ? SCALING_FACTOR : 1);
125 polygon.points[0](0) = this->min(0) * scale_factor;
126 polygon.points[0](1) = this->min(1) * scale_factor;
127 polygon.points[1](0) = this->max(0) * scale_factor;
128 polygon.points[1](1) = this->min(1) * scale_factor;
129 polygon.points[2](0) = this->max(0) * scale_factor;
130 polygon.points[2](1) = this->max(1) * scale_factor;
131 polygon.points[3](0) = this->min(0) * scale_factor;
132 polygon.points[3](1) = this->max(1) * scale_factor;
133 return polygon;
134}

◆ radius()

template double Slic3r::BoundingBox3Base< Vec3crd >::radius ( ) const
inherited
203{
204 return 0.5 * (this->max - this->min).template cast<double>().norm();
205}

◆ reset()

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

◆ scale()

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

◆ size()

template Vec3d Slic3r::BoundingBox3Base< Vec3crd >::size ( ) const
inherited
188{
189 return this->max - this->min;
190}

◆ translate() [1/2]

void Slic3r::BoundingBox3Base< Vec3crd >::translate ( coordf_t x,
coordf_t y,
coordf_t z )
inlineinherited
154{ assert(this->defined); PointType v(x, y, z); this->min += v; this->max += v; }

◆ translate() [2/2]

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

Member Data Documentation

◆ defined

bool Slic3r::BoundingBoxBase< Vec3crd, std::vector< Vec3crd > >::defined
inherited

◆ max

Vec3crd Slic3r::BoundingBoxBase< Vec3crd, std::vector< Vec3crd > >::max
inherited

◆ min

Vec3crd Slic3r::BoundingBoxBase< Vec3crd, std::vector< Vec3crd > >::min
inherited

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