From 888b89f834ab982f253bcf1ac880d8ef615c62c6 Mon Sep 17 00:00:00 2001 From: cignoni Date: Wed, 13 Mar 2013 00:14:21 +0000 Subject: [PATCH] Added reading and wrinting of polygon to simple ascii files --- vcg/space/poly_packer.h | 71 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 69 insertions(+), 2 deletions(-) diff --git a/vcg/space/poly_packer.h b/vcg/space/poly_packer.h index 89427498..82d6af47 100644 --- a/vcg/space/poly_packer.h +++ b/vcg/space/poly_packer.h @@ -58,9 +58,9 @@ public: static Box2f getPolyOOBB(const std::vector &poly, float &rot) { - const int stepNum=64; + const int stepNum=32; float bestAngle; - float bestArea = std::numeric_limits::max(); + float bestArea = std::numeric_limits::max(); Box2f bestBB; for(int i=0;i > & return ret; } + +static bool PackMultiAsObjectOrientedRect(const std::vector< std::vector > &polyVec, + const Point2x containerSizeX, const int containerNum, + std::vector &trVec, std::vector &indVec, + std::vector &coveredContainerVec) +{ + trVec.clear(); + trVec.resize(polyVec.size()); + std::vector bbVec; + std::vector rotVec; + for(size_t i=0;i::PackMulti(bbVec,containerSizeX,containerNum,trVec,indVec,coveredContainerVec); + + for(size_t i=0;i > &polyVec, const char *filename) +{ + FILE *fp=fopen(filename,"w"); + if(!fp) return false; + fprintf(fp,"%lu\n",polyVec.size()); + for(size_t i=0;i > &polyVec, const char *filename) +{ + FILE *fp=fopen(filename,"r"); + if(!fp) return false; + int sz; + fscanf(fp,"%i\n",&sz); + polyVec.clear(); + polyVec.resize(sz); + for(size_t i=0;i