better (correct) boundary conditions for layer height spline

This commit is contained in:
Florens Wasserfall 2017-06-21 15:16:02 +02:00
parent a386136c31
commit 49a5f7e9a4
2 changed files with 14 additions and 3 deletions

View File

@ -170,9 +170,18 @@ bool LayerHeightSpline::_updateBSpline()
bool result = false;
//TODO: exception if not enough points?
this->_layer_height_spline.reset(new BSpline<double>(&this->_layers[1],
this->_layers.size()-1,
&this->_layer_heights[1],
// copy layer vectors and duplicate a datapoint at the front / end to achieve correct boundary conditions
this->_spline_layers = this->_layers;
this->_spline_layers[0] = 0;
this->_spline_layers.push_back(this->_spline_layers.back()+1);
this->_spline_layer_heights = this->_layer_heights;
this->_spline_layer_heights[0] = this->_spline_layer_heights[1]; // override fixed first layer height with first "real" layer
this->_spline_layer_heights.push_back(this->_spline_layer_heights.back());
this->_layer_height_spline.reset(new BSpline<double>(&this->_spline_layers[0],
this->_spline_layers.size(),
&this->_spline_layer_heights[0],
0,
1,
0)

View File

@ -33,6 +33,8 @@ class LayerHeightSpline
bool _layer_heights_updated;
std::vector<coordf_t> _layers;
std::vector<coordf_t> _layer_heights;
std::vector<coordf_t> _spline_layers;
std::vector<coordf_t> _spline_layer_heights;
std::unique_ptr<BSpline<double>> _layer_height_spline;
};