Merge branch 'dev' of https://github.com/prusa3d/PrusaSlicer into dev
This commit is contained in:
commit
91311fc0a0
3 changed files with 15 additions and 16 deletions
|
@ -151,8 +151,8 @@ bool stl_write_binary(stl_file *stl, const char *file, const char *label)
|
|||
memcpy(buffer, &stl->stats.number_of_facets, 4);
|
||||
stl_internal_reverse_quads(buffer, 4);
|
||||
fwrite(buffer, 4, 1, fp);
|
||||
for (size_t i = 0; i < stl->stats.number_of_facets; ++ i) {
|
||||
memcpy(buffer, stl->facet_start + i, 50);
|
||||
for (const stl_facet &facet : stl->facet_start) {
|
||||
memcpy(buffer, &facet, 50);
|
||||
// Convert to little endian.
|
||||
stl_internal_reverse_quads(buffer, 48);
|
||||
fwrite(buffer, SIZEOF_STL_FACET, 1, fp);
|
||||
|
|
|
@ -11,7 +11,7 @@ ExtrusionEntityCollection::ExtrusionEntityCollection(const ExtrusionPaths &paths
|
|||
this->append(paths);
|
||||
}
|
||||
|
||||
ExtrusionEntityCollection& ExtrusionEntityCollection::operator= (const ExtrusionEntityCollection &other)
|
||||
ExtrusionEntityCollection& ExtrusionEntityCollection::operator=(const ExtrusionEntityCollection &other)
|
||||
{
|
||||
this->entities = other.entities;
|
||||
for (size_t i = 0; i < this->entities.size(); ++i)
|
||||
|
@ -175,20 +175,20 @@ size_t ExtrusionEntityCollection::items_count() const
|
|||
}
|
||||
|
||||
// Returns a single vector of pointers to all non-collection items contained in this one.
|
||||
void ExtrusionEntityCollection::flatten(ExtrusionEntityCollection* retval) const
|
||||
{
|
||||
for (const ExtrusionEntity *entity : this->entities)
|
||||
if (entity->is_collection())
|
||||
retval->append(static_cast<const ExtrusionEntityCollection*>(entity)->flatten().entities);
|
||||
else
|
||||
retval->append(*entity);
|
||||
}
|
||||
|
||||
ExtrusionEntityCollection ExtrusionEntityCollection::flatten() const
|
||||
{
|
||||
ExtrusionEntityCollection coll;
|
||||
this->flatten(&coll);
|
||||
return coll;
|
||||
struct Flatten {
|
||||
ExtrusionEntityCollection out;
|
||||
void recursive_do(const ExtrusionEntityCollection &collection) {
|
||||
for (const ExtrusionEntity* entity : collection.entities)
|
||||
if (entity->is_collection())
|
||||
this->recursive_do(*static_cast<const ExtrusionEntityCollection*>(entity));
|
||||
else
|
||||
out.append(*entity);
|
||||
}
|
||||
} flatten;
|
||||
flatten.recursive_do(*this);
|
||||
return flatten.out;
|
||||
}
|
||||
|
||||
double ExtrusionEntityCollection::min_mm3_per_mm() const
|
||||
|
|
|
@ -85,7 +85,6 @@ public:
|
|||
Polygons polygons_covered_by_spacing(const float scaled_epsilon = 0.f) const
|
||||
{ Polygons out; this->polygons_covered_by_spacing(out, scaled_epsilon); return out; }
|
||||
size_t items_count() const;
|
||||
void flatten(ExtrusionEntityCollection* retval) const;
|
||||
ExtrusionEntityCollection flatten() const;
|
||||
double min_mm3_per_mm() const;
|
||||
double total_volume() const override { double volume=0.; for (const auto& ent : entities) volume+=ent->total_volume(); return volume; }
|
||||
|
|
Loading…
Reference in a new issue