Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::Arachne::ExtrusionLine Struct Reference

#include <src/libslic3r/Arachne/utils/ExtrusionLine.hpp>

+ Collaboration diagram for Slic3r::Arachne::ExtrusionLine:

Public Member Functions

size_t size () const
 
bool empty () const
 
 ExtrusionLine (const size_t inset_idx, const bool is_odd)
 
 ExtrusionLine ()
 
 ExtrusionLine (const ExtrusionLine &other)
 
ExtrusionLineoperator= (ExtrusionLine &&other)
 
ExtrusionLineoperator= (const ExtrusionLine &other)
 
std::vector< ExtrusionJunction >::const_iterator begin () const
 
std::vector< ExtrusionJunction >::const_iterator end () const
 
std::vector< ExtrusionJunction >::const_reverse_iterator rbegin () const
 
std::vector< ExtrusionJunction >::const_reverse_iterator rend () const
 
std::vector< ExtrusionJunction >::const_reference front () const
 
std::vector< ExtrusionJunction >::const_reference back () const
 
const ExtrusionJunctionoperator[] (unsigned int index) const
 
ExtrusionJunctionoperator[] (unsigned int index)
 
std::vector< ExtrusionJunction >::iterator begin ()
 
std::vector< ExtrusionJunction >::iterator end ()
 
std::vector< ExtrusionJunction >::reference front ()
 
std::vector< ExtrusionJunction >::reference back ()
 
template<typename... Args>
void emplace_back (Args &&...args)
 
void remove (unsigned int index)
 
void insert (size_t index, const ExtrusionJunction &p)
 
template<class iterator >
std::vector< ExtrusionJunction >::iterator insert (std::vector< ExtrusionJunction >::const_iterator pos, iterator first, iterator last)
 
void clear ()
 
void reverse ()
 
int64_t getLength () const
 
int64_t polylineLength () const
 
Polygon toPolygon () const
 
coord_t getMinimalWidth () const
 
void simplify (int64_t smallest_line_segment_squared, int64_t allowed_error_distance_squared, int64_t maximum_extrusion_area_deviation)
 
bool is_contour () const
 
double area () const
 

Static Public Member Functions

static int64_t calculateExtrusionAreaDeviationError (ExtrusionJunction A, ExtrusionJunction B, ExtrusionJunction C)
 

Public Attributes

size_t inset_idx
 
bool is_odd
 
bool is_closed
 
std::vector< ExtrusionJunctionjunctions
 

Detailed Description

Represents a polyline (not just a line) that is to be extruded with variable line width.

This polyline is a sequence of ExtrusionJunction, with a bit of metadata about which inset it represents.

Constructor & Destructor Documentation

◆ ExtrusionLine() [1/3]

Slic3r::Arachne::ExtrusionLine::ExtrusionLine ( const size_t  inset_idx,
const bool  is_odd 
)
size_t inset_idx
Definition ExtrusionLine.hpp:37
bool is_odd
Definition ExtrusionLine.hpp:46
bool is_closed
Definition ExtrusionLine.hpp:51

◆ ExtrusionLine() [2/3]

Slic3r::Arachne::ExtrusionLine::ExtrusionLine ( )
inline
72: inset_idx(-1), is_odd(true), is_closed(false) {}

◆ ExtrusionLine() [3/3]

Slic3r::Arachne::ExtrusionLine::ExtrusionLine ( const ExtrusionLine other)
inline
73: inset_idx(other.inset_idx), is_odd(other.is_odd), is_closed(other.is_closed), junctions(other.junctions) {}
std::vector< ExtrusionJunction > junctions
Definition ExtrusionLine.hpp:69

Member Function Documentation

◆ area()

