本文整理汇总了C++中Curve::boundsLocal方法的典型用法代码示例。如果您正苦于以下问题:C++ Curve::boundsLocal方法的具体用法?C++ Curve::boundsLocal怎么用?C++ Curve::boundsLocal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Curve
的用法示例。
在下文中一共展示了Curve::boundsLocal方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pair_intersect
/**
* This uses the local bounds functions of curves to generically intersect two.
* It passes in the curves, time intervals, and keeps track of depth, while
* returning the results through the Crossings parameter.
*/
void pair_intersect(Curve const & A, double Al, double Ah,
Curve const & B, double Bl, double Bh,
Crossings &ret, unsigned depth=0) {
// std::cout << depth << "(" << Al << ", " << Ah << ")\n";
OptRect Ar = A.boundsLocal(Interval(Al, Ah));
if (!Ar) return;
OptRect Br = B.boundsLocal(Interval(Bl, Bh));
if (!Br) return;
if(! Ar->intersects(*Br)) return;
//Checks the general linearity of the function
if((depth > 12)) { // || (A.boundsLocal(Interval(Al, Ah), 1).maxExtent() < 0.1
//&& B.boundsLocal(Interval(Bl, Bh), 1).maxExtent() < 0.1)) {
double tA, tB, c;
if(linear_intersect(A.pointAt(Al), A.pointAt(Ah),
B.pointAt(Bl), B.pointAt(Bh),
tA, tB, c)) {
tA = tA * (Ah - Al) + Al;
tB = tB * (Bh - Bl) + Bl;
intersect_polish_root(A, tA,
B, tB);
if(depth % 2)
ret.push_back(Crossing(tB, tA, c < 0));
else
ret.push_back(Crossing(tA, tB, c > 0));
return;
}
}
if(depth > 12) return;
double mid = (Bl + Bh)/2;
pair_intersect(B, Bl, mid,
A, Al, Ah,
ret, depth+1);
pair_intersect(B, mid, Bh,
A, Al, Ah,
ret, depth+1);
}