本文整理汇总了C++中SkDLine::ptAtT方法的典型用法代码示例。如果您正苦于以下问题:C++ SkDLine::ptAtT方法的具体用法?C++ SkDLine::ptAtT怎么用?C++ SkDLine::ptAtT使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkDLine
的用法示例。
在下文中一共展示了SkDLine::ptAtT方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: check_results
static void check_results(skiatest::Reporter* reporter, const SkDLine& line1, const SkDLine& line2,
const SkIntersections& ts) {
for (int i = 0; i < ts.used(); ++i) {
SkDPoint result1 = line1.ptAtT(ts[0][i]);
SkDPoint result2 = line2.ptAtT(ts[1][i]);
if (!result1.approximatelyEqual(result2)) {
REPORTER_ASSERT(reporter, ts.used() != 1);
result2 = line2.ptAtT(ts[1][i ^ 1]);
REPORTER_ASSERT(reporter, result1.approximatelyEqual(result2));
REPORTER_ASSERT(reporter, result1.approximatelyEqual(ts.pt(i).asSkPoint()));
}
}
}
示例2: testLineIntersect
static void testLineIntersect(skiatest::Reporter* reporter, const SkDQuad& quad,
const SkDLine& line, const double x, const double y) {
char pathStr[1024];
sk_bzero(pathStr, sizeof(pathStr));
char* str = pathStr;
str += sprintf(str, " path.moveTo(%1.9g, %1.9g);\n", quad[0].fX, quad[0].fY);
str += sprintf(str, " path.quadTo(%1.9g, %1.9g, %1.9g, %1.9g);\n", quad[1].fX,
quad[1].fY, quad[2].fX, quad[2].fY);
str += sprintf(str, " path.moveTo(%1.9g, %1.9g);\n", line[0].fX, line[0].fY);
str += sprintf(str, " path.lineTo(%1.9g, %1.9g);\n", line[1].fX, line[1].fY);
SkIntersections intersections;
bool flipped = false;
int result = doIntersect(intersections, quad, line, flipped);
bool found = false;
for (int index = 0; index < result; ++index) {
double quadT = intersections[0][index];
SkDPoint quadXY = quad.ptAtT(quadT);
double lineT = intersections[1][index];
SkDPoint lineXY = line.ptAtT(lineT);
if (quadXY.approximatelyEqual(lineXY)) {
found = true;
}
}
REPORTER_ASSERT(reporter, found);
}
示例3: computePoints
void SkIntersections::computePoints(const SkDLine& line, int used) {
fPt[0] = line.ptAtT(fT[0][0]);
if ((fUsed = used) == 2) {
fPt[1] = line.ptAtT(fT[0][1]);
}
}
示例4: setup
static void setup(const SortSet* set, const size_t idx,
SkOpSegment* seg, int* ts, const SkPoint& startPt) {
SkPoint start, end;
const SkPoint* data = set[idx].ptData;
bool useIntersectPt = startPt.fX != 0 || startPt.fY != 0;
if (useIntersectPt) {
start = startPt;
end = set[idx].endPt;
}
switch(set[idx].ptCount) {
case 2: {
SkASSERT(ValidPoints(data, 2));
seg->addLine(data, false, false);
SkDLine dLine;
dLine.set(set[idx].ptData);
SkASSERT(ValidLine(dLine));
if (useIntersectPt) {
break;
}
start = dLine.ptAtT(set[idx].tStart).asSkPoint();
end = dLine.ptAtT(set[idx].tEnd).asSkPoint();
} break;
case 3: {
SkASSERT(ValidPoints(data, 3));
seg->addQuad(data, false, false);
SkDQuad dQuad;
dQuad.set(set[idx].ptData);
SkASSERT(ValidQuad(dQuad));
if (useIntersectPt) {
break;
}
start = dQuad.ptAtT(set[idx].tStart).asSkPoint();
end = dQuad.ptAtT(set[idx].tEnd).asSkPoint();
} break;
case 4: {
SkASSERT(ValidPoints(data, 4));
seg->addCubic(data, false, false);
SkDCubic dCubic;
dCubic.set(set[idx].ptData);
SkASSERT(ValidCubic(dCubic));
if (useIntersectPt) {
break;
}
start = dCubic.ptAtT(set[idx].tStart).asSkPoint();
end = dCubic.ptAtT(set[idx].tEnd).asSkPoint();
} break;
}
double tStart = set[idx].tStart;
double tEnd = set[idx].tEnd;
seg->addT(NULL, start, tStart);
seg->addT(NULL, end, tEnd);
if (tStart != 0 && tEnd != 0) {
seg->addT(NULL, set[idx].ptData[0], 0);
}
if (tStart != 1 && tEnd != 1) {
seg->addT(NULL, set[idx].ptData[set[idx].ptCount - 1], 1);
}
int tIndex = 0;
ts[0] = 0;
ts[1] = 1;
do {
if (seg->t(tIndex) == set[idx].tStart) {
ts[0] = tIndex;
}
if (seg->t(tIndex) == set[idx].tEnd) {
ts[1] = tIndex;
}
if (seg->t(tIndex) >= 1) {
break;
}
} while (++tIndex);
}