Commit 3f628465 authored by JasonChmn's avatar JasonChmn Committed by Pierre Fernbach
Browse files

[Dynamic dim - hermite] Remove dimension from template

parent 49a95d7f
......@@ -30,7 +30,7 @@ namespace curves
/// - crosses each of the waypoint given in its initialization (\f$P_0\f$, \f$P_1\f$,...,\f$P_N\f$).
/// - has its derivatives on \f$P_i\f$ and \f$P_{i+1}\f$ are \f$p'(t_{P_i}) = m_i\f$ and \f$p'(t_{P_{i+1}}) = m_{i+1}\f$.
///
template<typename Time= double, typename Numeric=Time, std::size_t Dim=3, bool Safe=false,
template<typename Time= double, typename Numeric=Time, bool Safe=false,
typename Point= Eigen::Matrix<Numeric, Eigen::Dynamic, 1> >
struct cubic_hermite_spline : public curve_abc<Time, Numeric, Safe, Point>
{
......
......@@ -36,7 +36,7 @@ typedef std::vector<pair_point3_tangent_t,Eigen::aligned_allocator<pair_point3_t
typedef curves::bezier_curve <real, real, 3, true, point3_t> bezier3_t;
typedef curves::polynomial <real, real, 3, true, point3_t, t_point3_t> polynomial3_t;
typedef curves::exact_cubic <real, real, 3, true, point3_t, t_point3_t> exact_cubic3_t;
typedef curves::cubic_hermite_spline <real, real, 3, true, point3_t> cubic_hermite_spline3_t;
typedef curves::cubic_hermite_spline <real, real, true, point3_t> cubic_hermite_spline3_t;
typedef polynomial3_t::coeff_t coeff_t;
typedef std::pair<real, point3_t> waypoint3_t;
typedef std::vector<waypoint3_t, Eigen::aligned_allocator<point3_t> > t_waypoint3_t;
......
......@@ -129,6 +129,22 @@ class TestCurves(unittest.TestCase):
b.loadFromText("serialization_curve.test")
self.assertTrue((a(0.4) == b(0.4)).all())
os.remove("serialization_curve.test")
# test dim 4
points = matrix([[1., 2., 3., 4.], [4., 5., 6., 7.]]).transpose()
tangents = matrix([[1., 2., 3., 4.], [4., 5., 6., 7.]]).transpose()
time_points = matrix([0., 1.]).transpose()
a = cubic_hermite_spline3(points, tangents, time_points)
a.min()
a.max()
a(0.4)
self.assertTrue((a.derivate(0.4, 0) == a(0.4)).all())
a.derivate(0.4, 2)
# Test serialization
a.saveAsText("serialization_curve.test")
b = cubic_hermite_spline3()
b.loadFromText("serialization_curve.test")
self.assertTrue((a(0.4) == b(0.4)).all())
os.remove("serialization_curve.test")
return
def test_piecewise_polynomial_curve(self):
......
......@@ -32,7 +32,7 @@ namespace curves
typedef exact_cubic <double, double, 1, true, point_one> exact_cubic_one;
typedef std::pair<double, point_one> WaypointOne;
typedef std::vector<WaypointOne> T_WaypointOne;
typedef cubic_hermite_spline <double, double, 3, true, point_t> cubic_hermite_spline_t;
typedef cubic_hermite_spline <double, double, true, point_t> cubic_hermite_spline_t;
typedef std::pair<point_t, tangent_t> pair_point_tangent_t;
typedef std::vector<pair_point_tangent_t,Eigen::aligned_allocator<pair_point_tangent_t> > t_pair_point_tangent_t;
typedef piecewise_curve <double, double, 3, true, point_t, t_point_t, polynomial_t> piecewise_polynomial_curve_t;
......@@ -1245,7 +1245,7 @@ void curveAbcDimDynamicTest(bool& error)
typedef exact_cubic <double, double, 3, true> exact_cubic_test_t;
typedef exact_cubic_test_t::spline_constraints spline_constraints_test_t;
typedef bezier_curve <double, double, 3, true> bezier_curve_test_t;
typedef cubic_hermite_spline <double, double, 3, true> cubic_hermite_spline_test_t;
typedef cubic_hermite_spline <double, double, true> cubic_hermite_spline_test_t;
curve_abc_test_t * pt_curve_abc;
// POLYNOMIAL
point_t a(1,1,1);
......
Markdown is supported
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