43 #ifndef ILQGAMES_COST_SEMIQUADRATIC_POLYLINE2_COST_H 44 #define ILQGAMES_COST_SEMIQUADRATIC_POLYLINE2_COST_H 46 #include <ilqgames/cost/time_invariant_cost.h> 47 #include <ilqgames/geometry/polyline2.h> 48 #include <ilqgames/utils/types.h> 61 const std::pair<Dimension, Dimension>& position_idxs,
float threshold,
62 bool oriented_right,
const std::string& name =
"")
65 xidx_(position_idxs.first),
66 yidx_(position_idxs.second),
67 threshold_(threshold),
68 signed_squared_threshold_(sgn(threshold) * threshold * threshold),
69 oriented_right_(oriented_right) {}
72 float Evaluate(
const VectorXf& input)
const;
76 void Quadraticize(
const VectorXf& input, MatrixXf* hess,
77 VectorXf* grad)
const;
81 bool IsActive(
float signed_squared_distance)
const {
82 return (signed_squared_distance > signed_squared_threshold_ &&
84 (signed_squared_distance < signed_squared_threshold_ &&
92 const Dimension xidx_;
93 const Dimension yidx_;
96 const float threshold_;
97 const float signed_squared_threshold_;
98 const bool oriented_right_;