Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::InfillPolylineClipper Class Reference
+ Inheritance diagram for Slic3r::InfillPolylineClipper:
+ Collaboration diagram for Slic3r::InfillPolylineClipper:

Public Member Functions

 InfillPolylineClipper (const BoundingBox bbox, const double scale_out)
 
void add_point (const Vec2d &pt)
 
Points && result ()
 
bool clips () const override
 
void reserve (size_t n)
 

Protected Member Functions

const Point scaled (const Vec2d &fpt) const
 

Protected Attributes

Points m_out
 

Private Types

enum class  Side { Left = 1 , Right = 2 , Top = 4 , Bottom = 8 }
 

Private Member Functions

int sides (const Point &p) const
 

Private Attributes

BoundingBox m_bbox
 
int m_sides_prev
 
int m_sides_this
 
double m_scale_out
 

Detailed Description

Member Enumeration Documentation

◆ Side

Constructor & Destructor Documentation

◆ InfillPolylineClipper()

Slic3r::InfillPolylineClipper::InfillPolylineClipper ( const BoundingBox  bbox,
const double  scale_out 
)
inline
11: FillPlanePath::InfillPolylineOutput(scale_out), m_bbox(bbox) {}
BoundingBox m_bbox
Definition FillPlanePath.cpp:33

Member Function Documentation

◆ add_point()

void Slic3r::InfillPolylineClipper::add_point ( const Vec2d pt)
41{
42 const Point pt{ this->scaled(fpt) };
43
44 if (m_out.size() < 2) {
45 // Collect the two first points and their status.
46 (m_out.empty() ? m_sides_prev : m_sides_this) = sides(pt);
47 m_out.emplace_back(pt);
48 } else {
49 // Classify the last inserted point, possibly remove it.
50 int sides_next = sides(pt);
51 if (// This point is inside. Take it.
52 m_sides_this == 0 ||
53 // Either this point is outside and previous or next is inside, or
54 // the edge possibly cuts corner of the bounding box.
55 (m_sides_prev & m_sides_this & sides_next) == 0) {
56 // Keep the last point.
58 } else {
59 // All the three points (this, prev, next) are outside at the same side.
60 // Ignore the last point.
61 m_out.pop_back();
62 }
63 // And save the current point.
64 m_out.emplace_back(pt);
65 m_sides_this = sides_next;
66 }
67}
Points m_out
Definition FillPlanePath.hpp:46
const Point scaled(const Vec2d &fpt) const
Definition FillPlanePath.hpp:43
int m_sides_this
Definition FillPlanePath.cpp:37
int m_sides_prev
Definition FillPlanePath.cpp:36
int sides(const Point &p) const
Definition FillPlanePath.cpp:25
Kernel::Point_2 Point
Definition point_areas.cpp:20

References Slic3r::FillPlanePath::InfillPolylineOutput::m_out, m_sides_prev, m_sides_this, Slic3r::FillPlanePath::InfillPolylineOutput::scaled(), and sides().

+ Here is the call graph for this function:

◆ clips()

bool Slic3r::InfillPolylineClipper::clips ( ) const
inlineoverridevirtual

Reimplemented from Slic3r::FillPlanePath::InfillPolylineOutput.

15{ return true; }

◆ reserve()

void Slic3r::FillPlanePath::InfillPolylineOutput::reserve ( size_t  n)
inlineinherited

◆ result()

Points && Slic3r::InfillPolylineClipper::result ( )
inline
14{ return std::move(m_out); }

References Slic3r::FillPlanePath::InfillPolylineOutput::m_out.

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

+ Here is the caller graph for this function:

◆ scaled()

const Point Slic3r::FillPlanePath::InfillPolylineOutput::scaled ( const Vec2d fpt) const
inlineprotectedinherited
43{ return { coord_t(floor(fpt.x() * m_scale_out + 0.5)), coord_t(floor(fpt.y() * m_scale_out + 0.5)) }; }
EIGEN_DEVICE_FUNC const FloorReturnType floor() const
Definition ArrayCwiseUnaryOps.h:388
double m_scale_out
Definition FillPlanePath.hpp:50
int32_t coord_t
Definition libslic3r.h:39

References floor(), and Slic3r::FillPlanePath::InfillPolylineOutput::m_scale_out.

Referenced by add_point(), and Slic3r::FillPlanePath::InfillPolylineOutput::add_point().

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

◆ sides()

int Slic3r::InfillPolylineClipper::sides ( const Point p) const
inlineprivate
25 {
26 return int(p.x() < m_bbox.min.x()) * int(Side::Left) +
27 int(p.x() > m_bbox.max.x()) * int(Side::Right) +
28 int(p.y() < m_bbox.min.y()) * int(Side::Bottom) +
29 int(p.y() > m_bbox.max.y()) * int(Side::Top);
30 };
PointType max
Definition BoundingBox.hpp:17
PointType min
Definition BoundingBox.hpp:16

References Bottom, Left, m_bbox, Slic3r::BoundingBoxBase< PointType, APointsType >::max, Slic3r::BoundingBoxBase< PointType, APointsType >::min, Right, and Top.

Referenced by add_point().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_bbox

BoundingBox Slic3r::InfillPolylineClipper::m_bbox
private

Referenced by sides().

◆ m_out

◆ m_scale_out

double Slic3r::FillPlanePath::InfillPolylineOutput::m_scale_out
privateinherited

◆ m_sides_prev

int Slic3r::InfillPolylineClipper::m_sides_prev
private

Referenced by add_point().

◆ m_sides_this

int Slic3r::InfillPolylineClipper::m_sides_this
private

Referenced by add_point().


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