Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::BoundingBox3Base< PointType > Class Template Reference

#include <src/libslic3r/BoundingBox.hpp>

+ Inheritance diagram for Slic3r::BoundingBox3Base< PointType >:
+ Collaboration diagram for Slic3r::BoundingBox3Base< PointType >:

Public Types

using PointsType = std::vector< PointType >
 

Public Member Functions

 BoundingBox3Base ()
 
 BoundingBox3Base (const PointType &pmin, const PointType &pmax)
 
 BoundingBox3Base (const PointType &p1, const PointType &p2, const PointType &p3)
 
template<class It , class = IteratorOnly<It>>
 BoundingBox3Base (It from, It to)
 
 BoundingBox3Base (const PointsType &points)
 
void merge (const PointType &point)
 
void merge (const PointsType &points)
 
void merge (const BoundingBox3Base< PointType > &bb)
 
PointType size () const
 
double radius () const
 
void translate (coordf_t x, coordf_t y, coordf_t z)
 
void translate (const Vec3d &v)
 
void offset (coordf_t delta)
 
BoundingBox3Base< PointType > inflated (coordf_t delta) const throw ()
 
PointType center () const
 
coordf_t max_size () const
 
bool contains (const PointType &point) const
 
bool contains (const BoundingBox3Base< PointType > &other) const
 
bool intersects (const BoundingBox3Base< PointType > &other) const
 
void reset ()
 
void merge (const PointsType &points)
 
void merge (const BoundingBoxBase< PointType, PointsType > &bb)
 
void scale (double factor)
 
void translate (coordf_t x, coordf_t y)
 
void translate (const PointType &v)
 
bool contains (const BoundingBoxBase< PointType, PointsType > &other) const
 
bool overlap (const BoundingBoxBase< PointType, PointsType > &other) const
 
bool operator== (const BoundingBoxBase< PointType, PointsType > &rhs)
 
bool operator!= (const BoundingBoxBase< PointType, PointsType > &rhs)
 

Public Attributes

PointType min
 
PointType max
 
bool defined
 

Static Private Member Functions

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

Detailed Description

template<class PointType>
class Slic3r::BoundingBox3Base< PointType >

Member Typedef Documentation

◆ PointsType

template<class PointType >
using Slic3r::BoundingBox3Base< PointType >::PointsType = std::vector<PointType>

Constructor & Destructor Documentation

◆ BoundingBox3Base() [1/5]

template<class PointType >
Slic3r::BoundingBox3Base< PointType >::BoundingBox3Base ( )
inline
91: BoundingBoxBase<PointType>() {}

◆ BoundingBox3Base() [2/5]

template<class PointType >
Slic3r::BoundingBox3Base< PointType >::BoundingBox3Base ( const PointType &  pmin,
const PointType &  pmax 
)
inline
92 :
93 BoundingBoxBase<PointType>(pmin, pmax)
94 { if (pmin.z() >= pmax.z()) BoundingBoxBase<PointType>::defined = false; }
bool defined
Definition BoundingBox.hpp:18
EIGEN_DEVICE_FUNC Packet pmax(const Packet &a, const Packet &b)
Definition GenericPacketMath.h:185
EIGEN_DEVICE_FUNC Packet pmin(const Packet &a, const Packet &b)
Definition GenericPacketMath.h:180

◆ BoundingBox3Base() [3/5]

template<class PointType >
Slic3r::BoundingBox3Base< PointType >::BoundingBox3Base ( const PointType &  p1,
const PointType &  p2,
const PointType &  p3 
)
inline
95 :
96 BoundingBoxBase<PointType>(p1, p1) { merge(p2); merge(p3); }
void merge(const PointType &point)
Definition BoundingBox.cpp:105

References Slic3r::BoundingBox3Base< PointType >::merge().

+ Here is the call graph for this function:

◆ BoundingBox3Base() [4/5]

