From 19a7d7c67257dcd7e5e2276c2da3014bbceb637c Mon Sep 17 00:00:00 2001 From: nico Date: Sun, 22 Nov 2020 09:46:48 +1000 Subject: [PATCH] Added the possibility to add some small border on each packed rectangle in PackAsObjectOrientedRect --- vcg/space/outline2_packer.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vcg/space/outline2_packer.h b/vcg/space/outline2_packer.h index ff01bb0b..5343ad0b 100644 --- a/vcg/space/outline2_packer.h +++ b/vcg/space/outline2_packer.h @@ -143,7 +143,8 @@ static bool PackAsAxisAlignedRect(const std::vector< std::vector > &pol static bool PackAsObjectOrientedRect(const std::vector< std::vector > &polyVec, const Point2i containerSizeX, std::vector &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 > & { float rot; bbVec.push_back(getPolyOOBB(polyVec[i],rot)); + if (border>0) + bbVec.back().Offset(border); rotVec.push_back(rot); }