Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::arrangement::ArrangePolygon Struct Reference

Input/Output structure for the arrange() function. The poly field will not be modified during arrangement. Instead, the translation and rotation fields will mark the needed transformation for the polygon to be in the arranged position. These can also be set to an initial offset and rotation. More...

#include <src/libslic3r/Arrange.hpp>

+ Collaboration diagram for Slic3r::arrangement::ArrangePolygon:

Public Member Functions

void apply () const
 Helper function to call the setter with the arrange data arguments.
 
bool is_arranged () const
 Test if arrange() was called previously and gave a successful result.
 
ExPolygon transformed_poly () const
 

Public Attributes

ExPolygon poly
 
Vec2crd translation {0, 0}
 The 2D silhouette to be arranged.
 
double rotation {0.0}
 The translation of the poly.
 
coord_t inflation = 0
 The rotation of the poly in radians.
 
int bed_idx {UNARRANGED}
 Arrange with inflated polygon.
 
int priority {0}
 To which logical bed does poly belong...
 
std::vector< double > allowed_rotations = {0.}
 
std::function< void(const ArrangePolygon &)> setter = nullptr
 Optional setter function which can store arbitrary data in its closure.
 

Detailed Description

Input/Output structure for the arrange() function. The poly field will not be modified during arrangement. Instead, the translation and rotation fields will mark the needed transformation for the polygon to be in the arranged position. These can also be set to an initial offset and rotation.

The bed_idx field will indicate the logical bed into which the polygon belongs: UNARRANGED means no place for the polygon (also the initial state before arrange), 0..N means the index of the bed. Zero is the physical bed, larger than zero means a virtual bed.

Member Function Documentation

◆ apply()

void Slic3r::arrangement::ArrangePolygon::apply ( ) const
inline

Helper function to call the setter with the arrange data arguments.

109{ if (setter) setter(*this); }
std::function< void(const ArrangePolygon &)> setter
Optional setter function which can store arbitrary data in its closure.
Definition Arrange.hpp:106

References setter.

◆ is_arranged()

bool Slic3r::arrangement::ArrangePolygon::is_arranged ( ) const
inline

Test if arrange() was called previously and gave a successful result.

112{ return bed_idx != UNARRANGED; }
static const constexpr int UNARRANGED
A logical bed representing an object not being arranged. Either the arrange has not yet successfully ...
Definition Arrange.hpp:82
int bed_idx
Arrange with inflated polygon.
Definition Arrange.hpp:98

References bed_idx, and Slic3r::arrangement::UNARRANGED.

◆ transformed_poly()

ExPolygon Slic3r::arrangement::ArrangePolygon::transformed_poly ( ) const
inline
115 {
116 ExPolygon ret = poly;
117 ret.rotate(rotation);
118 ret.translate(translation.x(), translation.y());
119
120 return ret;
121 }
void rotate(double angle)
Definition ExPolygon.cpp:38
ExPolygon poly
Definition Arrange.hpp:94
Vec2crd translation
The 2D silhouette to be arranged.
Definition Arrange.hpp:95
double rotation
The translation of the poly.
Definition Arrange.hpp:96

References poly, Slic3r::ExPolygon::rotate(), rotation, Slic3r::ExPolygon::translate(), and translation.

Referenced by Slic3r::GUI::FillBedJob::prepare().

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

Member Data Documentation

◆ allowed_rotations

std::vector<double> Slic3r::arrangement::ArrangePolygon::allowed_rotations = {0.}

◆ bed_idx

int Slic3r::arrangement::ArrangePolygon::bed_idx {UNARRANGED}

◆ inflation

coord_t Slic3r::arrangement::ArrangePolygon::inflation = 0

The rotation of the poly in radians.

Referenced by Slic3r::arrangement::process_arrangeable(), and Slic3r::GUI::update_arrangepoly_slaprint().

◆ poly

◆ priority

int Slic3r::arrangement::ArrangePolygon::priority {0}

To which logical bed does poly belong...

Referenced by Slic3r::GUI::FillBedJob::prepare(), and Slic3r::arrangement::process_arrangeable().

◆ rotation

double Slic3r::arrangement::ArrangePolygon::rotation {0.0}

◆ setter

std::function<void(const ArrangePolygon&)> Slic3r::arrangement::ArrangePolygon::setter = nullptr

Optional setter function which can store arbitrary data in its closure.

Referenced by apply(), Slic3r::GUI::get_arrange_poly(), Slic3r::GUI::ArrangeJob::get_arrange_poly_(), and Slic3r::GUI::FillBedJob::prepare().

◆ translation

Vec2crd Slic3r::arrangement::ArrangePolygon::translation {0, 0}

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