本文整理汇总了C++中Intersections::insertOne方法的典型用法代码示例。如果您正苦于以下问题:C++ Intersections::insertOne方法的具体用法?C++ Intersections::insertOne怎么用?C++ Intersections::insertOne使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Intersections
的用法示例。
在下文中一共展示了Intersections::insertOne方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: intersect
int intersect(const Cubic& cubic, const Quadratic& quad, Intersections& i) {
SkTDArray<double> ts;
double precision = calcPrecision(cubic);
cubic_to_quadratics(cubic, precision, ts);
double tStart = 0;
Cubic part;
int tsCount = ts.count();
for (int idx = 0; idx <= tsCount; ++idx) {
double t = idx < tsCount ? ts[idx] : 1;
Quadratic q1;
sub_divide(cubic, tStart, t, part);
demote_cubic_to_quad(part, q1);
Intersections locals;
intersect2(q1, quad, locals);
for (int tIdx = 0; tIdx < locals.used(); ++tIdx) {
double globalT = tStart + (t - tStart) * locals.fT[0][tIdx];
i.insertOne(globalT, 0);
globalT = locals.fT[1][tIdx];
i.insertOne(globalT, 1);
}
tStart = t;
}
return i.used();
}
示例2: addValidRoots
static void addValidRoots(const double roots[4], const int count, const int side, Intersections& i) {
int index;
for (index = 0; index < count; ++index) {
if (!approximately_zero_or_more(roots[index]) || !approximately_one_or_less(roots[index])) {
continue;
}
double t = 1 - roots[index];
if (approximately_less_than_zero(t)) {
t = 0;
} else if (approximately_greater_than_one(t)) {
t = 1;
}
i.insertOne(t, side);
}
}