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

#include <src/libslic3r/EdgeGrid.hpp>

+ Collaboration diagram for Slic3r::EdgeGrid::Contour:

Public Member Functions

 Contour ()=default
 
 Contour (const Slic3r::Point *begin, const Slic3r::Point *end, bool open)
 
 Contour (const Slic3r::Point *data, size_t size, bool open)
 
 Contour (const Points &pts, bool open)
 
const Slic3r::Pointbegin () const
 
const Slic3r::Pointend () const
 
bool open () const
 
bool closed () const
 
const Slic3r::Pointfront () const
 
const Slic3r::Pointback () const
 
const Slic3r::Pointsegment_start (size_t idx) const
 
const Slic3r::Pointsegment_end (size_t idx) const
 
const Slic3r::Pointsegment_prev (size_t idx) const
 
const size_t segment_idx_prev (size_t idx) const
 
const size_t segment_idx_next (size_t idx) const
 
size_t num_segments () const
 
Line get_segment (size_t idx) const
 
Lines get_segments () const
 

Private Member Functions

size_t size () const
 

Private Attributes

const Slic3r::Pointm_begin { nullptr }
 
const Slic3r::Pointm_end { nullptr }
 
bool m_open { false }
 

Detailed Description

Constructor & Destructor Documentation

◆ Contour() [1/4]

Slic3r::EdgeGrid::Contour::Contour ( )
default

◆ Contour() [2/4]

Slic3r::EdgeGrid::Contour::Contour ( const Slic3r::Point begin,
const Slic3r::Point end,
bool  open 
)
inline
const Slic3r::Point * end() const
Definition EdgeGrid.hpp:23
bool m_open
Definition EdgeGrid.hpp:88
const Slic3r::Point * m_end
Definition EdgeGrid.hpp:87
bool open() const
Definition EdgeGrid.hpp:24
const Slic3r::Point * m_begin
Definition EdgeGrid.hpp:86
const Slic3r::Point * begin() const
Definition EdgeGrid.hpp:22

◆ Contour() [3/4]

Slic3r::EdgeGrid::Contour::Contour ( const Slic3r::Point data,
size_t  size,
bool  open 
)
inline
19: Contour(data, data + size, open) {}
size_t size() const
Definition EdgeGrid.hpp:84

◆ Contour() [4/4]

Slic3r::EdgeGrid::Contour::Contour ( const Points pts,
bool  open 
)
inline
20: Contour(pts.data(), pts.size(), open) {}

Member Function Documentation

◆ back()

const Slic3r::Point & Slic3r::EdgeGrid::Contour::back ( ) const
inline
28{ return *(m_end - 1); }

References m_end.

Referenced by get_segments().

+ Here is the caller graph for this function:

◆ begin()

const Slic3r::Point * Slic3r::EdgeGrid::Contour::begin ( ) const
inline
22{ return m_begin; }

References m_begin.

Referenced by get_segments().

+ Here is the caller graph for this function:

◆ closed()

bool Slic3r::EdgeGrid::Contour::closed ( ) const
inline
25{ return !m_open; }

References m_open.

◆ end()

const Slic3r::Point * Slic3r::EdgeGrid::Contour::end ( ) const
inline
23{ return m_end; }

References m_end.

Referenced by get_segments().

+ Here is the caller graph for this function:

◆ front()

const Slic3r::Point & Slic3r::EdgeGrid::Contour::front ( ) const
inline
27{ return *m_begin; }

References m_begin.

Referenced by get_segments().

+ Here is the caller graph for this function:

◆ get_segment()

Line Slic3r::EdgeGrid::Contour::get_segment ( size_t  idx) const
inline
67 {
68 assert(idx < this->num_segments());
69 return Line(this->segment_start(idx), this->segment_end(idx));
70 }
size_t num_segments() const
Definition EdgeGrid.hpp:64
const Slic3r::Point & segment_end(size_t idx) const
Definition EdgeGrid.hpp:37
const Slic3r::Point & segment_start(size_t idx) const
Definition EdgeGrid.hpp:31

