43 paramFuncsStructure_ = _paramFuncsStructure;
44 const size_t funcsSize = _paramFuncsStructure.size();
47 throw "Error in ParamFuncs::checkParamFuncsStructure: initialization with 0 number of functions!";
49 funcCtrlPt_.resize(funcsSize);
50 for (
auto& funcCtrlPtrI : funcCtrlPt_)
54 func2Arc_.resize(funcsSize);
55 funcEvalReq_.resize(funcsSize);
56 funcCtrlPtArc_.clear();
57 vector<size_t> funcSameArcCtrlPtSize;
58 for (
size_t i = 0; i < funcsSize; ++i)
60 const size_t& funcCtrlPtsSize = _paramFuncsStructure[i].ctrlPtsSize;
61 if (funcCtrlPtsSize < 2)
63 throw "Error in ParamFuncs::checkParamFuncsStructure: function has less than 2 control points!";
66 func2Arc_[i] = _paramFuncsStructure[i].ctrlPtsArcRefIdx;
67 if (func2Arc_[i] >= funcCtrlPtArc_.size())
69 if (func2Arc_[i] == funcCtrlPtArc_.size())
71 funcCtrlPtArc_.emplace_back(vector<double>(funcCtrlPtsSize - 2, 0));
72 funcSameArcCtrlPtSize.emplace_back(funcCtrlPtsSize);
76 throw "Error in ParamFuncs::init: a ctrlPtsArcRefIdx is not consistent (new Idx not unit incremental)";
79 if (funcCtrlPtsSize != funcSameArcCtrlPtSize[func2Arc_[i]])
81 throw "Error in ParamFuncs::init: inconsistent number of control points for functions with same arc " 82 "parametrization reference";
84 funcCtrlPt_[i].reserve(funcCtrlPtsSize);
85 funcCtrlPt_[i].emplace_back(
FuncCtrlPt(0, funcsArcBegin_));
86 for (
size_t j = 1; j < funcCtrlPtsSize - 1; ++j)
88 funcCtrlPt_[i].emplace_back(
FuncCtrlPt(0, funcCtrlPtArc_[func2Arc_[i]][j - 1]));
90 funcCtrlPt_[i].emplace_back(
FuncCtrlPt(0, funcsArcEnd_));
92 funcEvalReq_[i] = _paramFuncsStructure[i].evalReq;
98 initBase(_paramFuncsStructure);
106 for (
size_t i = 0; i < funcsArcSize(); ++i)
108 for (
size_t j = 0; j < funcsArcSize(i); ++j)
110 funcsArc(i, j) = _other.
funcsArc(i, j);
113 for (
size_t i = 0; i < funcsSize(); ++i)
115 for (
size_t j = 0; j < funcCtrlPtSize(i); ++j)
131 for (
size_t i = 0; i < funcsArcSize(); ++i)
133 for (
size_t j = 0; j < funcsArcSize(i); ++j)
135 funcsArc(i, j) = _other.
funcsArc(i, j);
138 for (
size_t i = 0; i < funcsSize(); ++i)
140 for (
size_t j = 0; j < funcCtrlPtSize(i); ++j)
150 std::vector<std::vector<size_t> > ctrlPtModif(funcsSize(), std::vector<size_t>(0, 0));
151 ctrlPtModif.reserve(10);
152 const double evalArc = funcsArcBegin_ + _dt;
154 for (
size_t i = 0; i < funcsSize(); ++i)
156 for (
size_t j = 0; j < funcCtrlPtSize(i); ++j)
160 ctrlPtModif[i].emplace_back(j);
164 for (
size_t i = 0; i < ctrlPtModif.size(); ++i)
166 const double newVal = computeFuncVal(i);
167 for (
size_t j = 0; j < ctrlPtModif[i].size(); ++j)
172 for (
size_t k = 0; k < funcsArcSize(); ++k)
174 for (
size_t j = 0; j < funcCtrlPtArc_[k].size(); ++j)
176 funcCtrlPtArc_[k][j] -= _dt;
181 setEvalArc(funcsArcBegin_);
186 return funcCtrlPt_.size();
190 return funcCtrlPt_[_i].size();
194 return funcCtrlPtArc_.size();
199 return funcsArcBegin_;
203 return funcsArcBegin_;
215 return funcsArcEval_;
220 return funcCtrlPtArc_[_i].size() + 2;
227 return funcsArcBegin_;
229 if (_j > funcCtrlPtArc_[_i].size())
233 return funcCtrlPtArc_[_i][_j - 1];
239 return funcsArcBegin_;
241 if (_j > funcCtrlPtArc_[_i].size())
245 return funcCtrlPtArc_[_i][_j - 1];
253 return funcCtrlPt_[_funcIdx][_funcCtrlPtIdx].val;
256 return funcCtrlPt_[_funcIdx][_funcCtrlPtIdx].arc;
259 throw "CtrlPtDim unrecognised in function ParamFuncs::ctrlPtVal !";
269 return funcCtrlPt_[_funcIdx][_funcCtrlPtIdx].val;
272 return funcCtrlPt_[_funcIdx][_funcCtrlPtIdx].arc;
275 throw "CtrlPtDim unrecognised in function ParamFuncs::ctrlPtVal !";
282 return funcCtrlPt_[_funcIdx][_funcCtrlPtIdx];
286 return funcCtrlPt_[_funcIdx][_funcCtrlPtIdx];
double & funcsArc(const std::size_t &_i, const std::size_t &_j)
Access to the arc parameter vector at index _i, control point _j.
control point arc parameter
Helper function needed to upgrade c++ 2011.
double & funcsArcBegin()
Access to the initial value of the arc parametrization.
ParamFuncs & operator=(const ParamFuncs &)
void initBase(const std::vector< tuw::ParamFuncs::ParamFuncsStructure > &_paramFuncsStructure)
Initializes the control structure for the base class.
double & funcsArcEnd()
Access to the final value of the arc parametrization.
double & ctrlPtVal(const std::size_t &_funcIdx, const std::size_t &_funcCtrlPtIdx, const CtrlPtDim &_ctrlPtDim=CtrlPtDim::VAL)
Access of a parametric function control point dimension.
std::size_t funcsSize() const
Number of parametric functions.
std::size_t funcCtrlPtSize(const std::size_t &_i) const
Number of control points for a parametric function.
CtrlPtDim
Control point variable dimension.
std::size_t funcsArcSize() const
Number of arc parametrizations.
void init(const std::vector< tuw::ParamFuncs::ParamFuncsStructure > &_paramFuncsStructure)
Initializes the control structure.
const double & funcsArcEval() const
Const access to the active evaluation point arc parametrization.
void shiftStartCtrlPt(const double &_dt)
std::vector< ParamFuncsStructure > paramFuncsStructure_
Initialization structure "store" variable.
FuncCtrlPt & ctrlPt(const std::size_t &_funcIdx, const std::size_t &_funcCtrlPtIdx)
Access of a parametric function control point.
Storage and manipulation of parametric functions collection.