Refactor model facing support generation.

Fix for touching junction when adding aux pillars.


Fix issue with overly long support bridges.
This commit is contained in:
tamasmeszaros 2020-01-14 10:32:30 +01:00
parent 45220e26c0
commit 90fbbf401f
2 changed files with 164 additions and 193 deletions

View file

@ -35,6 +35,17 @@ inline Vec3d spheric_to_dir(double polar, double azimuth)
std::sin(azimuth) * std::sin(polar), std::cos(polar)};
}
inline Vec3d spheric_to_dir(const std::tuple<double, double> &v)
{
auto [plr, azm] = v;
return spheric_to_dir(plr, azm);
}
inline Vec3d spheric_to_dir(const std::pair<double, double> &v)
{
return spheric_to_dir(v.first, v.second);
}
// This function returns the position of the centroid in the input 'clust'
// vector of point indices.
template<class DistFn>
@ -166,10 +177,10 @@ class SupportTreeBuildsteps {
using PtIndices = std::vector<unsigned>;
PtIndices m_iheads; // support points with pinhead
PtIndices m_iheads_onmodel;
PtIndices m_iheadless; // headless support points
// supp. pts. connecting to model: point index and the ray hit data
std::vector<std::pair<unsigned, EigenMesh3D::hit_result>> m_iheads_onmodel;
std::map<unsigned, EigenMesh3D::hit_result> m_head_to_ground_scans;
// normals for support points from model faces.
PointSet m_support_nmls;
@ -238,9 +249,18 @@ class SupportTreeBuildsteps {
// For connecting a head to a nearby pillar.
bool connect_to_nearpillar(const Head& head, long nearpillar_id);
// Find route for a head to the ground. Inserts additional bridge from the
// head to the pillar if cannot create pillar directly.
// The optional dir parameter is the direction of the bridge which is the
// direction of the pinhead if omitted.
bool connect_to_ground(Head& head, const Vec3d &dir);
inline bool connect_to_ground(Head& head);
bool connect_to_model_body(Head &head);
bool search_pillar_and_connect(const Head& head);
// This is a proxy function for pillar creation which will mind the gap
// between the pad and the model bottom in zero elevation mode.
// jp is the starting junction point which needs to be routed down.
@ -250,6 +270,8 @@ class SupportTreeBuildsteps {
const Vec3d &sourcedir,
double radius,
long head_id = ID_UNSET);
public:
SupportTreeBuildsteps(SupportTreeBuilder & builder, const SupportableMesh &sm);