Commit cb2c8cc7 by JasonChmn

### Fix (in)equalities with double, tests OK

parent 5467cb74
 ... ... @@ -6,7 +6,6 @@ * \date 06/17/2013 */ #ifndef _BEZIER_POLY_CONVERSION #define _BEZIER_POLY_CONVERSION ... ... @@ -23,9 +22,6 @@ namespace curves { /// \brief Provides methods for converting a curve from a bernstein representation /// to a polynomial representation. /// /// \brief Converts a Bezier curve to a polynomial. /// \param bezier : the Bezier curve to convert. ... ... @@ -35,8 +31,6 @@ Polynomial from_bezier(const Bezier& curve) { typedef typename Polynomial::t_point_t t_point_t; typedef typename Polynomial::num_t num_t; assert (curve.min() == 0.); assert (curve.max() == 1.); t_point_t coefficients; Bezier current (curve); coefficients.push_back(curve(0.)); ... ...
 ... ... @@ -37,7 +37,9 @@ typedef std::vector T_WaypointOne; typedef cubic_hermite_spline cubic_hermite_spline_t; typedef std::pair Pair_point_tangent; bool QuasiEqual(const double a, const double b, const float margin) const double margin = 0.001; bool QuasiEqual(const double a, const double b) { if ((a <= 0 && b <= 0) || (a >= 0 && b>= 0)) { ... ... @@ -49,8 +51,6 @@ bool QuasiEqual(const double a, const double b, const float margin) } } const double margin = 0.001; } // namespace curves using namespace curves; ... ... @@ -131,15 +131,15 @@ void CubicFunctionTest(bool& error) { std::cout << "Evaluation of cubic cf2 error, 1.1 should be an out of range value\n"; } if(cf.max() != 1) if(not QuasiEqual(cf.max(), 1.0)) { error = true; std::cout << "Evaluation of exactCubic error, MaxBound should be equal to 1\n"; } if(cf.min() != 0) if(not QuasiEqual(cf.min(), 0.0)) { error = true; std::cout << "Evaluation of exactCubic error, MinBound should be equal to 1\n"; std::cout << "Evaluation of exactCubic error, MinBound should be equal to 0\n"; } } ... ... @@ -227,12 +227,12 @@ void BezierCurveTest(bool& error) std::cout << "Evaluation of bezier cf error, 1.1 should be an out of range value\n"; error = true; } if(cf.max() != 1) if(not QuasiEqual(cf.max(), 1)) { error = true; std::cout << "Evaluation of bezier cf error, MaxBound should be equal to 1\n"; } if(cf.min() != 0) if(not QuasiEqual(cf.min(), 0)) { error = true; std::cout << "Evaluation of bezier cf error, MinBound should be equal to 1\n"; ... ... @@ -491,15 +491,15 @@ void ExactCubicNoErrorTest(bool& error) { std::cout << "Evaluation of exactCubic cf error, 1.2 should be an out of range value\n"; } if(exactCubic.max() != 1) if(not QuasiEqual(exactCubic.max(), 1.0)) { error = true; std::cout << "Evaluation of exactCubic error, MaxBound should be equal to 1\n"; } if(exactCubic.min() != 0) if(not QuasiEqual(exactCubic.min(), 0.0)) { error = true; std::cout << "Evaluation of exactCubic error, MinBound should be equal to 1\n"; std::cout << "Evaluation of exactCubic error, MinBound should be equal to 0\n"; } } ... ... @@ -760,22 +760,22 @@ void TestReparametrization(bool& error) { helpers::rotation_spline s; const helpers::spline_deriv_constraint_one_dim& sp = s.time_reparam_; if(sp.min() != 0) if(not QuasiEqual(sp.min(), 0.0)) { std::cout << "in TestReparametrization; min value is not 0, got " << sp.min() << std::endl; error = true; } if(sp.max() != 1) if(not QuasiEqual(sp.max(), 1.0)) { std::cout << "in TestReparametrization; max value is not 1, got " << sp.max() << std::endl; error = true; } if(sp(1)[0] != 1.) if(not QuasiEqual(sp(1)[0], 1.)) { std::cout << "in TestReparametrization; end value is not 1, got " << sp(1)[0] << std::endl; error = true; } if(sp(0)[0] != 0.) if(not QuasiEqual(sp(0)[0], 0.)) { std::cout << "in TestReparametrization; init value is not 0, got " << sp(0)[0] << std::endl; error = true; ... ... @@ -892,7 +892,7 @@ void BezierSplitCurve(bool& error) std::cout<<" Degree of the splitted curve are not the same as the original curve"<
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