double Slic3r::Arachne::ExtrusionLine::area ( ) const
240{
241 assert(this->is_closed);
242 double a = 0.;
243 if (this->junctions.size() >= 3) {
244 Vec2d p1 = this->junctions.back().p.cast<double>();
245 for (const ExtrusionJunction &junction : this->junctions) {
246 Vec2d p2 = junction.p.cast<double>();
247 a += cross2(p1, p2);
248 p1 = p2;
249 }
250 }
251 return 0.5 * a;
252}
Derived::Scalar cross2(const Eigen::MatrixBase< Derived > &v1, const Eigen::MatrixBase< Derived2 > &v2)
Definition Point.hpp:93
Eigen::Matrix< double, 2, 1, Eigen::DontAlign > Vec2d
Definition Point.hpp:51

References Slic3r::cross2(), is_closed, and junctions.

+ Here is the call graph for this function:

◆ back() [1/2]

std::vector< ExtrusionJunction >::reference Slic3r::Arachne::ExtrusionLine::back ( )
inline
104{ return junctions.back(); }

References junctions.

◆ back() [2/2]

std::vector< ExtrusionJunction >::const_reference Slic3r::Arachne::ExtrusionLine::back ( ) const
inline
98{ return junctions.back(); }

References junctions.

Referenced by Slic3r::fuzzy_extrusion_line(), Slic3r::Arachne::SkeletalTrapezoidation::generateLocalMaximaSingleBeads(), and getLength().

+ Here is the caller graph for this function:

◆ begin() [1/2]

std::vector< ExtrusionJunction >::iterator Slic3r::Arachne::ExtrusionLine::begin ( )
inline
101{ return junctions.begin(); }

References junctions.

◆ begin() [2/2]

std::vector< ExtrusionJunction >::const_iterator Slic3r::Arachne::ExtrusionLine::begin ( ) const
inline
93{ return junctions.begin(); }

References junctions.

Referenced by Slic3r::Arachne::to_thick_polyline().

+ Here is the caller graph for this function:

◆ calculateExtrusionAreaDeviationError()

int64_t Slic3r::Arachne::ExtrusionLine::calculateExtrusionAreaDeviationError ( ExtrusionJunction  A,
ExtrusionJunction  B,
ExtrusionJunction  C 
)
static

Computes and returns the total area error (in μm²) of the AB and BC segments of an ABC straight ExtrusionLine when the junction B with a width B.w is removed from the ExtrusionLine. The area changes due to the fact that the new simplified line AC has a uniform width which equals to the weighted average of the width of the subsegments (based on their length).

Parameters
AStart point of the 3-point-straight line
BIntermediate point of the 3-point-straight line
CEnd point of the 3-point-straight line
191 {
192 /*
193 * A B C A C
194 * --------------- **************
195 * | | ------------------------------------------
196 * | |--------------------------| B removed | |***************************|
197 * | | | ---------> | | |
198 * | |--------------------------| | |***************************|
199 * | | ------------------------------------------
200 * --------------- ^ **************
201 * ^ B.w + C.w / 2 ^
202 * A.w + B.w / 2 new_width = weighted_average_width
203 *
204 *
205 * ******** denote the total extrusion area deviation error in the consecutive segments as a result of using the
206 * weighted-average width for the entire extrusion line.
207 *
208 * */
209 const int64_t ab_length = (B.p - A.p).cast<int64_t>().norm();
210 const int64_t bc_length = (C.p - B.p).cast<int64_t>().norm();
211 if (const coord_t width_diff = std::max(std::abs(B.w - A.w), std::abs(C.w - B.w)); width_diff > 1) {
212 // Adjust the width only if there is a difference, or else the rounding errors may produce the wrong
213 // weighted average value.
214 const int64_t ab_weight = (A.w + B.w) / 2;
215 const int64_t bc_weight = (B.w + C.w) / 2;
216 const int64_t weighted_average_width = (ab_length * ab_weight + bc_length * bc_weight) / (ab_length + bc_length);
217 const int64_t ac_length = (C.p - A.p).cast<int64_t>().norm();
218 return std::abs((ab_weight * ab_length + bc_weight * bc_length) - (weighted_average_width * ac_length));
219 } else {
220 // If the width difference is very small, then select the width of the segment that is longer
221 return ab_length > bc_length ? int64_t(width_diff) * bc_length : int64_t(width_diff) * ab_length;
222 }
223}
int32_t coord_t
Definition libslic3r.h:39
__int64 int64_t
Definition unistd.h:76

References Slic3r::Arachne::ExtrusionJunction::p, and Slic3r::Arachne::ExtrusionJunction::w.

Referenced by simplify().

+ Here is the caller graph for this function:

◆ clear()

void Slic3r::Arachne::ExtrusionLine::clear ( )
inline
116{ junctions.clear(); }

References junctions.

◆ emplace_back()

template<typename... Args>
void Slic3r::Arachne::ExtrusionLine::emplace_back ( Args &&...  args)
inline
106{ junctions.emplace_back(args...); }

References junctions.

◆ empty()

bool Slic3r::Arachne::ExtrusionLine::empty ( ) const
inline

Whether there are no junctions.

62{ return junctions.empty(); }

References junctions.

Referenced by Slic3r::traverse_extrusions().

+ Here is the caller graph for this function:

◆ end() [1/2]

std::vector< ExtrusionJunction >::iterator Slic3r::Arachne::ExtrusionLine::end ( )
inline
102{ return junctions.end(); }

References junctions.

◆ end() [2/2]

std::vector< ExtrusionJunction >::const_iterator Slic3r::Arachne::ExtrusionLine::end ( ) const
inline
94{ return junctions.end(); }

References junctions.

Referenced by Slic3r::Arachne::to_thick_polyline().

+ Here is the caller graph for this function:

◆ front() [1/2]

std::vector< ExtrusionJunction >::reference Slic3r::Arachne::ExtrusionLine::front ( )
inline
103{ return junctions.front(); }

References junctions.

◆ front() [2/2]

std::vector< ExtrusionJunction >::const_reference Slic3r::Arachne::ExtrusionLine::front ( ) const
inline
97{ return junctions.front(); }

References junctions.

Referenced by Slic3r::fuzzy_extrusion_line(), getLength(), and Slic3r::Arachne::to_thick_polyline().

+ Here is the caller graph for this function:

◆ getLength()

int64_t Slic3r::Arachne::ExtrusionLine::getLength ( ) const

Sum the total length of this path.

16{
17 if (junctions.empty())
18 return 0;
19
20 int64_t len = 0;
21 ExtrusionJunction prev = junctions.front();
22 for (const ExtrusionJunction &next : junctions) {
23 len += (next.p - prev.p).cast<int64_t>().norm();
24 prev = next;
25 }
26 if (is_closed)
27 len += (front().p - back().p).cast<int64_t>().norm();
28
29 return len;
30}
std::vector< ExtrusionJunction >::const_reference back() const
Definition ExtrusionLine.hpp:98
std::vector< ExtrusionJunction >::const_reference front() const
Definition ExtrusionLine.hpp:97

References back(), front(), is_closed, junctions, and Slic3r::Arachne::ExtrusionJunction::p.

Referenced by polylineLength().

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

◆ getMinimalWidth()

coord_t Slic3r::Arachne::ExtrusionLine::getMinimalWidth ( ) const

Get the minimal width of this path

33{
34 return std::min_element(junctions.cbegin(), junctions.cend(),
35 [](const ExtrusionJunction& l, const ExtrusionJunction& r)
36 {
37 return l.w < r.w;
38 })->w;
39}

References junctions.

◆ insert() [1/2]

void Slic3r::Arachne::ExtrusionLine::insert ( size_t  index,
const ExtrusionJunction p 
)
inline
108{ junctions.insert(junctions.begin() + index, p); }

References junctions.

◆ insert() [2/2]

template<class iterator >
std::vector< ExtrusionJunction >::iterator Slic3r::Arachne::ExtrusionLine::insert ( std::vector< ExtrusionJunction >::const_iterator  pos,
iterator  first,
iterator  last 
)
inline
112 {
113 return junctions.insert(pos, first, last);
114 }

