Incorporating performance optimizations from libnest2d

This commit is contained in:
tamasmeszaros
2018-06-28 16:14:17 +02:00
parent 230c681482
commit 5446b9f1e5
28 changed files with 2565 additions and 818 deletions
+5 -3
View File
@@ -50,7 +50,9 @@ public:
if(conf_.origo_location == BOTTOMLEFT)
for(unsigned i = 0; i < tsh.vertexCount(); i++) {
auto v = tsh.vertex(i);
setY(v, -getY(v) + conf_.height*conf_.mm_in_coord_units);
auto d = static_cast<Coord>(
std::round(conf_.height*conf_.mm_in_coord_units) );
setY(v, -getY(v) + d);
tsh.setVertex(i, v);
}
currentLayer() += ShapeLike::serialize<Formats::SVG>(tsh.rawShape(),
@@ -78,8 +80,8 @@ public:
}
void save(const std::string& filepath) {
unsigned lyrc = svg_layers_.size() > 1? 1 : 0;
unsigned last = svg_layers_.size() > 1? svg_layers_.size() : 0;
size_t lyrc = svg_layers_.size() > 1? 1 : 0;
size_t last = svg_layers_.size() > 1? svg_layers_.size() : 0;
for(auto& lyr : svg_layers_) {
std::fstream out(filepath + (lyrc > 0? std::to_string(lyrc) : "") +