Commit 13cc4d5e authored by Pierre Fernbach's avatar Pierre Fernbach
Browse files

[Tests] update to changes in compute_derivate and compute_derivate_ptr

parent 29e6b634
......@@ -145,17 +145,17 @@ void PolynomialCubicFunctionTest(bool& error) {
}
// Test derivate and compute_derivative
// Order 1
curve_abc_t* cf_derivated = cf.compute_derivate(1);
curve_abc_t* cf_derivated = cf.compute_derivate_ptr(1);
ComparePoints(cf.derivate(0, 1), (*cf_derivated)(0), errMsg + " - derivate order 1 : ", error);
ComparePoints(cf.derivate(0.3, 1), (*cf_derivated)(0.3), errMsg + " - derivate order 1 : ", error);
ComparePoints(cf.derivate(0.5, 1), (*cf_derivated)(0.5), errMsg + " - derivate order 1 : ", error);
ComparePoints(cf.derivate(1, 1), (*cf_derivated)(1), errMsg + " - derivate order 1 : ", error);
// Order 2
curve_abc_t* cf_derivated_2 = cf.compute_derivate(2);
ComparePoints(cf.derivate(0, 2), (*cf_derivated_2)(0), errMsg + " - derivate order 1 : ", error);
ComparePoints(cf.derivate(0.3, 2), (*cf_derivated_2)(0.3), errMsg + " - derivate order 1 : ", error);
ComparePoints(cf.derivate(0.5, 2), (*cf_derivated_2)(0.5), errMsg + " - derivate order 1 : ", error);
ComparePoints(cf.derivate(1, 2), (*cf_derivated_2)(1), errMsg + " - derivate order 1 : ", error);
polynomial_t cf_derivated_2 = cf.compute_derivate(2);
ComparePoints(cf.derivate(0, 2), (cf_derivated_2)(0), errMsg + " - derivate order 1 : ", error);
ComparePoints(cf.derivate(0.3, 2), (cf_derivated_2)(0.3), errMsg + " - derivate order 1 : ", error);
ComparePoints(cf.derivate(0.5, 2), (cf_derivated_2)(0.5), errMsg + " - derivate order 1 : ", error);
ComparePoints(cf.derivate(1, 2), (cf_derivated_2)(1), errMsg + " - derivate order 1 : ", error);
}
/*bezier_curve Function tests*/
......@@ -197,14 +197,14 @@ void BezierCurveTest(bool& error) {
// testing bernstein polynomials
bezier_t cf5(params.begin(), params.end(), 1., 2.);
std::string errMsg2("In test BezierCurveTest ; Bernstein polynomials do not evaluate as analytical evaluation");
bezier_t* cf5_derivated = cf5.compute_derivate(1);
bezier_t cf5_derivated = cf5.compute_derivate(1);
for (double d = 1.; d < 2.; d += 0.1) {
ComparePoints(cf5.evalBernstein(d), cf5(d), errMsg2, error);
ComparePoints(cf5.evalHorner(d), cf5(d), errMsg2, error);
ComparePoints(cf5_derivated->evalBernstein(d), cf5_derivated->operator()(d), errMsg2, error);
ComparePoints(cf5_derivated->evalHorner(d), cf5_derivated->operator()(d), errMsg2, error);
ComparePoints(cf5.derivate(d,1), cf5_derivated->operator()(d), errMsg2, error);
ComparePoints(cf5_derivated.evalBernstein(d), cf5_derivated(d), errMsg2, error);
ComparePoints(cf5_derivated.evalHorner(d), cf5_derivated(d), errMsg2, error);
ComparePoints(cf5.derivate(d,1), cf5_derivated(d), errMsg2, error);
}
bool error_in(true);
......@@ -483,7 +483,7 @@ void cubicConversionTest(bool& error) {
CompareCurves<bezier_t, cubic_hermite_spline_t>(bc0, chs2, errMsg1, error);
// Test : compute derivative of bezier => Convert it to polynomial
curve_abc_t* bc_der = bc0.compute_derivate(1);
curve_abc_t* bc_der = bc0.compute_derivate_ptr(1);
polynomial_t pol_test = polynomial_from_curve<polynomial_t>(*bc_der);
CompareCurves<curve_abc_t, polynomial_t>(*bc_der, pol_test, errMsg1, error);
}
......@@ -1203,8 +1203,8 @@ void piecewiseCurveTest(bool& error) {
// compare compute_derivate and derivate results :
curve_abc_t* pc_C2_derivate = pc_C2.compute_derivate(1);
curve_abc_t* pc_C2_derivate2 = pc_C2.compute_derivate(2);
curve_abc_t* pc_C2_derivate = pc_C2.compute_derivate_ptr(1);
curve_abc_t* pc_C2_derivate2 = pc_C2.compute_derivate_ptr(2);
if (pc_C2.min() != pc_C2_derivate->min()) {
error = true;
std::cout << "min bounds for curve and it's derivate are not equals." << std::endl;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment