void calcKnots int int vector float knots bool isOpen knots resize if

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
void calcKnots(int n, int k, vector<float> &knots, bool isOpen)
{
knots.resize(n + k);
if (isOpen)
{
int temp = 0;
for (int i = 0; i < knots.size(); ++i)
{
if (i >= k && knots.size() - i >= k)
temp++;
knots[i] = temp;
}
}
else
{
for (int i = 0; i < knots.size(); ++i)
{
knots[i] = i;
}
}
}