Trying to improve pillar connectivity.
This commit is contained in:
parent
878ac7f1b0
commit
f2f513dd3e
@ -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,43 +1234,48 @@ 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;
|
||||||
|
|
||||||
// double bridging: (crosses)
|
// double bridging: (crosses)
|
||||||
if( pcm == PillarConnectionMode::cross ||
|
if( pcm == PillarConnectionMode::cross ||
|
||||||
(pcm == PillarConnectionMode::dynamic &&
|
(pcm == PillarConnectionMode::dynamic &&
|
||||||
pillar_dist > 2*m_cfg.base_radius_mm))
|
pillar_dist > 2*m_cfg.base_radius_mm))
|
||||||
{
|
{
|
||||||
// If the columns are close together, no need to
|
// If the columns are close together, no need to
|
||||||
// double bridge them
|
// double bridge them
|
||||||
Vec3d bsj(ej(X), ej(Y), sj(Z));
|
Vec3d bsj(ej(X), ej(Y), sj(Z));
|
||||||
Vec3d bej(sj(X), sj(Y), ej(Z));
|
Vec3d bej(sj(X), sj(Y), ej(Z));
|
||||||
|
|
||||||
// need to check collision for the cross stick
|
// need to check collision for the cross stick
|
||||||
double backchkd = bridge_mesh_intersect(
|
double backchkd = bridge_mesh_intersect(
|
||||||
bsj, dirv(bsj, bej), pillar.r);
|
bsj, dirv(bsj, bej), pillar.r);
|
||||||
|
|
||||||
|
|
||||||
if(backchkd >= bridge_distance) {
|
if(backchkd >= bridge_distance) {
|
||||||
m_result.add_bridge(bsj, bej, pillar.r);
|
m_result.add_bridge(bsj, bej, pillar.r);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sj.swap(ej);
|
||||||
|
ej(Z) = sj(Z) + zstep;
|
||||||
|
chkd = bridge_mesh_intersect(sj, dirv(sj, ej), pillar.r);
|
||||||
}
|
}
|
||||||
sj.swap(ej);
|
|
||||||
ej(Z) = sj(Z) + zstep;
|
|
||||||
chkd = bridge_mesh_intersect(sj, dirv(sj, ej), pillar.r);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return was_connected;
|
||||||
}
|
}
|
||||||
|
|
||||||
long search_nearest(const Vec3d& querypoint)
|
long search_nearest(const Vec3d& querypoint)
|
||||||
@ -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,
|
||||||
const Pillar& innerpill = m_result.pillars()[ne.second];
|
unsigned(innerring.size()));
|
||||||
interconnect(outerpill, innerpill);
|
|
||||||
|
for(auto& ne : res) {
|
||||||
|
const Pillar& innerpill = m_result.pillars()[ne.second];
|
||||||
|
if(interconnect(outerpill, innerpill)) break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user