本文整理汇总了C++中SkPoint::distanceToLineSegmentBetweenSqd方法的典型用法代码示例。如果您正苦于以下问题:C++ SkPoint::distanceToLineSegmentBetweenSqd方法的具体用法?C++ SkPoint::distanceToLineSegmentBetweenSqd怎么用?C++ SkPoint::distanceToLineSegmentBetweenSqd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkPoint
的用法示例。
在下文中一共展示了SkPoint::distanceToLineSegmentBetweenSqd方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: generateCubicPoints
uint32_t GrPathUtils::generateCubicPoints(const SkPoint& p0,
const SkPoint& p1,
const SkPoint& p2,
const SkPoint& p3,
SkScalar tolSqd,
SkPoint** points,
uint32_t pointsLeft) {
if (pointsLeft < 2 ||
(p1.distanceToLineSegmentBetweenSqd(p0, p3) < tolSqd &&
p2.distanceToLineSegmentBetweenSqd(p0, p3) < tolSqd)) {
(*points)[0] = p3;
*points += 1;
return 1;
}
SkPoint q[] = {
{ SkScalarAve(p0.fX, p1.fX), SkScalarAve(p0.fY, p1.fY) },
{ SkScalarAve(p1.fX, p2.fX), SkScalarAve(p1.fY, p2.fY) },
{ SkScalarAve(p2.fX, p3.fX), SkScalarAve(p2.fY, p3.fY) }
};
SkPoint r[] = {
{ SkScalarAve(q[0].fX, q[1].fX), SkScalarAve(q[0].fY, q[1].fY) },
{ SkScalarAve(q[1].fX, q[2].fX), SkScalarAve(q[1].fY, q[2].fY) }
};
SkPoint s = { SkScalarAve(r[0].fX, r[1].fX), SkScalarAve(r[0].fY, r[1].fY) };
pointsLeft >>= 1;
uint32_t a = generateCubicPoints(p0, q[0], r[0], s, tolSqd, points, pointsLeft);
uint32_t b = generateCubicPoints(s, r[1], q[2], p3, tolSqd, points, pointsLeft);
return a + b;
}
示例2: generateQuadraticPoints
uint32_t GrPathUtils::generateQuadraticPoints(const SkPoint& p0,
const SkPoint& p1,
const SkPoint& p2,
SkScalar tolSqd,
SkPoint** points,
uint32_t pointsLeft) {
if (pointsLeft < 2 ||
(p1.distanceToLineSegmentBetweenSqd(p0, p2)) < tolSqd) {
(*points)[0] = p2;
*points += 1;
return 1;
}
SkPoint q[] = {
{ SkScalarAve(p0.fX, p1.fX), SkScalarAve(p0.fY, p1.fY) },
{ SkScalarAve(p1.fX, p2.fX), SkScalarAve(p1.fY, p2.fY) },
};
SkPoint r = { SkScalarAve(q[0].fX, q[1].fX), SkScalarAve(q[0].fY, q[1].fY) };
pointsLeft >>= 1;
uint32_t a = generateQuadraticPoints(p0, q[0], r, tolSqd, points, pointsLeft);
uint32_t b = generateQuadraticPoints(r, q[1], p2, tolSqd, points, pointsLeft);
return a + b;
}