Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | capt_sms |
I have a problem with Vector2
class in my custom C++ module. I’m trying to fill an array of PoolVector2Arrays
with values. I init it with zeros and then I try to exchange the x
and y
values using operators []
and =
:
std::array<PoolVector2Array, 6> arrs2d;
while (arrs2d.at(siz(BodyKeypoints::ALL)).size() < 33)
{
Vector2 vi2 = {0, 0};
arrs2d.at(siz(BodyKeypoints::ALL)).append(vi2);
Vector3 vi3 = {0, 0, 0};
arrs3d.at(siz(BodyKeypoints::ALL)).append(vi3);
}
while (arrs2d[siz(BodyKeypoints::ALL)].size() < 2)
{
Vector2 iv(0.0, 0.0);
arrs2d[siz(BodyKeypoints::ALL)].append(iv);
}
//td.keypoints == std::vector<std::vector<double>>
arrs2d[siz(BodyKeypoints::ALL)][i][0] = td.keypoints.at(i).at(0);
arrs2d[siz(BodyKeypoints::ALL)][i][1] = td.keypoints.at(i).at(1);
std::wostringstream strstr;
strstr << arrs2d[siz(BodyKeypoints::ALL)][i][0] << "/" << td.keypoints.at(i).at(0) << std::endl;
strstr << arrs2d[siz(BodyKeypoints::ALL)][i][1] << "/" << td.keypoints.at(i).at(1) << std::endl;
print_error(strstr.str().c_str());
The output is like this:
0/188.627
0/609.072
So the values are there as double
but then they are not replacing the real_t
values of Vector2
object. What am I missing?