Fixed a missing infill caused by int32_t overflow.

This commit is contained in:
Lukáš Hejl 2022-05-10 13:18:59 +02:00
parent 2cf6a9630f
commit ac23a369d5
3 changed files with 6 additions and 6 deletions

View File

@ -11,12 +11,12 @@ namespace Slic3r::Arachne
ExtrusionLine::ExtrusionLine(const size_t inset_idx, const bool is_odd) : inset_idx(inset_idx), is_odd(is_odd), is_closed(false) {}
coord_t ExtrusionLine::getLength() const
int64_t ExtrusionLine::getLength() const
{
if (junctions.empty())
return 0;
coord_t len = 0;
int64_t len = 0;
ExtrusionJunction prev = junctions.front();
for (const ExtrusionJunction &next : junctions) {
len += (next.p - prev.p).cast<int64_t>().norm();

View File

@ -8,7 +8,7 @@
#include "ExtrusionJunction.hpp"
#include "../../Polyline.hpp"
#include "../../Polygon.hpp"
#include "BoundingBox.hpp"
#include "../../BoundingBox.hpp"
namespace Slic3r {
class ThickPolyline;
@ -116,8 +116,8 @@ struct ExtrusionLine
/*!
* Sum the total length of this path.
*/
coord_t getLength() const;
coord_t polylineLength() const { return getLength(); }
int64_t getLength() const;
int64_t polylineLength() const { return getLength(); }
/*!
* Put all junction locations into a polygon object.

View File

@ -85,7 +85,7 @@ public:
{ // try extending chain in the other direction
chain.reverse();
}
coord_t chain_length = chain.polylineLength();
int64_t chain_length = chain.polylineLength();
while (true)
{