References junctions.

◆ is_contour()

bool Slic3r::Arachne::ExtrusionLine::is_contour ( ) const
226{
227 if (!this->is_closed)
228 return false;
229
230 Polygon poly;
231 poly.points.reserve(this->junctions.size());
232 for (const ExtrusionJunction &junction : this->junctions)
233 poly.points.emplace_back(junction.p);
234
235 // Arachne produces contour with clockwise orientation and holes with counterclockwise orientation.
236 return poly.is_clockwise();
237}
Points points
Definition MultiPoint.hpp:18
Slic3r::Polygon Polygon
Definition Emboss.cpp:34
void emplace_back(Args &&...args)
Definition ExtrusionLine.hpp:106

References Slic3r::Polygon::is_clockwise(), is_closed, junctions, and Slic3r::MultiPoint::points.

+ Here is the call graph for this function:

◆ operator=() [1/2]

ExtrusionLine & Slic3r::Arachne::ExtrusionLine::operator= ( const ExtrusionLine other)
inline
85 {
86 junctions = other.junctions;
87 inset_idx = other.inset_idx;
88 is_odd = other.is_odd;
89 is_closed = other.is_closed;
90 return *this;
91 }

References inset_idx, is_closed, is_odd, and junctions.

◆ operator=() [2/2]

ExtrusionLine & Slic3r::Arachne::ExtrusionLine::operator= ( ExtrusionLine &&  other)
inline
76 {
77 junctions = std::move(other.junctions);
78 inset_idx = other.inset_idx;
79 is_odd = other.is_odd;
80 is_closed = other.is_closed;
81 return *this;
82 }

References inset_idx, is_closed, is_odd, and junctions.

◆ operator[]() [1/2]

ExtrusionJunction & Slic3r::Arachne::ExtrusionLine::operator[] ( unsigned int  index)
inline
100{ return junctions[index]; }

References junctions.

◆ operator[]() [2/2]

const ExtrusionJunction & Slic3r::Arachne::ExtrusionLine::operator[] ( unsigned int  index) const
inline
99{ return junctions[index]; }

References junctions.

◆ polylineLength()

int64_t Slic3r::Arachne::ExtrusionLine::polylineLength ( ) const
inline
123{ return getLength(); }
int64_t getLength() const
Definition ExtrusionLine.cpp:15

References getLength().

+ Here is the call graph for this function:

◆ rbegin()

std::vector< ExtrusionJunction >::const_reverse_iterator Slic3r::Arachne::ExtrusionLine::rbegin ( ) const
inline
95{ return junctions.rbegin(); }

References junctions.

◆ remove()

void Slic3r::Arachne::ExtrusionLine::remove ( unsigned int  index)
inline
107{ junctions.erase(junctions.begin() + index); }

References junctions.

◆ rend()

std::vector< ExtrusionJunction >::const_reverse_iterator Slic3r::Arachne::ExtrusionLine::rend ( ) const
inline
96{ return junctions.rend(); }

References junctions.

◆ reverse()

void Slic3r::Arachne::ExtrusionLine::reverse ( )
inline
117{ std::reverse(junctions.begin(), junctions.end()); }

References junctions.

◆ simplify()

void Slic3r::Arachne::ExtrusionLine::simplify ( int64_t  smallest_line_segment_squared,
int64_t  allowed_error_distance_squared,
int64_t  maximum_extrusion_area_deviation 
)

Removes vertices of the ExtrusionLines to make sure that they are not too high resolution.

This removes junctions which are connected to line segments that are shorter than the smallest_line_segment, unless that would introduce a deviation in the contour of more than allowed_error_distance.

Criteria:

  1. Never remove a junction if either of the connected segments is larger than smallest_line_segment
  2. Never remove a junction if the distance between that junction and the final resulting polygon would be higher than allowed_error_distance
  3. The direction of segments longer than smallest_line_segment always remains unaltered (but their end points may change if it is connected to a small segment)
  4. Never remove a junction if it has a distinctively different width than the next junction, as this can introduce unwanted irregularities on the wall widths.

