本文整理汇总了C++中Point2f::Rotate方法的典型用法代码示例。如果您正苦于以下问题:C++ Point2f::Rotate方法的具体用法?C++ Point2f::Rotate怎么用?C++ Point2f::Rotate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point2f
的用法示例。
在下文中一共展示了Point2f::Rotate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dumpPolySetSVG
///write a polygon on a SVG file, format of the polygon is vector of vector of contours...nested contours are holes
///takes the name of the image in input, the set of polygons, the set of per polygons transformation,
///the label to be written and the global parameter for drawing style
void PolyDumper::dumpPolySetSVG(const char * imageName,
vector< vector< vector<Point2f> > > &polyVecVec,
vector<Similarity2f> &trVec,
vector< vector< string> > &labelVecVec,
vector<vector<Point2f> > &labelPosVecVec,
vector<vector<float> >&labelRadVecVec,
PolyDumperParam &pp)
{
assert(polyVecVec.size() == trVec.size());
///SET THE FONT
int fontSize;
if(pp.fontSize==0) fontSize=ceil(std::max(pp.width,pp.height)/200.0);
else fontSize=pp.fontSize;
QFont qf("courier",fontSize);
QSvgGenerator svg;
svg.setFileName(imageName);
///SET THE DRAWING SIZE
svg.setSize(QSize(pp.width,pp.height));
svg.setViewBox(QRect(0, 0, pp.width,pp.height));
svg.setResolution(int(pp.dpi));//
///SETUP OF DRAWING PROCEDURE
QPainter painter;
painter.begin(&svg);
QBrush bb;
if (pp.fill)
bb.setStyle(Qt::SolidPattern);
QPen qp;
///SET THE GLOBAL SCALING FACTOR
float Scalesvg=1.f/(float)trVec[0].sca;
qp.setWidthF(Scalesvg);
for(size_t i=0;i<polyVecVec.size();++i)
{
///SET THE CURRENT TRANSFORMATION
painter.resetTransform();
painter.translate(trVec[i].tra[0],trVec[i].tra[1]);
painter.rotate(math::ToDeg(trVec[i].rotRad));
painter.scale(trVec[i].sca,trVec[i].sca);
QPainterPath QPP;
for(size_t jj=0;jj<polyVecVec[i].size();++jj)
{
QVector<QPointF> ppQ;
for(size_t j=0;j<polyVecVec[i][jj].size();++j)
{
Point2f pp=polyVecVec[i][jj][j];
ppQ.push_back(QPointF(pp[0],pp[1]));
}
ppQ.push_back(QPointF(polyVecVec[i][jj][0][0],polyVecVec[i][jj][0][1]));
QPP.addPolygon(QPolygonF(ppQ));
}
///FIND THE INCENTER
if (pp.randomColor)
bb.setColor(vcg::ColorConverter::ToQColor(Color4b::Scatter(polyVecVec.size(),i)));
else
bb.setColor(vcg::ColorConverter::ToQColor(pp.FillColor));
///DRAW THE POLYGON
painter.setBrush(bb);
painter.setPen(qp);
painter.drawPath(QPP);
///DRAW THE TEXT
painter.setFont(qf);
float radius;
int radiusInt;
Point2f bc;
// if we do not have labelPos use the old method of empty disk.
if(labelPosVecVec.empty()) bc=GetIncenter(polyVecVec[i],trVec[i],radiusInt);
radius = radiusInt;
for(size_t labelInd=0;labelInd<labelVecVec[i].size();++labelInd)
{
if(!labelPosVecVec.empty())
{
bc= labelPosVecVec[i][labelInd];
bc.Rotate(trVec[i].rotRad);
bc *= trVec[i].sca;
radius=labelRadVecVec[i][labelInd];
radius *= trVec[i].sca;
}
painter.resetTransform();
painter.translate(trVec[i].tra[0],trVec[i].tra[1]);
painter.drawText(bc[0]-radius,bc[1]-radius,radius*2,radius*2,Qt::AlignHCenter|Qt::AlignCenter,QString(labelVecVec[i][labelInd].c_str()));
}
}
painter.end();
}