本文整理汇总了C++中Patch::getCurve方法的典型用法代码示例。如果您正苦于以下问题:C++ Patch::getCurve方法的具体用法?C++ Patch::getCurve怎么用?C++ Patch::getCurve使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Patch
的用法示例。
在下文中一共展示了Patch::getCurve方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bezpatchinterp
// given a control patch and (u,v) values, find
// the surface point and normal
Point Bezier::bezpatchinterp(Patch patch, float u, float v, Point &n) {
Point p;
Point dPdu;
Point dPdv;
Point trash;
std::vector<Point> vcurve(4);
std::vector<Point> ucurve(4);
bool horizontal = true;
bool vertical = false;
// build control points for a Bezier curve in v
vcurve[0] = bezcurveinterp(patch.getCurve(0, horizontal), u, trash);
vcurve[1] = bezcurveinterp(patch.getCurve(1, horizontal), u, trash);
vcurve[2] = bezcurveinterp(patch.getCurve(2, horizontal), u, trash);
vcurve[3] = bezcurveinterp(patch.getCurve(3, horizontal), u, trash);
// build control points for a Bezier curve in u
ucurve[0] = bezcurveinterp(patch.getCurve(0, vertical), v, trash);
ucurve[1] = bezcurveinterp(patch.getCurve(1, vertical), v, trash);
ucurve[2] = bezcurveinterp(patch.getCurve(2, vertical), v, trash);
ucurve[3] = bezcurveinterp(patch.getCurve(3, vertical), v, trash);
// evaluate surface and derivative for u and v
p = bezcurveinterp(vcurve, v, dPdv);
p = bezcurveinterp(ucurve, u, dPdu);
// take cross product of partials to find normal
n = crossP(dPdu, dPdv);
n = n / n.length();
Point n2 = crossP(dPdv, dPdu);
n2 = n2 / n2.length();
p.saveNormal(n, n2);
return p;
}