Simplify uses a heuristic and doesn't necessarily remove all removable vertices under the above criteria, but simplify may never violate these criteria. Unless the segments or the distance is smaller than the rounding error of 5 micron.

Vertices which introduce an error of less than 5 microns are removed anyway, even if the segments are longer than the smallest line segment. This makes sure that (practically) co-linear line segments are joined into a single line segment.

Parameters
smallest_line_segmentMaximal length of removed line segments.
allowed_error_distanceIf removing a vertex introduces a deviation from the original path that is more than this distance, the vertex may not be removed.
maximum_extrusion_area_deviationThe maximum extrusion area deviation allowed when removing intermediate junctions from a straight ExtrusionLine
42{
43 const size_t min_path_size = is_closed ? 3 : 2;
44 if (junctions.size() <= min_path_size)
45 return;
46
47 // TODO: allow for the first point to be removed in case of simplifying closed Extrusionlines.
48
49 /* ExtrusionLines are treated as (open) polylines, so in case an ExtrusionLine is actually a closed polygon, its
50 * starting and ending points will be equal (or almost equal). Therefore, the simplification of the ExtrusionLine
51 * should not touch the first and last points. As a result, start simplifying from point at index 1.
52 * */
53 std::vector<ExtrusionJunction> new_junctions;
54 // Starting junction should always exist in the simplified path
55 new_junctions.emplace_back(junctions.front());
56
57 /* Initially, previous_previous is always the same as previous because, for open ExtrusionLines the last junction
58 * cannot be taken into consideration when checking the points at index 1. For closed ExtrusionLines, the first and
59 * last junctions are anyway the same.
60 * */
61 ExtrusionJunction previous_previous = junctions.front();
62 ExtrusionJunction previous = junctions.front();
63
64 /* When removing a vertex, we check the height of the triangle of the area
65 being removed from the original polygon by the simplification. However,
66 when consecutively removing multiple vertices the height of the previously
67 removed vertices w.r.t. the shortcut path changes.
68 In order to not recompute the new height value of previously removed
69 vertices we compute the height of a representative triangle, which covers
70 the same amount of area as the area being cut off. We use the Shoelace
71 formula to accumulate the area under the removed segments. This works by
72 computing the area in a 'fan' where each of the blades of the fan go from
73 the origin to one of the segments. While removing vertices the area in
74 this fan accumulates. By subtracting the area of the blade connected to
75 the short-cutting segment we obtain the total area of the cutoff region.
76 From this area we compute the height of the representative triangle using
77 the standard formula for a triangle area: A = .5*b*h
78 */
79 const ExtrusionJunction& initial = junctions.at(1);
80 int64_t accumulated_area_removed = int64_t(previous.p.x()) * int64_t(initial.p.y()) - int64_t(previous.p.y()) * int64_t(initial.p.x()); // Twice the Shoelace formula for area of polygon per line segment.
81
82 for (size_t point_idx = 1; point_idx < junctions.size() - 1; point_idx++)
83 {
84 const ExtrusionJunction& current = junctions[point_idx];
85
86 // Spill over in case of overflow, unless the [next] vertex will then be equal to [previous].
87 const bool spill_over = point_idx + 1 == junctions.size() && new_junctions.size() > 1;
88 ExtrusionJunction& next = spill_over ? new_junctions[0] : junctions[point_idx + 1];
89
90 const int64_t removed_area_next = int64_t(current.p.x()) * int64_t(next.p.y()) - int64_t(current.p.y()) * int64_t(next.p.x()); // Twice the Shoelace formula for area of polygon per line segment.
91 const int64_t negative_area_closing = int64_t(next.p.x()) * int64_t(previous.p.y()) - int64_t(next.p.y()) * int64_t(previous.p.x()); // Area between the origin and the short-cutting segment
92 accumulated_area_removed += removed_area_next;
93
94 const int64_t length2 = (current - previous).cast<int64_t>().squaredNorm();
95 if (length2 < scaled<coord_t>(0.025))
96 {
97 // We're allowed to always delete segments of less than 5 micron. The width in this case doesn't matter that much.
98 continue;
99 }
100
101 const int64_t area_removed_so_far = accumulated_area_removed + negative_area_closing; // Close the shortcut area polygon
102 const int64_t base_length_2 = (next - previous).cast<int64_t>().squaredNorm();
103
104 if (base_length_2 == 0) // Two line segments form a line back and forth with no area.
105 {
106 continue; // Remove the junction (vertex).
107 }
108 //We want to check if the height of the triangle formed by previous, current and next vertices is less than allowed_error_distance_squared.
109 //1/2 L = A [actual area is half of the computed shoelace value] // Shoelace formula is .5*(...) , but we simplify the computation and take out the .5
110 //A = 1/2 * b * h [triangle area formula]
111 //L = b * h [apply above two and take out the 1/2]
112 //h = L / b [divide by b]
113 //h^2 = (L / b)^2 [square it]
114 //h^2 = L^2 / b^2 [factor the divisor]
115 const auto height_2 = int64_t(double(area_removed_so_far) * double(area_removed_so_far) / double(base_length_2));
116 const int64_t extrusion_area_error = calculateExtrusionAreaDeviationError(previous, current, next);
117 if ((height_2 <= scaled<coord_t>(0.001) //Almost exactly colinear (barring rounding errors).
118 && Line::distance_to_infinite(current.p, previous.p, next.p) <= scaled<double>(0.001)) // Make sure that height_2 is not small because of cancellation of positive and negative areas
119 // We shouldn't remove middle junctions of colinear segments if the area changed for the C-P segment is exceeding the maximum allowed
120 && extrusion_area_error <= maximum_extrusion_area_deviation)
121 {
122 // Remove the current junction (vertex).
123 continue;
124 }
125
126 if (length2 < smallest_line_segment_squared
127 && height_2 <= allowed_error_distance_squared) // Removing the junction (vertex) doesn't introduce too much error.
128 {
129 const int64_t next_length2 = (current - next).cast<int64_t>().squaredNorm();
130 if (next_length2 > 4 * smallest_line_segment_squared)
131 {
132 // Special case; The next line is long. If we were to remove this, it could happen that we get quite noticeable artifacts.
133 // We should instead move this point to a location where both edges are kept and then remove the previous point that we wanted to keep.
134 // By taking the intersection of these two lines, we get a point that preserves the direction (so it makes the corner a bit more pointy).
135 // We just need to be sure that the intersection point does not introduce an artifact itself.
136 Point intersection_point;
137 bool has_intersection = Line(previous_previous.p, previous.p).intersection_infinite(Line(current.p, next.p), &intersection_point);
138 if (!has_intersection
139 || Line::distance_to_infinite_squared(intersection_point, previous.p, current.p) > double(allowed_error_distance_squared)
140 || (intersection_point - previous.p).cast<int64_t>().squaredNorm() > smallest_line_segment_squared // The intersection point is way too far from the 'previous'
141 || (intersection_point - next.p).cast<int64_t>().squaredNorm() > smallest_line_segment_squared) // and 'next' points, so it shouldn't replace 'current'
142 {
143 // We can't find a better spot for it, but the size of the line is more than 5 micron.
144 // So the only thing we can do here is leave it in...
145 }
146 else
147 {
148 // New point seems like a valid one.
149 const ExtrusionJunction new_to_add = ExtrusionJunction(intersection_point, current.w, current.perimeter_index);
150 // If there was a previous point added, remove it.
151 if(!new_junctions.empty())
152 {
153 new_junctions.pop_back();
154 previous = previous_previous;
155 }
156
157 // The junction (vertex) is replaced by the new one.
158 accumulated_area_removed = removed_area_next; // So that in the next iteration it's the area between the origin, [previous] and [current]
159 previous_previous = previous;
160 previous = new_to_add; // Note that "previous" is only updated if we don't remove the junction (vertex).
161 new_junctions.push_back(new_to_add);
162 continue;
163 }
164 }
165 else
166 {
167 continue; // Remove the junction (vertex).
168 }
169 }
170 // The junction (vertex) isn't removed.
171 accumulated_area_removed = removed_area_next; // So that in the next iteration it's the area between the origin, [previous] and [current]
172 previous_previous = previous;
173 previous = current; // Note that "previous" is only updated if we don't remove the junction (vertex).
174 new_junctions.push_back(current);
175 }
176
177 // Ending junction (vertex) should always exist in the simplified path
178 new_junctions.emplace_back(junctions.back());
179
180 /* In case this is a closed polygon (instead of a poly-line-segments), the invariant that the first and last points are the same should be enforced.
181 * Since one of them didn't move, and the other can't have been moved further than the constraints, if originally equal, they can simply be equated.
182 */
183 if ((junctions.front().p - junctions.back().p).cast<int64_t>().squaredNorm() == 0)
184 {
185 new_junctions.back().p = junctions.front().p;
186 }
187
188 junctions = new_junctions;
189}
double distance_to_infinite_squared(const Point &point, Point *closest_point) const
Definition Line.hpp:172
static double distance_to_infinite(const Point &point, const Point &a, const Point &b)
Definition Line.hpp:195
Kernel::Point_2 Point
Definition point_areas.cpp:20
static int64_t calculateExtrusionAreaDeviationError(ExtrusionJunction A, ExtrusionJunction B, ExtrusionJunction C)
Definition ExtrusionLine.cpp:191

