OrcaSlicer latest
OrcaSlicer
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)
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

enum class Slic3r::InfillPolylineClipper::Side
strongprivate
Enumerator
Left 
Right 
Top 
Bottom 
33 {
34 Left = 1,
35 Right = 2,
36 Top = 4,
37 Bottom = 8
38 };
@ Right
Definition GLToolbar.hpp:462
@ Left
Definition GLToolbar.hpp:462
@ Bottom
Definition GeometryEngine.hpp:16
@ Top
Definition GeometryEngine.hpp:16

Constructor & Destructor Documentation

◆ InfillPolylineClipper()

Slic3r::InfillPolylineClipper::InfillPolylineClipper ( const BoundingBox bbox,
const double scale_out )
inline
26: InfillPolylineOutput(scale_out), m_bbox(bbox) {}
BoundingBox m_bbox
Definition FillPlanePath.cpp:48
InfillPolylineOutput(const double scale_out)
Definition FillPlanePath.hpp:24

References Slic3r::InfillPolylineOutput::InfillPolylineOutput(), and m_bbox.

Here is the call graph for this function:

Member Function Documentation

◆ add_point()

void Slic3r::InfillPolylineClipper::add_point ( const Vec2d & pt)
56{
57 const Point pt{ this->scaled(fpt) };
58
59 if (m_out.size() < 2) {
60 // Collect the two first points and their status.
61 (m_out.empty() ? m_sides_prev : m_sides_this) = sides(pt);
62 m_out.emplace_back(pt);
63 } else {
64 // Classify the last inserted point, possibly remove it.
65 int sides_next = sides(pt);
66 if (// This point is inside. Take it.
67 m_sides_this == 0 ||
68 // Either this point is outside and previous or next is inside, or
69 // the edge possibly cuts corner of the bounding box.
70 (m_sides_prev & m_sides_this & sides_next) == 0) {
71 // Keep the last point.
73 } else {
74 // All the three points (this, prev, next) are outside at the same side.
75 // Ignore the last point.
76 m_out.pop_back();
77 }
78 // And save the current point.
79 m_out.emplace_back(pt);
80 m_sides_this = sides_next;
81 }
82}
int m_sides_this
Definition FillPlanePath.cpp:52
int m_sides_prev
Definition FillPlanePath.cpp:51
int sides(const Point &p) const
Definition FillPlanePath.cpp:40
Points m_out
Definition FillPlanePath.hpp:35
const Point scaled(const Vec2d &fpt) const
Definition FillPlanePath.hpp:31
Kernel::Point_3 Point
Definition MeshRepair.cpp:81

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

Here is the call graph for this function:

◆ clips()

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

Reimplemented from Slic3r::InfillPolylineOutput.

30{ return true; }

◆ reserve()

void Slic3r::InfillPolylineOutput::reserve ( size_t n)
inlineinherited
26{ m_out.reserve(n); }

References m_out.

◆ result()

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

References Slic3r::InfillPolylineOutput::m_out.

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

Here is the caller graph for this function:

◆ scaled()

const Point Slic3r::InfillPolylineOutput::scaled ( const Vec2d & fpt) const
inlineinherited
31{ return { coord_t(floor(fpt.x() * m_scale_out + 0.5)), coord_t(floor(fpt.y() * m_scale_out + 0.5)) }; }
double m_scale_out
Definition FillPlanePath.hpp:39
int64_t coord_t
Definition libslic3r.h:48

References m_scale_out.

Referenced by Slic3r::InfillPolylineClipper::add_point(), and add_point().

Here is the caller graph for this function:

◆ sides()

int Slic3r::InfillPolylineClipper::sides ( const Point & p) const
inlineprivate
40 {
41 return int(p.x() < m_bbox.min.x()) * int(Side::Left) +
42 int(p.x() > m_bbox.max.x()) * int(Side::Right) +
43 int(p.y() < m_bbox.min.y()) * int(Side::Bottom) +
44 int(p.y() > m_bbox.max.y()) * int(Side::Top);
45 };
@ Bottom
Definition FillPlanePath.cpp:37
@ Right
Definition FillPlanePath.cpp:35
@ Left
Definition FillPlanePath.cpp:34
@ Top
Definition FillPlanePath.cpp:36

References Bottom, Left, m_bbox, 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 InfillPolylineClipper(), and sides().

◆ m_out

Points Slic3r::InfillPolylineOutput::m_out
protectedinherited

◆ m_scale_out

double Slic3r::InfillPolylineOutput::m_scale_out
privateinherited

Referenced by InfillPolylineOutput(), and scaled().

◆ 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: