Trying to improve pillar connectivity.
This commit is contained in:
parent
878ac7f1b0
commit
f2f513dd3e
1 changed files with 35 additions and 28 deletions
|
@ -1218,7 +1218,7 @@ class SLASupportTree::Algorithm {
|
||||||
|
|
||||||
// Helper function for interconnecting two pillars with zig-zag bridges.
|
// Helper function for interconnecting two pillars with zig-zag bridges.
|
||||||
// This is not an individual step.
|
// This is not an individual step.
|
||||||
void interconnect(const Pillar& pillar, const Pillar& nextpillar)
|
bool interconnect(const Pillar& pillar, const Pillar& nextpillar)
|
||||||
{
|
{
|
||||||
const Head& phead = m_result.pillar_head(pillar.id);
|
const Head& phead = m_result.pillar_head(pillar.id);
|
||||||
const Head& nextphead = m_result.pillar_head(nextpillar.id);
|
const Head& nextphead = m_result.pillar_head(nextpillar.id);
|
||||||
|
@ -1234,16 +1234,18 @@ class SLASupportTree::Algorithm {
|
||||||
double chkd = bridge_mesh_intersect(sj, dirv(sj, ej), pillar.r);
|
double chkd = bridge_mesh_intersect(sj, dirv(sj, ej), pillar.r);
|
||||||
|
|
||||||
double bridge_distance = pillar_dist / std::cos(-m_cfg.bridge_slope);
|
double bridge_distance = pillar_dist / std::cos(-m_cfg.bridge_slope);
|
||||||
|
bool was_connected = false;
|
||||||
|
|
||||||
// If the pillars are so close that they touch each other,
|
// If the pillars are so close that they touch each other,
|
||||||
// there is no need to bridge them together.
|
// there is no need to bridge them together.
|
||||||
if(pillar_dist > 2*m_cfg.head_back_radius_mm &&
|
if(pillar_dist > 2*m_cfg.head_back_radius_mm &&
|
||||||
bridge_distance < m_cfg.max_bridge_length_mm)
|
bridge_distance < m_cfg.max_bridge_length_mm) {
|
||||||
while(sj(Z) > pillar.endpoint(Z) + m_cfg.base_radius_mm &&
|
while(sj(Z) > pillar.endpoint(Z) + m_cfg.base_radius_mm &&
|
||||||
ej(Z) > nextpillar.endpoint(Z) + m_cfg.base_radius_mm)
|
ej(Z) > nextpillar.endpoint(Z) + m_cfg.base_radius_mm)
|
||||||
{
|
{
|
||||||
if(chkd >= bridge_distance) {
|
if(chkd >= bridge_distance) {
|
||||||
m_result.add_bridge(sj, ej, pillar.r);
|
m_result.add_bridge(sj, ej, pillar.r);
|
||||||
|
was_connected = true;
|
||||||
|
|
||||||
auto pcm = m_cfg.pillar_connection_mode;
|
auto pcm = m_cfg.pillar_connection_mode;
|
||||||
|
|
||||||
|
@ -1273,6 +1275,9 @@ class SLASupportTree::Algorithm {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return was_connected;
|
||||||
|
}
|
||||||
|
|
||||||
long search_nearest(const Vec3d& querypoint)
|
long search_nearest(const Vec3d& querypoint)
|
||||||
{
|
{
|
||||||
SpatIndex spindex = m_pillar_index;
|
SpatIndex spindex = m_pillar_index;
|
||||||
|
@ -1737,12 +1742,14 @@ public:
|
||||||
// fashioned connections between pillars
|
// fashioned connections between pillars
|
||||||
for(unsigned i : ring) { m_thr();
|
for(unsigned i : ring) { m_thr();
|
||||||
const Pillar& outerpill = m_result.head_pillar(i);
|
const Pillar& outerpill = m_result.head_pillar(i);
|
||||||
auto res = innerring.nearest(outerpill.endpoint, 1);
|
|
||||||
if(res.empty()) continue;
|
|
||||||
|
|
||||||
auto ne = res.front();
|
auto res = innerring.nearest(outerpill.endpoint,
|
||||||
|
unsigned(innerring.size()));
|
||||||
|
|
||||||
|
for(auto& ne : res) {
|
||||||
const Pillar& innerpill = m_result.pillars()[ne.second];
|
const Pillar& innerpill = m_result.pillars()[ne.second];
|
||||||
interconnect(outerpill, innerpill);
|
if(interconnect(outerpill, innerpill)) break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue