本文整理汇总了C++中Path2D::back方法的典型用法代码示例。如果您正苦于以下问题:C++ Path2D::back方法的具体用法?C++ Path2D::back怎么用?C++ Path2D::back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Path2D
的用法示例。
在下文中一共展示了Path2D::back方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: resample
Path2D GeometricRecognizer::resample(Path2D points)
{
double interval = pathLength(points) / (numPointsInGesture - 1); // interval length
double D = 0.0;
Path2D newPoints;
//--- Store first point since we'll never resample it out of existence
newPoints.push_back(points.front());
for(int i = 1; i < (int)points.size(); i++)
{
Point2D currentPoint = points[i];
Point2D previousPoint = points[i-1];
double d = getDistance(previousPoint, currentPoint);
if ((D + d) >= interval)
{
double qx = previousPoint.x + ((interval - D) / d) * (currentPoint.x - previousPoint.x);
double qy = previousPoint.y + ((interval - D) / d) * (currentPoint.y - previousPoint.y);
Point2D point(qx, qy);
newPoints.push_back(point);
points.insert(points.begin() + i, point);
D = 0.0;
}
else D += d;
}
// somtimes we fall a rounding-error short of adding the last point, so add it if so
if (newPoints.size() == (numPointsInGesture - 1))
{
newPoints.push_back(points.back());
}
return newPoints;
}