Add method for bridge addition with Head parameter to fill the bridge_id

This commit is contained in:
tamasmeszaros 2019-10-03 10:22:25 +02:00
parent 3f698c4ccf
commit 95e22d8fd4
2 changed files with 25 additions and 7 deletions

View File

@ -208,6 +208,11 @@ struct Bridge {
const Vec3d &j2,
double r_mm = 0.8,
size_t steps = 45);
Bridge(const Head &h,
const Vec3d &j2,
size_t steps = 45)
: Bridge{h.junction_point(), j2, h.r_back_mm, steps} {}
};
// A bridge that spans from model surface to model surface with small connecting
@ -378,9 +383,23 @@ public:
return m_junctions.back();
}
template<class...Args> const Bridge& add_bridge(Args&&... args)
template<class...Args> const Bridge&
add_bridge(const Vec3d &sp, const Vec3d &ep, double r, size_t steps = 45)
{
return _add_bridge(m_bridges, std::forward<Args>(args)...);
return _add_bridge(m_bridges, sp, ep, r, steps);
}
template<class...Args>
const Bridge& add_bridge(const Head &h, const Vec3d &endp, size_t steps = 45)
{
std::lock_guard<Mutex> lk(m_mutex);
m_bridges.emplace_back(h, endp, steps);
m_bridges.back().id = long(m_bridges.size() - 1);
assert(h.id >= 0 && h.id < m_head_indices.size());
m_heads[m_head_indices[size_t(h.id)]].bridge_id = m_bridges.back().id;
m_meshcache_valid = false;
return m_bridges.back();
}
template<class...Args> const Bridge& add_crossbridge(Args&&... args)

View File

@ -582,7 +582,7 @@ void SupportTreeBuildsteps::create_ground_pillar(const Vec3d &jp,
// the ground level only.
normal_mode = false;
double mind = min_dist - dist;
double mind = min_dist - dist;
double azimuth = std::atan2(sourcedir(Y), sourcedir(X));
double sinpolar = std::sin(PI - m_cfg.bridge_slope);
double cospolar = std::cos(PI - m_cfg.bridge_slope);
@ -964,12 +964,11 @@ void SupportTreeBuildsteps::routing_to_model()
auto routedown = [this](Head& head, const Vec3d& dir, double dist)
{
head.transform();
Vec3d hjp = head.junction_point();
Vec3d endp = hjp + dist * dir;
m_builder.add_bridge(hjp, endp, head.r_back_mm);
Vec3d endp = head.junction_point() + dist * dir;
m_builder.add_bridge(head, endp);
m_builder.add_junction(endp, head.r_back_mm);
this->create_ground_pillar(endp, dir, head.r_back_mm, head.id);
this->create_ground_pillar(endp, dir, head.r_back_mm);
};
std::vector<unsigned> modelpillars;