SLA backround processing pipeline invisible but runs.

This commit is contained in:
tamasmeszaros 2018-11-12 11:46:38 +01:00
parent e05063c8b1
commit 33eade5300
4 changed files with 26 additions and 13 deletions

View File

@ -924,6 +924,11 @@ bool SLASupportTree::generate(const PointSet &points,
//... //...
}; };
// Debug:
for(int pn = 0; pn < points.rows(); ++pn) {
std::cout << "p " << pn << " " << points.row(pn) << std::endl;
}
auto filterfn = [] ( auto filterfn = [] (
const SupportConfig& cfg, const SupportConfig& cfg,
const PointSet& points, const PointSet& points,
@ -1511,7 +1516,7 @@ bool SLASupportTree::generate(const PointSet &points,
auto progress = [&ctl, &pc, &pc_prev] () { auto progress = [&ctl, &pc, &pc_prev] () {
static const std::array<std::string, NUM_STEPS> stepstr { static const std::array<std::string, NUM_STEPS> stepstr {
"", "Starting",
"Filtering", "Filtering",
"Generate pinheads", "Generate pinheads",
"Classification", "Classification",

View File

@ -74,13 +74,16 @@ struct Controller {
/// An index-triangle structure for libIGL functions. Also serves as an /// An index-triangle structure for libIGL functions. Also serves as an
/// alternative (raw) input format for the SLASupportTree /// alternative (raw) input format for the SLASupportTree
struct EigenMesh3D { struct EigenMesh3D {
// Eigen::MatrixXd V; Eigen::MatrixXd V;
// Eigen::MatrixXi F; Eigen::MatrixXi F;
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::DontAlign> V;
Eigen::Matrix<int, Eigen::Dynamic, Eigen::Dynamic, Eigen::DontAlign> F; // igl crashes with the following data types:
// Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::DontAlign> V;
// Eigen::Matrix<int, Eigen::Dynamic, Eigen::Dynamic, Eigen::DontAlign> F;
}; };
using PointSet = Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::DontAlign>; //Eigen::MatrixXd; //using PointSet = Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::DontAlign>; //Eigen::MatrixXd;
using PointSet = Eigen::MatrixXd;
/* ************************************************************************** */ /* ************************************************************************** */
/* TODO: May not be needed: */ /* TODO: May not be needed: */

View File

@ -84,11 +84,11 @@ size_t SpatIndex::size() const
} }
PointSet normals(const PointSet& points, const EigenMesh3D& mesh) { PointSet normals(const PointSet& points, const EigenMesh3D& mesh) {
// Eigen::VectorXd dists;
// Eigen::VectorXi I;
#ifdef IGL_COMPATIBLE #ifdef IGL_COMPATIBLE
Eigen::Matrix<double, Eigen::Dynamic, 1, Eigen::DontAlign> dists; Eigen::VectorXd dists;
Eigen::Matrix<int, Eigen::Dynamic, 1, Eigen::DontAlign> I; Eigen::VectorXi I;
// Eigen::Matrix<double, Eigen::Dynamic, 1, Eigen::DontAlign> dists;
// Eigen::Matrix<int, Eigen::Dynamic, 1, Eigen::DontAlign> I;
PointSet C; PointSet C;
igl::point_mesh_squared_distance( points, mesh.V, mesh.F, dists, I, C); igl::point_mesh_squared_distance( points, mesh.V, mesh.F, dists, I, C);

View File

@ -66,14 +66,17 @@ void SLAPrint::clear()
SLAPrint::ApplyStatus SLAPrint::apply(const Model &model, SLAPrint::ApplyStatus SLAPrint::apply(const Model &model,
const DynamicPrintConfig &config) const DynamicPrintConfig &config)
{ {
if (m_objects.empty()) // if (m_objects.empty())
return APPLY_STATUS_UNCHANGED; // return APPLY_STATUS_UNCHANGED;
// Grab the lock for the Print / PrintObject milestones. // Grab the lock for the Print / PrintObject milestones.
tbb::mutex::scoped_lock lock(this->cancel_mutex()); tbb::mutex::scoped_lock lock(this->cancel_mutex());
if(m_objects.empty() && model.objects.empty())
return APPLY_STATUS_UNCHANGED;
// Temporary quick fix, just invalidate everything. // Temporary quick fix, just invalidate everything.
{ {
std::cout << "deleting object cache " << std::endl;
for (SLAPrintObject *print_object : m_objects) { for (SLAPrintObject *print_object : m_objects) {
print_object->invalidate_all_steps(); print_object->invalidate_all_steps();
delete print_object; delete print_object;
@ -89,7 +92,7 @@ SLAPrint::ApplyStatus SLAPrint::apply(const Model &model,
//TODO //TODO
m_objects.emplace_back(new SLAPrintObject(this, model_object)); m_objects.emplace_back(new SLAPrintObject(this, model_object));
} }
} }
return APPLY_STATUS_INVALIDATED; return APPLY_STATUS_INVALIDATED;
} }
@ -200,6 +203,8 @@ SLAPrintObject::SLAPrintObject(SLAPrint *print, ModelObject *model_object):
m_stepmask(slaposCount, true) m_stepmask(slaposCount, true)
{ {
m_supportdata->emesh = sla::to_eigenmesh(*m_model_object); m_supportdata->emesh = sla::to_eigenmesh(*m_model_object);
m_supportdata->support_points = sla::support_points(*m_model_object);
std::cout << "support points copied " << m_supportdata->support_points.rows() << std::endl;
} }
SLAPrintObject::~SLAPrintObject() {} SLAPrintObject::~SLAPrintObject() {}