References num_segments(), segment_end(), and segment_start().

+ Here is the call graph for this function:

◆ get_segments()

Lines Slic3r::EdgeGrid::Contour::get_segments ( ) const
inline
73 {
74 Lines lines;
75 lines.reserve(this->num_segments());
76 if (this->num_segments() > 2) {
77 for (auto it = this->begin(); it != this->end() - 1; ++it) lines.push_back(Line(*it, *(it + 1)));
78 if (!m_open) lines.push_back(Line(this->back(), this->front()));
79 }
80 return lines;
81 }
const Slic3r::Point & back() const
Definition EdgeGrid.hpp:28
const Slic3r::Point & front() const
Definition EdgeGrid.hpp:27
std::vector< Line > Lines
Definition Line.hpp:17

References back(), begin(), end(), front(), m_open, and num_segments().

+ Here is the call graph for this function:

◆ num_segments()

size_t Slic3r::EdgeGrid::Contour::num_segments ( ) const
inline
64{ return this->size() - (m_open ? 1 : 0); }

References m_open, and size().

Referenced by get_segment(), get_segments(), segment_end(), segment_idx_next(), segment_idx_prev(), segment_prev(), and segment_start().

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

◆ open()

bool Slic3r::EdgeGrid::Contour::open ( ) const
inline
24{ return m_open; }

References m_open.

◆ segment_end()

const Slic3r::Point & Slic3r::EdgeGrid::Contour::segment_end ( size_t  idx) const
inline
37 {
38 assert(idx < this->num_segments());
39 const Slic3r::Point *ptr = m_begin + idx + 1;
40 return ptr == m_end ? *m_begin : *ptr;
41 }
Definition Point.hpp:158

References m_begin, m_end, and num_segments().

Referenced by get_segment(), Slic3r::EdgeGrid::Grid::has_intersecting_edges(), and Slic3r::EdgeGrid::Grid::intersecting_edges().

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

◆ segment_idx_next()

const size_t Slic3r::EdgeGrid::Contour::segment_idx_next ( size_t  idx) const
inline
58 {
59 assert(idx < this->num_segments());
60 ++ idx;
61 return m_begin + idx == m_end ? 0 : idx;
62 }

References m_begin, m_end, and num_segments().

+ Here is the call graph for this function:

◆ segment_idx_prev()

const size_t Slic3r::EdgeGrid::Contour::segment_idx_prev ( size_t  idx) const
inline
51 {
52 assert(idx < this->num_segments());
53 assert(idx > 0 || ! m_open);
54 return (idx == 0 ? this->size() : idx) - 1;
55 }

References m_open, num_segments(), and size().

+ Here is the call graph for this function:

◆ segment_prev()

const Slic3r::Point & Slic3r::EdgeGrid::Contour::segment_prev ( size_t  idx) const
inline
44 {
45 assert(idx < this->num_segments());
46 assert(idx > 0 || ! m_open);
47 return idx == 0 ? m_end[-1] : m_begin[idx - 1];
48 }

References m_begin, m_end, m_open, and num_segments().

+ Here is the call graph for this function:

◆ segment_start()

const Slic3r::Point & Slic3r::EdgeGrid::Contour::segment_start ( size_t  idx) const
inline
31 {
32 assert(idx < this->num_segments());
33 return m_begin[idx];
34 }

References m_begin, and num_segments().

Referenced by get_segment(), Slic3r::EdgeGrid::Grid::has_intersecting_edges(), and Slic3r::EdgeGrid::Grid::intersecting_edges().

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

◆ size()

size_t Slic3r::EdgeGrid::Contour::size ( ) const
inlineprivate
84{ return m_end - m_begin; }

References m_begin, and m_end.

Referenced by num_segments(), and segment_idx_prev().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_begin

const Slic3r::Point* Slic3r::EdgeGrid::Contour::m_begin { nullptr }
private

◆ m_end

const Slic3r::Point* Slic3r::EdgeGrid::Contour::m_end { nullptr }
private

◆ m_open

bool Slic3r::EdgeGrid::Contour::m_open { false }
private

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