Commit c4dc932f authored by stevet's avatar stevet
Browse files

quadratic_variable

parent c3efc262
......@@ -10,8 +10,8 @@
#ifndef _CLASS_QUADRATIC_VARIABLE
#define _CLASS_QUADRATIC_VARIABLE
#include "hpp/spline/curve_abc.h"
#include "hpp/spline/linear_variable.h"
#include "curves/curve_abc.h"
#include "curves/linear_variable.h"
#include "MathDefs.h"
......@@ -128,7 +128,7 @@ struct quadratic_variable
const point_t& b () const {assert(!isZero());return b_;}
const Numeric c () const {assert(!isZero());return c_;}
bool isZero() const {return zero;}
std::size_t size() const {return zero ? 0 : std::max(A_.cols(), (std::max(B_.cols(), c_.size()))) ;}
std::size_t size() const {return zero ? 0 : std::max(A_.cols(), (std::max(b_.cols(), c_.size()))) ;}
private:
Numeric c_;
......
......@@ -380,6 +380,15 @@ namespace curves
.def_readonly("degree", &bezier_linear_variable_t::degree_)
.def_readonly("nbWaypoints", &bezier_linear_variable_t::size_)
;
class_<quadratic_variable_t >
("cost", no_init)
.add_property("A", &cost_t_quad)
.add_property("b", &cost_t_linear)
.add_property("c", &cost_t_constant)
;
/** END variable points bezier curve**/
/** BEGIN polynomial curve function**/
class_<polynomial_t>("polynomial", init<>())
......
#include "curves/bezier_curve.h"
#include "curves/linear_variable.h"
#include "curves/quadratic_variable.h"
#include <vector>
......
......@@ -48,6 +48,22 @@ namespace curves
}
Eigen::Matrix<real, Eigen::Dynamic, Eigen::Dynamic> cost_t_quad(const quadratic_variable_t& p)
{
Eigen::Matrix<real, Eigen::Dynamic, Eigen::Dynamic> A = p.A();
return A;
}
Eigen::Matrix<real, Eigen::Dynamic, 1> cost_t_linear(const quadratic_variable_t & p)
{
Eigen::Matrix<real, Eigen::Dynamic, 1> b = p.b();
return b;
}
real cost_t_constant(const quadratic_variable_t & p)
{
return p.c();
}
matrix_pair*
wayPointsToLists(const bezier_linear_variable_t& self)
{
......
......@@ -13,11 +13,11 @@ namespace curves
{
static const int dim = 3;
typedef linear_variable<dim, real> linear_variable_3_t;
typedef quadratic_variable<real> quadratic_variable_t;
typedef bezier_curve <real, real, true, linear_variable_3_t> bezier_linear_variable_t;
/*linear variable control points*/
bezier_linear_variable_t* wrapBezierLinearConstructor(const point_list_t& matrices, const point_list_t& vectors);
bezier_linear_variable_t* wrapBezierLinearConstructorBounds
(const point_list_t& matrices, const point_list_t& vectors, const real T_min, const real T_max);
......@@ -32,6 +32,10 @@ namespace curves
};
Eigen::Matrix<real, Eigen::Dynamic, Eigen::Dynamic> cost_t_quad(const quadratic_variable_t& p);
Eigen::Matrix<real, Eigen::Dynamic, 1> cost_t_linear(const quadratic_variable_t & p);
real cost_t_constant(const quadratic_variable_t & p);
matrix_pair* wayPointsToLists(const bezier_linear_variable_t& self);
struct LinearBezierVector
......
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