Added the possibility to add some small border on each packed rectangle in PackAsObjectOrientedRect

This commit is contained in:
nico 2020-11-22 09:46:48 +10:00
parent d2b39eb0bb
commit 19a7d7c672
1 changed files with 4 additions and 1 deletions

View File

@ -143,7 +143,8 @@ static bool PackAsAxisAlignedRect(const std::vector< std::vector<Point2x> > &pol
static bool PackAsObjectOrientedRect(const std::vector< std::vector<Point2x> > &polyVec,
const Point2i containerSizeX,
std::vector<Similarity2x> &trVec,
Point2x &coveredContainer)
Point2x &coveredContainer,
SCALAR_TYPE border=0)
{
trVec.clear();
trVec.resize(polyVec.size());
@ -153,6 +154,8 @@ static bool PackAsObjectOrientedRect(const std::vector< std::vector<Point2x> > &
{
float rot;
bbVec.push_back(getPolyOOBB(polyVec[i],rot));
if (border>0)
bbVec.back().Offset(border);
rotVec.push_back(rot);
}