本文整理汇总了C++中Mat4f::setCol方法的典型用法代码示例。如果您正苦于以下问题:C++ Mat4f::setCol方法的具体用法?C++ Mat4f::setCol怎么用?C++ Mat4f::setCol使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mat4f
的用法示例。
在下文中一共展示了Mat4f::setCol方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getCameraToWorld
Mat4f CameraControls::getCameraToWorld(void) const
{
Mat3f orient = getOrientation();
Mat4f r;
r.setCol(0, Vec4f(orient.col(0), 0.0f));
r.setCol(1, Vec4f(orient.col(1), 0.0f));
r.setCol(2, Vec4f(orient.col(2), 0.0f));
r.setCol(3, Vec4f(m_position, 1.0f));
return r;
}
示例2: drawCurve
void drawCurve( const Curve& curve, float framesize )
{
// Save current state of OpenGL
glPushAttrib( GL_ALL_ATTRIB_BITS );
// Setup for line drawing
glDisable( GL_LIGHTING );
glColor4f( 1, 1, 1, 1 );
glLineWidth( 1 );
// Draw curve
glBegin( GL_LINE_STRIP );
for( unsigned i = 0; i < curve.size(); ++i )
{
glVertex( curve[ i ].V );
}
glEnd();
glLineWidth( 1 );
// Draw coordinate frames if framesize nonzero
if( framesize != 0.0f )
{
Mat4f M;
for( unsigned i = 0; i < curve.size(); ++i )
{
M.setCol( 0, Vec4f( curve[i].N, 0 ) );
M.setCol( 1, Vec4f( curve[i].B, 0 ) );
M.setCol( 2, Vec4f( curve[i].T, 0 ) );
M.setCol( 3, Vec4f( curve[i].V, 1 ) );
glPushMatrix();
glMultMatrixf( M.getPtr() );
glScaled( framesize, framesize, framesize );
glBegin( GL_LINES );
glColor3f( 1, 0, 0 ); glVertex3d( 0, 0, 0 ); glVertex3d( 1, 0, 0 );
glColor3f( 0, 1, 0 ); glVertex3d( 0, 0, 0 ); glVertex3d( 0, 1, 0 );
glColor3f( 0, 0, 1 ); glVertex3d( 0, 0, 0 ); glVertex3d( 0, 0, 1 );
glEnd();
glPopMatrix();
}
}
// Pop state
glPopAttrib();
}
示例3: 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);
}