本文整理汇总了C++中geom::PathVector::back方法的典型用法代码示例。如果您正苦于以下问题:C++ PathVector::back方法的具体用法?C++ PathVector::back怎么用?C++ PathVector::back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类geom::PathVector
的用法示例。
在下文中一共展示了PathVector::back方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: l
/*
* Converts all segments in all paths to Geom::LineSegment or Geom::HLineSegment or
* Geom::VLineSegment or Geom::CubicBezier.
*/
Geom::PathVector
pathv_to_linear_and_cubic_beziers( Geom::PathVector const &pathv )
{
Geom::PathVector output;
for (Geom::PathVector::const_iterator pit = pathv.begin(); pit != pathv.end(); ++pit) {
output.push_back( Geom::Path() );
output.back().start( pit->initialPoint() );
output.back().close( pit->closed() );
for (Geom::Path::const_iterator cit = pit->begin(); cit != pit->end_open(); ++cit) {
if (is_straight_curve(*cit)) {
Geom::LineSegment l(cit->initialPoint(), cit->finalPoint());
output.back().append(l);
} else {
Geom::BezierCurve const *curve = dynamic_cast<Geom::BezierCurve const *>(&*cit);
if (curve && curve->order() == 3) {
Geom::CubicBezier b((*curve)[0], (*curve)[1], (*curve)[2], (*curve)[3]);
output.back().append(b);
} else {
// convert all other curve types to cubicbeziers
Geom::Path cubicbezier_path = Geom::cubicbezierpath_from_sbasis(cit->toSBasis(), 0.1);
output.back().append(cubicbezier_path);
}
}
}
}
return output;
}
示例2: ls
/*
* Converts all segments in all paths to Geom::LineSegment. There is an intermediate
* stage where some may be converted to beziers. maxdisp is the maximum displacement from
* the line segment to the bezier curve; ** maxdisp is not used at this moment **.
*
* This is NOT a terribly fast method, but it should give a solution close to the one with the
* fewest points.
*/
Geom::PathVector
pathv_to_linear( Geom::PathVector const &pathv, double /*maxdisp*/)
{
Geom::PathVector output;
Geom::PathVector tmppath = pathv_to_linear_and_cubic_beziers(pathv);
// Now all path segments are either already lines, or they are beziers.
for (Geom::PathVector::const_iterator pit = tmppath.begin(); pit != tmppath.end(); ++pit) {
output.push_back( Geom::Path() );
output.back().start( pit->initialPoint() );
output.back().close( pit->closed() );
for (Geom::Path::const_iterator cit = pit->begin(); cit != pit->end_open(); ++cit) {
if (is_straight_curve(*cit)) {
Geom::LineSegment ls(cit->initialPoint(), cit->finalPoint());
output.back().append(ls);
}
else { /* all others must be Bezier curves */
Geom::BezierCurve const *curve = dynamic_cast<Geom::BezierCurve const *>(&*cit);
Geom::CubicBezier b((*curve)[0], (*curve)[1], (*curve)[2], (*curve)[3]);
std::vector<Geom::Point> bzrpoints = b.points();
Geom::Point A = bzrpoints[0];
Geom::Point B = bzrpoints[1];
Geom::Point C = bzrpoints[2];
Geom::Point D = bzrpoints[3];
std::vector<Geom::Point> pointlist;
pointlist.push_back(A);
recursive_bezier4(
A[X], A[Y],
B[X], B[Y],
C[X], C[Y],
D[X], D[Y],
pointlist,
0);
pointlist.push_back(D);
Geom::Point r1 = pointlist[0];
for (unsigned int i=1; i<pointlist.size();i++){
Geom::Point prev_r1 = r1;
r1 = pointlist[i];
Geom::LineSegment ls(prev_r1, r1);
output.back().append(ls);
}
pointlist.clear();
}
}
}
return output;
}