template<class PointType >
template<class It , class = IteratorOnly<It>>
Slic3r::BoundingBox3Base< PointType >::BoundingBox3Base ( It  from,
It  to 
)
inline
99 {
100 if (from == to)
101 throw Slic3r::InvalidArgument("Empty point set supplied to BoundingBox3Base constructor");
102
103 auto it = from;
104 this->min = it->template cast<typename PointType::Scalar>();
105 this->max = this->min;
106 for (++ it; it != to; ++ it) {
107 auto vec = it->template cast<typename PointType::Scalar>();
108 this->min = this->min.cwiseMin(vec);
109 this->max = this->max.cwiseMax(vec);
110 }
111 this->defined = (this->min.x() < this->max.x()) && (this->min.y() < this->max.y()) && (this->min.z() < this->max.z());
112 }

References Slic3r::BoundingBoxBase< PointType, std::vector< PointType > >::min.

◆ BoundingBox3Base() [5/5]

template<class PointType >
Slic3r::BoundingBox3Base< PointType >::BoundingBox3Base ( const PointsType points)
inline
115 : BoundingBox3Base(points.begin(), points.end())
116 {}
BoundingBox3Base()
Definition BoundingBox.hpp:91

Member Function Documentation

◆ center()

◆ construct()

static void Slic3r::BoundingBoxBase< PointType, std::vector< PointType > >::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/3]

template<class PointType >
bool Slic3r::BoundingBox3Base< PointType >::contains ( const BoundingBox3Base< PointType > &  other) const
inline
134 {
135 return contains(other.min) && contains(other.max);
136 }
bool contains(const PointType &point) const
Definition BoundingBox.hpp:130

References Slic3r::BoundingBox3Base< PointType >::contains(), Slic3r::BoundingBoxBase< PointType, APointsType >::max, and Slic3r::BoundingBoxBase< PointType, APointsType >::min.

+ Here is the call graph for this function:

◆ contains() [2/3]

