Trying to engage support creation when the gizmo gets disabled.

This commit is contained in:
tamasmeszaros 2018-11-06 18:01:18 +01:00
parent a49b506121
commit 22c9c5ae95
11 changed files with 76 additions and 33 deletions

View file

@ -64,11 +64,6 @@ struct Contour3D {
}
};
struct EigenMesh3D {
Eigen::MatrixXd V;
Eigen::MatrixXi F;
};
using PointSet = Eigen::MatrixXd;
using ClusterEl = std::vector<unsigned>;
using ClusteredPoints = std::vector<ClusterEl>;

View file

@ -4,6 +4,7 @@
#include <libnest2d/optimizers/nlopt/genetic.hpp>
#include "SLABoilerPlate.hpp"
#include "SLARotfinder.hpp"
#include "SLASupportTree.hpp"
#include "Model.hpp"
namespace Slic3r {

View file

@ -1209,6 +1209,7 @@ bool SLASupportTree::generate(const PointSet &points,
(SpatIndex& spindex, const Vec3d& jsh)
{
long nearest_id = -1;
const double max_len = maxbridgelen / 2;
while(nearest_id < 0 && !spindex.empty()) {
// loop until a suitable head is not found
// if there is a pillar closer than the cluster center
@ -1227,16 +1228,14 @@ bool SLASupportTree::generate(const PointSet &points,
Vec3d jn(jh(X), jh(Y), jp(Z) + dist2d*std::tan(-cfg.tilt));
if(jn(Z) > jh(Z)) {
// if the main head is below the point where the bridge
// would connect, than we must adjust the bridge
// endpoints
double hdiff = jn(Z) - jh(Z);
jp(Z) -= hdiff;
jn(Z) -= hdiff;
// If the sidepoint cannot connect to the pillar from
// its head junction, then just skip this pillar.
spindex.remove(ne);
continue;
}
double d = distance(jp, jn);
if(jn(Z) <= 0 || d > maxbridgelen) break;
if(jn(Z) <= 0 || d > max_len) break;
double chkd = ray_mesh_intersect(jp, dirv(jp, jn), emesh);
if(chkd >= d) nearest_id = ne.second;

View file

@ -63,6 +63,13 @@ struct Controller {
std::function<bool(void)> stopcondition = [](){ return false; };
};
struct EigenMesh3D {
Eigen::MatrixXd V;
Eigen::MatrixXi F;
};
using PointSet = Eigen::MatrixXd;
/* ************************************************************************** */
/* TODO: May not be needed: */
/* ************************************************************************** */
@ -73,10 +80,10 @@ void create_head(TriangleMesh&, double r1_mm, double r2_mm, double width_mm);
void add_sla_supports(Model& model, const SupportConfig& cfg = {},
const Controller& ctl = {});
/* ************************************************************************** */
EigenMesh3D to_eigenmesh(const Model& model);
PointSet support_points(const Model& model);
using PointSet = Eigen::MatrixXd;
struct EigenMesh3D;
/* ************************************************************************** */
/// Just a wrapper to the runtime error to be recognizable in try blocks
class SLASupportsStoppedException: public std::runtime_error {