本文整理汇总了C++中geom::PathVector::front方法的典型用法代码示例。如果您正苦于以下问题:C++ PathVector::front方法的具体用法?C++ PathVector::front怎么用?C++ PathVector::front使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类geom::PathVector
的用法示例。
在下文中一共展示了PathVector::front方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv) {
if (argc > 1) {
SVGPathTestPrinter sink;
Geom::parse_svg_path(&*argv[1], sink);
std::cout << "Try real pathsink:" << std::endl;
Geom::PathVector testpath = Geom::parse_svg_path(&*argv[1]);
std::cout << "Geom::PathVector length: " << testpath.size() << std::endl;
if ( !testpath.empty() )
std::cout << "Path curves: " << testpath.front().size() << std::endl;
std::cout << "success!" << std::endl;
}
return 0;
};
示例2: OptRect
Geom::OptRect
bounds_exact_transformed(Geom::PathVector const & pv, Geom::Affine const & t)
{
if (pv.empty())
return Geom::OptRect();
Geom::Point initial = pv.front().initialPoint() * t;
Geom::Rect bbox(initial, initial); // obtain well defined bbox as starting point to unionWith
for (Geom::PathVector::const_iterator it = pv.begin(); it != pv.end(); ++it) {
bbox.expandTo(it->initialPoint() * t);
// don't loop including closing segment, since that segment can never increase the bbox
for (Geom::Path::const_iterator cit = it->begin(); cit != it->end_open(); ++cit) {
Geom::Curve const &c = *cit;
unsigned order = 0;
if (Geom::BezierCurve const* b = dynamic_cast<Geom::BezierCurve const*>(&c)) {
order = b->order();
}
if (order == 1) { // line segment
bbox.expandTo(c.finalPoint() * t);
// TODO: we can make the case for quadratics faster by degree elevating them to
// cubic and then taking the bbox of that.
} else if (order == 3) { // cubic bezier
Geom::CubicBezier const &cubic_bezier = static_cast<Geom::CubicBezier const&>(c);
Geom::Point c0 = cubic_bezier[0] * t;
Geom::Point c1 = cubic_bezier[1] * t;
Geom::Point c2 = cubic_bezier[2] * t;
Geom::Point c3 = cubic_bezier[3] * t;
cubic_bbox(c0[0], c0[1], c1[0], c1[1], c2[0], c2[1], c3[0], c3[1], bbox);
} else {
// should handle all not-so-easy curves:
Geom::Curve *ctemp = cit->transformed(t);
bbox.unionWith( ctemp->boundsExact());
delete ctemp;
}
}
}
//return Geom::bounds_exact(pv * t);
return bbox;
}
示例3: OptRect
Geom::OptRect
bounds_exact_transformed(Geom::PathVector const & pv, Geom::Affine const & t)
{
if (pv.empty())
return Geom::OptRect();
Geom::Point initial = pv.front().initialPoint() * t;
Geom::Rect bbox(initial, initial); // obtain well defined bbox as starting point to unionWith
for (Geom::PathVector::const_iterator it = pv.begin(); it != pv.end(); ++it) {
bbox.expandTo(it->initialPoint() * t);
// don't loop including closing segment, since that segment can never increase the bbox
for (Geom::Path::const_iterator cit = it->begin(); cit != it->end_open(); ++cit) {
Geom::Curve const &c = *cit;
if( is_straight_curve(c) )
{
bbox.expandTo( c.finalPoint() * t );
}
else if(Geom::CubicBezier const *cubic_bezier = dynamic_cast<Geom::CubicBezier const *>(&c))
{
Geom::Point c0 = (*cubic_bezier)[0] * t;
Geom::Point c1 = (*cubic_bezier)[1] * t;
Geom::Point c2 = (*cubic_bezier)[2] * t;
Geom::Point c3 = (*cubic_bezier)[3] * t;
cubic_bbox( c0[0], c0[1],
c1[0], c1[1],
c2[0], c2[1],
c3[0], c3[1],
bbox );
}
else
{
// should handle all not-so-easy curves:
Geom::Curve *ctemp = cit->transformed(t);
bbox.unionWith( ctemp->boundsExact());
delete ctemp;
}
}
}
//return Geom::bounds_exact(pv * t);
return bbox;
}