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

#include <src/libslic3r/BoundingBox.hpp>

+ Inheritance diagram for Slic3r::BoundingBoxf:
+ Collaboration diagram for Slic3r::BoundingBoxf:

Public Types

using PointsType = std::vector< Vec2d >
 

Public Member Functions

 BoundingBoxf ()
 
 BoundingBoxf (const Vec2d &pmin, const Vec2d &pmax)
 
 BoundingBoxf (const std::vector< Vec2d > &points)
 
void reset ()
 
void merge (const Vec2d &point)
 
void merge (const PointsType &points)
 
void merge (const BoundingBoxBase< Vec2d, PointsType > &bb)
 
void scale (double factor)
 
Vec2d size () const
 
double radius () const
 
void translate (coordf_t x, coordf_t y)
 
void translate (const Vec2d &v)
 
void offset (coordf_t delta)
 
BoundingBoxBase< Vec2d, PointsTypeinflated (coordf_t delta) const throw ()
 
Vec2d center () const
 
bool contains (const Vec2d &point) const
 
bool contains (const BoundingBoxBase< Vec2d, PointsType > &other) const
 
bool overlap (const BoundingBoxBase< Vec2d, PointsType > &other) const
 
bool operator== (const BoundingBoxBase< Vec2d, PointsType > &rhs)
 
bool operator!= (const BoundingBoxBase< Vec2d, PointsType > &rhs)
 

Public Attributes

Vec2d min
 
Vec2d max
 
bool defined
 

Static Private Member Functions

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

Detailed Description

Member Typedef Documentation

◆ PointsType

using Slic3r::BoundingBoxBase< Vec2d , std::vector<Vec2d > >::PointsType = std::vector<Vec2d >
inherited

Constructor & Destructor Documentation

◆ BoundingBoxf() [1/3]

Slic3r::BoundingBoxf::BoundingBoxf ( )
inline
215: BoundingBoxBase<Vec2d>() {}

◆ BoundingBoxf() [2/3]

Slic3r::BoundingBoxf::BoundingBoxf ( const Vec2d pmin,
const Vec2d pmax 
)
inline
216: BoundingBoxBase<Vec2d>(pmin, pmax) {}

◆ BoundingBoxf() [3/3]

Slic3r::BoundingBoxf::BoundingBoxf ( const std::vector< Vec2d > &  points)
inline
217: BoundingBoxBase<Vec2d>(points) {}

Member Function Documentation

◆ center()

template Vec2d Slic3r::BoundingBoxBase< Vec2d , std::vector<Vec2d > >::center
inherited
195{
196 return (this->min + this->max) / 2;
197}

◆ construct()

static void Slic3r::BoundingBoxBase< Vec2d , std::vector<Vec2d > >::construct ( BoundingBoxType &  out,
It  from,
It  to 
)
inlinestaticprivateinherited
70 {
71 if (from != to) {
72 auto it = from;
73 out.min = it->template cast<typename PointType::Scalar>();
74 out.max = out.min;
75 for (++ it; it != to; ++ it) {
76 auto vec = it->template cast<typename PointType::Scalar>();
77 out.min = out.min.cwiseMin(vec);
78 out.max = out.max.cwiseMax(vec);
79 }
80 out.defined = IncludeBoundary || (out.min.x() < out.max.x() && out.min.y() < out.max.y());
81 }
82 }

◆ contains() [1/2]

bool Slic3r::BoundingBoxBase< Vec2d , std::vector<Vec2d > >::contains ( const BoundingBoxBase< Vec2d , PointsType > &  other) const
inlineinherited
50 {
51 return contains(other.min) && contains(other.max);
52 }
static int contains(const char c, const char *matrix, size_t len)
Definition semver.c:65

◆ contains() [2/2]

bool Slic3r::BoundingBoxBase< Vec2d , std::vector<Vec2d > >::contains ( const Vec2d point) const
inlineinherited
46 {
47 return point.x() >= this->min.x() && point.x() <= this->max.x()
48 && point.y() >= this->min.y() && point.y() <= this->max.y();
49 }
Vec2d max
Definition BoundingBox.hpp:17
Vec2d min
Definition BoundingBox.hpp:16

◆ inflated()

BoundingBoxBase< Vec2d , PointsType > Slic3r::BoundingBoxBase< Vec2d , std::vector<Vec2d > >::inflated ( coordf_t  delta) const
throw (
)
inlineinherited
44{ BoundingBoxBase<PointType, PointsType> out(*this); out.offset(delta); return out; }

◆ merge() [1/3]

void Slic3r::BoundingBoxBase< Vec2d , std::vector<Vec2d > >::merge ( const BoundingBoxBase< Vec2d , PointsType > &  bb)
inherited
87{
88 assert(bb.defined || bb.min.x() >= bb.max.x() || bb.min.y() >= bb.max.y());
89 if (bb.defined) {
90 if (this->defined) {
91 this->min = this->min.cwiseMin(bb.min);
92 this->max = this->max.cwiseMax(bb.max);
93 } else {
94 this->min = bb.min;
95 this->max = bb.max;
96 this->defined = true;
97 }
98 }
99}
bool defined
Definition BoundingBox.hpp:18

◆ merge() [2/3]

void Slic3r::BoundingBoxBase< Vec2d , std::vector<Vec2d > >::merge ( const PointsType points)
inherited
79{
80 this->merge(BoundingBoxBase(points));
81}
void merge(const Vec2d &point)
Definition BoundingBox.cpp:62
BoundingBoxBase()
Definition BoundingBox.hpp:20

◆ merge() [3/3]

void Slic3r::BoundingBoxBase< Vec2d , std::vector<Vec2d > >::merge ( const Vec2d point)
inherited
63{
64 if (this->defined) {
65 this->min = this->min.cwiseMin(point);
66 this->max = this->max.cwiseMax(point);
67 } else {
68 this->min = point;
69 this->max = point;
70 this->defined = true;
71 }
72}

◆ offset()

template void Slic3r::BoundingBoxBase< Vec2d , std::vector<Vec2d > >::offset ( coordf_t  delta)
inherited
176{
177 PointType v(delta, delta);
178 this->min -= v;
179 this->max += v;
180}
PointType
Definition exact_geodesic.cpp:327

◆ operator!=()

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

◆ operator==()

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

◆ overlap()

bool Slic3r::BoundingBoxBase< Vec2d , std::vector<Vec2d > >::overlap ( const BoundingBoxBase< Vec2d , PointsType > &  other) const
inlineinherited
53 {
54 return ! (this->max.x() < other.min.x() || this->min.x() > other.max.x() ||
55 this->max.y() < other.min.y() || this->min.y() > other.max.y());
56 }

◆ radius()

template double Slic3r::BoundingBoxBase< Vec2d , std::vector<Vec2d > >::radius
inherited
161{
162 assert(this->defined);
163 return 0.5 * (this->max - this->min).template cast<double>().norm();
164}

◆ reset()

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

◆ scale()

template void Slic3r::BoundingBoxBase< Vec2d , std::vector<Vec2d > >::scale ( double  factor)
inherited
53{
54 this->min *= factor;
55 this->max *= factor;
56}

◆ size()

template Vec2d Slic3r::BoundingBoxBase< Vec2d , std::vector<Vec2d > >::size
inherited
145{
146 return this->max - this->min;
147}

◆ translate() [1/2]

void Slic3r::BoundingBoxBase< Vec2d , std::vector<Vec2d > >::translate ( const Vec2d v)
inlineinherited
42{ this->min += v; this->max += v; }

◆ translate() [2/2]

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

Member Data Documentation

◆ defined

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

◆ max

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

◆ min

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

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