References calculateExtrusionAreaDeviationError(), Slic3r::Line::distance_to_infinite(), Slic3r::Line::distance_to_infinite_squared(), Slic3r::Line::intersection_infinite(), is_closed, junctions, Slic3r::Arachne::ExtrusionJunction::p, Slic3r::Arachne::ExtrusionJunction::perimeter_index, and Slic3r::Arachne::ExtrusionJunction::w.

+ Here is the call graph for this function:

◆ size()

size_t Slic3r::Arachne::ExtrusionLine::size ( ) const
inline

Gets the number of vertices in this polygon.

Returns
The number of vertices in this polygon.
57{ return junctions.size(); }

References junctions.

Referenced by Slic3r::fuzzy_extrusion_line(), Slic3r::Arachne::to_thick_polyline(), and Slic3r::traverse_extrusions().

+ Here is the caller graph for this function:

◆ toPolygon()

Polygon Slic3r::Arachne::ExtrusionLine::toPolygon ( ) const
inline

Put all junction locations into a polygon object.

When this path is not closed the returned Polygon should be handled as a polyline, rather than a polygon.

131 {
132 Polygon ret;
133 for (const ExtrusionJunction &j : junctions)
134 ret.points.emplace_back(j.p);
135
136 return ret;
137 }

References junctions, and Slic3r::MultiPoint::points.

Member Data Documentation

◆ inset_idx

size_t Slic3r::Arachne::ExtrusionLine::inset_idx

Which inset this path represents, counted from the outside inwards.

The outer wall has index 0.

Referenced by operator=(), operator=(), and Slic3r::traverse_extrusions().

◆ is_closed

bool Slic3r::Arachne::ExtrusionLine::is_closed

◆ is_odd

bool Slic3r::Arachne::ExtrusionLine::is_odd

If a thin piece needs to be printed with an odd number of walls (e.g. 5 walls) then there will be one wall in the middle that is not a loop. This field indicates whether this path is such a line through the middle, that has no companion line going back on the other side and is not a closed loop.

Referenced by Slic3r::Arachne::PolylineStitcher< Paths, Path, Junction >::isOdd(), operator=(), operator=(), and Slic3r::Arachne::WallToolPaths::removeSmallLines().

◆ junctions


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