本文整理汇总了C++中Mat4f::getCol方法的典型用法代码示例。如果您正苦于以下问题:C++ Mat4f::getCol方法的具体用法?C++ Mat4f::getCol怎么用?C++ Mat4f::getCol使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mat4f
的用法示例。
在下文中一共展示了Mat4f::getCol方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: evalBspline
Curve evalBspline( const vector< Vec3f >& P, unsigned steps )
{
// Check
if( P.size() < 4 )
{
cerr << "evalBspline must be called with 4 or more control points." << endl;
exit( 0 );
}
cerr << "\t>>> evalBSpline has been called with the following input:" << endl;
cerr << "\t>>> Control points (type vector< Vec3f >): "<< endl;
for( unsigned i = 0; i < P.size(); ++i )
{
cerr << "\t>>> "; printTranspose(P[i]); cerr << endl;
}
cerr << "\t>>> Steps (type steps): " << steps << endl;
// Use your evalBezier function to evaluate the B-spline.
// Convert the input control points to suitable coordinate system.
// See lecture notes for further instructions.
vector<Vec3f> Pbz;
for (int i = 0; i < P.size()-3; i++) {
// Create the G matrix for conversion
Mat4f G;
for (int j = 0; j < 4; j++) {
G.setCol(j, Vec4f(P[i+j].x, P[i+j].y, P[i+j].z, 0.0));
}
// Calculate the conversion matrix: G_2 = G_1 * B_1 * (B_2)^-1
G = G * Base::bsplineBase * Base::bezierBase.inverted();
// Detach the converted control points from the G matrix
for (int j = 0; j < 3; j++) {
Pbz.push_back(Vec3f(G.getCol(j)[0], G.getCol(j)[1], G.getCol(j)[2]));
}
// Only add the last column for the very last index
if (i+3 == P.size()-1) {
Pbz.push_back(Vec3f(G.getCol(3)[0], G.getCol(3)[1], G.getCol(3)[2]));
}
}
return evalBezier(Pbz, steps);
}