bool Slic3r::BoundingBoxBase< PointType, std::vector< PointType > >::contains ( const BoundingBoxBase< PointType, 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() [3/3]

template<class PointType >
bool Slic3r::BoundingBox3Base< PointType >::contains ( const PointType &  point) const
inline
130 {
131 return BoundingBoxBase<PointType>::contains(point) && point.z() >= this->min.z() && point.z() <= this->max.z();
132 }
bool contains(const PointType &point) const
Definition BoundingBox.hpp:46

References Slic3r::BoundingBoxBase< PointType, APointsType >::contains().

Referenced by Slic3r::BuildVolume::all_paths_inside(), Slic3r::BuildVolume::all_paths_inside_vertices_and_normals_interleaved(), Slic3r::BoundingBox3Base< PointType >::contains(), Slic3r::GUI::contains(), Slic3r::GUI::GLGizmoCut3D::is_conflict_for_connector(), Slic3r::BuildVolume::object_state(), Slic3r::GUI::GLCanvas3D::on_mouse(), Slic3r::GUI::GLGizmoCut3D::update_bb(), and Slic3r::BuildVolume::volume_state_bbox().

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

◆ inflated()

template<class PointType >
BoundingBox3Base< PointType > Slic3r::BoundingBox3Base< PointType >::inflated ( coordf_t  delta) const
throw (
)
inline
126{ BoundingBox3Base<PointType> out(*this); out.offset(delta); return out; }

References Slic3r::BoundingBox3Base< PointType >::offset().

Referenced by Slic3r::GUI::GLCanvas3D::_render_objects(), Slic3r::BuildVolume::all_paths_inside(), Slic3r::BuildVolume::all_paths_inside_vertices_and_normals_interleaved(), Slic3r::BuildVolume::object_state(), and Slic3r::BuildVolume::volume_state_bbox().

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

◆ intersects()

template<class PointType >
bool Slic3r::BoundingBox3Base< PointType >::intersects ( const BoundingBox3Base< PointType > &  other) const
inline
139 {
140 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() &&
141 this->min.z() < other.max.z() && this->max.z() > other.min.z();
142 }

References Slic3r::BoundingBoxBase< PointType, APointsType >::max, and Slic3r::BoundingBoxBase< PointType, APointsType >::min.

Referenced by priv::has_bb_intersection(), and Slic3r::BuildVolume::volume_state_bbox().

+ Here is the caller graph for this function:

◆ max_size()

template<class PointType >
template coordf_t Slic3r::BoundingBox3Base< PointType >::max_size ( ) const
212{
213 PointType s = size();
214 return std::max(s.x(), std::max(s.y(), s.z()));
215}
PointType size() const
Definition BoundingBox.cpp:153
PointType
Definition exact_geodesic.cpp:327

Referenced by Slic3r::GUI::GLCanvas3D::_max_bounding_box(), Slic3r::GUI::Camera::calc_zoom_to_bounding_box_factor(), and Slic3r::GUI::Bed3D::set_shape().

+ Here is the caller graph for this function:

◆ merge() [1/5]

template<class PointType >
void Slic3r::BoundingBox3Base< PointType >::merge ( const BoundingBox3Base< PointType > &  bb)
128{
129 assert(bb.defined || bb.min.x() >= bb.max.x() || bb.min.y() >= bb.max.y() || bb.min.z() >= bb.max.z());
130 if (bb.defined) {
131 if (this->defined) {
132 this->min = this->min.cwiseMin(bb.min);
133 this->max = this->max.cwiseMax(bb.max);
134 } else {
135 this->min = bb.min;
136 this->max = bb.max;
137 this->defined = true;
138 }
139 }
140}

◆ merge() [2/5]

void Slic3r::BoundingBoxBase< PointType, std::vector< PointType > >::merge ( const BoundingBoxBase< PointType, 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}

◆ merge() [3/5]

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

◆ merge() [4/5]

template<class PointType >
void Slic3r::BoundingBox3Base< PointType >::merge ( const PointsType points)
121{
122 this->merge(BoundingBox3Base(points));
123}

◆ merge() [5/5]

template<class PointType >
void Slic3r::BoundingBox3Base< PointType >::merge ( const PointType &  point)
106{
107 if (this->defined) {
108 this->min = this->min.cwiseMin(point);
109 this->max = this->max.cwiseMax(point);
110 } else {
111 this->min = point;
112 this->max = point;
113 this->defined = true;
114 }
115}

Referenced by Slic3r::BoundingBox3Base< PointType >::BoundingBox3Base(), Slic3r::GUI::GLCanvas3D::_max_bounding_box(), Slic3r::GUI::GLCanvas3D::_render_thumbnail_internal(), Slic3r::GUI::GLGizmoCut3D::bounding_box(), Slic3r::ModelObject::bounding_box_approx(), Slic3r::Model::bounding_box_approx(), Slic3r::ModelObject::bounding_box_exact(), Slic3r::Model::bounding_box_exact(), Slic3r::GUI::Camera::calc_zoom_to_volumes_factor(), Slic3r::Model::center_instances_around_point(), Slic3r::csgmesh_positive_bb(), priv::cut_surface(), Slic3r::ModelObject::full_raw_mesh_bounding_box(), Slic3r::GUI::GLModel::init_from(), Slic3r::GUI::GLModel::init_from(), Slic3r::GUI::GLModel::init_from(), Slic3r::GUI::GLModel::init_from(), Slic3r::ModelObject::instance_bounding_box(), Slic3r::GUI::GCodeViewer::load_toolpaths(), Slic3r::make_fill_lines(), Slic3r::GUI::Selection::paste_volumes_from_clipboard(), Slic3r::GUI::CreateFontImageJob::process(), Slic3r::GUI::Emboss::CreateFontStyleImagesJob::process(), Slic3r::ModelObject::raw_bounding_box(), Slic3r::ModelObject::raw_mesh_bounding_box(), Slic3r::CLI::run(), Slic3r::GUI::GLCanvas3D::scene_bounding_box(), Slic3r::TriangleMesh::transformed_bounding_box(), Slic3r::GUI::GLGizmoCut3D::transformed_bounding_box(), and Slic3r::GUI::GLCanvas3D::volumes_bounding_box().

+ Here is the caller graph for this function:

◆ offset()

template<class PointType >
template void Slic3r::BoundingBox3Base< PointType >::offset ( coordf_t  delta)
186{
187 PointType v(delta, delta, delta);
188 this->min -= v;
189 this->max += v;
190}

Referenced by Slic3r::BoundingBox3Base< PointType >::inflated(), and Slic3r::GUI::GLCanvas3D::on_mouse().

+ Here is the caller graph for this function:

◆ operator!=()

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

◆ operator==()

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

◆ overlap()

bool Slic3r::BoundingBoxBase< PointType, std::vector< PointType > >::overlap ( const BoundingBoxBase< PointType, 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<class PointType >
template double Slic3r::BoundingBox3Base< PointType >::radius ( ) const
169{
170 return 0.5 * (this->max - this->min).template cast<double>().norm();
171}

Referenced by Slic3r::GUI::GLGizmoRotate::init_data_from_selection(), Slic3r::GUI::CommonGizmosDataObjects::ObjectClipper::on_update(), and Slic3r::GUI::GLGizmoCut3D::update_bb().

+ Here is the caller graph for this function:

◆ reset()

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

◆ scale()

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

◆ size()

template<class PointType >
template Vec3d Slic3r::BoundingBox3Base< PointType >::size ( ) const
154{
155 return this->max - this->min;
156}

Referenced by Slic3r::PrintObject::PrintObject(), Slic3r::GUI::GLCanvas3D::_max_bounding_box(), Slic3r::GUI::BedShape::apply_optgroup_values(), Slic3r::GUI::bed_stride(), Slic3r::FillAdaptive::build_octree(), Slic3r::GUI::ObjectManipulation::change_size_value(), Slic3r::GUI::create_mesh(), Slic3r::GUI::GLGizmoEmboss::create_volume(), Slic3r::sla::find_min_z_height_rotation(), Slic3r::GUI::BedShape::get_full_name_with_params(), Slic3r::GUI::get_grabber_mean_size(), Slic3r::GUI::GLGizmoCut3D::get_tooltip(), Slic3r::GUI::ObjectList::load_generic_subobject(), Slic3r::GUI::ObjectList::load_modifier(), Slic3r::GUI::GCodeViewer::load_toolpaths(), Slic3r::GUI::GLGizmoMove3D::on_render(), Slic3r::GUI::GLGizmoScale3D::on_render(), Slic3r::GUI::Selection::paste_volumes_from_clipboard(), Slic3r::ModelObject::print_info(), Slic3r::GUI::CreateFontImageJob::process(), Slic3r::GUI::Selection::render_bounding_box(), Slic3r::GUI::GLGizmoCut3D::render_build_size(), Slic3r::GUI::GLGizmoBase::render_grabbers(), Slic3r::GUI::GLGizmoCut3D::render_slider_double_input(), Slic3r::GUI::Selection::scale_and_translate(), Slic3r::GUI::Selection::scale_to_fit_print_volume(), Slic3r::GUI::Sidebar::show_info_sizer(), Slic3r::PrintObject::slicing_parameters(), Slic3r::GLVolume::SinkingContours::update(), Slic3r::GUI::GLGizmoFlatten::update_planes(), Slic3r::GUI::GLGizmoScale3D::update_render_data(), and Slic3r::GUI::ObjectManipulation::update_settings_value().

+ Here is the caller graph for this function:

◆ translate() [1/4]

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

◆ translate() [2/4]

template<class PointType >
void Slic3r::BoundingBox3Base< PointType >::translate ( const Vec3d v)
inline
124{ this->min += v; this->max += v; }

◆ translate() [3/4]

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

◆ translate() [4/4]

template<class PointType >
void Slic3r::BoundingBox3Base< PointType >::translate ( coordf_t  x,
coordf_t  y,
coordf_t  z 
)
inline
123{ assert(this->defined); PointType v(x, y, z); this->min += v; this->max += v; }

Referenced by Slic3r::GUI::Bed3D::calc_extended_bounding_box(), Slic3r::CLI::run(), Slic3r::GUI::GLGizmoCut3D::set_center_pos(), and Slic3r::GUI::Camera::validate_target().

+ Here is the caller graph for this function:

Member Data Documentation

◆ defined

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

◆ max

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

◆ min

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

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