Skip to content
Snippets Groups Projects
Commit 48958240 authored by Sergi Hernandez's avatar Sergi Hernandez
Browse files

Made more robust the function to evaluate a spline at a given distance.

parent 2edaab74
No related branches found
No related tags found
1 merge request!2Solved a bug when creating a new geometry object: the sale factor is...
...@@ -865,8 +865,12 @@ void CG2Spline::generate(double &resolution,double n1,double n2, double n3, doub ...@@ -865,8 +865,12 @@ void CG2Spline::generate(double &resolution,double n1,double n2, double n3, doub
bool CG2Spline::evaluate(double length, TPoint& point) bool CG2Spline::evaluate(double length, TPoint& point)
{ {
if (length < 0.0 || length > this->length[this->num_points-1]) if (length < -this->resolution || length > (this->length[this->num_points-1]+this->resolution))
return false; return false;
else if(length<0.0)
length=0.0;
else if(length>this->length[this->num_points-1])
length=this->length[this->num_points-1];
point = this->evaluate_parameter(this->find_parameter(length)); point = this->evaluate_parameter(this->find_parameter(length));
return true; return true;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment