EDIT : Be careful, this issue is valid only when point at negative position is used.
Hi, I am back with a fresh new issue.
But in fact, this seems to be there from a while now…
The function Rectangle::findAreaContainingPoints() returns a rectangle whose position is at bottom-left ! There is the code which is in this function:
/** Returns the smallest Rectangle that can contain a set of points. */
static Rectangle findAreaContainingPoints (const Point<ValueType>* const points, const int numPoints) noexcept
{
if (numPoints == 0)
return Rectangle();
ValueType minX (points[0].x);
ValueType maxX (minX);
ValueType minY (points[0].y);
ValueType maxY (minY);
for (int i = 1; i < numPoints; ++i)
{
minX = jmin (minX, points[i].x);
maxX = jmax (maxX, points[i].x);
minY = jmin (minY, points[i].y);
maxY = jmax (maxY, points[i].y);
}
return Rectangle (minX, minY, maxX - minX, maxY - minY);
}
As you see, minY is set to jmin() of Y-coordinates… So, position will be at bottom-left !
There are two solutions to solve this issue:
- first, modify function to get jmax() of Y-coordinates.
- second, use the static Rectangle::leftTopRightBottom function with leftTopRightBottom(minX, maxY, maxX, minY).
Let me know what do you think about this issue, and what do you want to do with it.