I'm trying to understand a C++ code. (I'm a total beginner and used to Java) And I'm really struggeling to understand what happens here.
so I got this
Eigen::Vector2i mapDims;
Eigen::Vector2f mapLimits;
float cellLength;
and a Constructor for my Class that looks like this:
MapDimensionProperties(const Eigen::Vector2f& OffsetIn, const Eigen::Vector2i& mapDimsIn, float cellLengthIn)
: tOffset(OffsetIn)
, mapDims(mapDimsIn)
, cellLength(cellLengthIn)
{
// I don't understand the following part:
mapLimits = (mapDimensionsIn.cast<float>()).array() - 1.0f;
}
What is happening here? I see that this Integer Vector is cast to a Float Vector, and seemingly afterwards made into an Array. But how can you subtract a float number from an Array? I mean wouldn't you have to point out a specific index on which place you want to subtract something? And how can it override mapLimits, if its an Array and mapLimits is a vector?
Or am I completely wrong here?
Thank you in advance.