This commit is contained in:
Filip Sykala - NTB T15p 2023-01-27 09:30:20 +01:00
commit 809e22092d
2 changed files with 10 additions and 9 deletions

View File

@ -615,7 +615,7 @@ public:
static double nil_value() { return std::numeric_limits<double>::quiet_NaN(); }
// A scalar is nil, or all values of a vector are nil.
bool is_nil() const override { for (auto v : this->values) if (! std::isnan(v)) return false; return true; }
bool is_nil(size_t idx) const override { return std::isnan(this->values[idx]); }
bool is_nil(size_t idx) const override { return std::isnan(this->values[idx < values.size() ? idx : 0]); }
std::string serialize() const override
{
@ -1092,7 +1092,7 @@ public:
static FloatOrPercent nil_value() { return { std::numeric_limits<double>::quiet_NaN(), false }; }
// A scalar is nil, or all values of a vector are nil.
bool is_nil() const override { for (auto v : this->values) if (! std::isnan(v.value)) return false; return true; }
bool is_nil(size_t idx) const override { return std::isnan(this->values[idx].value); }
bool is_nil(size_t idx) const override { return std::isnan(this->values[idx < values.size() ? idx : 0].value); }
std::string serialize() const override
{
@ -1404,7 +1404,7 @@ public:
static unsigned char nil_value() { return std::numeric_limits<unsigned char>::max(); }
// A scalar is nil, or all values of a vector are nil.
bool is_nil() const override { for (auto v : this->values) if (v != nil_value()) return false; return true; }
bool is_nil(size_t idx) const override { return this->values[idx] == nil_value(); }
bool is_nil(size_t idx) const override { return this->values[idx < values.size() ? idx : 0] == nil_value(); }
bool& get_at(size_t i) {
assert(! this->values.empty());

View File

@ -68,13 +68,14 @@ indexed_triangle_set create_pad(const SupportableMesh &sm,
const indexed_triangle_set &support_mesh,
const JobController &ctl)
{
constexpr float PadSamplingLH = 0.1f;
ExPolygons model_contours; // This will store the base plate of the pad.
double pad_h = sm.pad_cfg.full_height();
float zstart = ground_level(sm);
float zend = zstart + float(pad_h + EPSILON);
auto heights = grid(zstart, zend, 0.1f);
double pad_h = sm.pad_cfg.full_height();
auto gndlvl = float(ground_level(sm));
float zstart = gndlvl - bool(sm.pad_cfg.embed_object) * sm.pad_cfg.wall_thickness_mm;
float zend = zstart + float(pad_h + PadSamplingLH + EPSILON);
auto heights = grid(zstart, zend, PadSamplingLH);
if (!sm.cfg.enabled || sm.pad_cfg.embed_object) {
// No support (thus no elevation) or zero elevation mode
@ -91,7 +92,7 @@ indexed_triangle_set create_pad(const SupportableMesh &sm,
indexed_triangle_set out;
create_pad(sup_contours, model_contours, out, sm.pad_cfg);
Vec3f offs{.0f, .0f, zstart};
Vec3f offs{.0f, .0f, gndlvl};
for (auto &p : out.vertices) p += offs;
its_merge_vertices(out);