本文整理汇总了C++中QMatrix4x4::row方法的典型用法代码示例。如果您正苦于以下问题:C++ QMatrix4x4::row方法的具体用法?C++ QMatrix4x4::row怎么用?C++ QMatrix4x4::row使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMatrix4x4
的用法示例。
在下文中一共展示了QMatrix4x4::row方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: printMatrix
void printMatrix(QMatrix4x4 m)
{
for (int i = 0; i < 4; i++) {
Vector4 row = m.row(i);
printf("%f %f %f %f\n", row.x(), row.y(), row.z(), row.w());
}
printf("\n");
fflush(stdout);
}
示例2: ShowWinvec
void SegmentListOLCI::ShowWinvec(QPainter *painter, float distance, const QMatrix4x4 modelview)
{
QList<Segment*>::iterator segit = segmentlist.begin();
QVector2D winvecend1, winvecend2, winvecend3, winvecend4;
QVector3D vecZ = modelview.row(2).toVector3D();
// static GLfloat mat[16];
// const float *data = modelview.constData();
// for (int index = 0; index < 16; ++index)
// mat[index] = data[index];
//modelview.inverted( &ok );
while ( segit != segmentlist.end() )
{
if( (*segit)->segmentshow)
{
for(int i = 0; i < (*segit)->winvectorfirst.length()-1; i++)
{
winvecend1.setX((*segit)->winvectorfirst.at(i).x()); winvecend1.setY((*segit)->winvectorfirst.at(i).y());
winvecend2.setX((*segit)->winvectorfirst.at(i+1).x()); winvecend2.setY((*segit)->winvectorfirst.at(i+1).y());
winvecend3.setX((*segit)->winvectorlast.at(i).x()); winvecend3.setY((*segit)->winvectorlast.at(i).y());
winvecend4.setX((*segit)->winvectorlast.at(i+1).x()); winvecend4.setY((*segit)->winvectorlast.at(i+1).y());
//qDebug() << "winvec1 x = " << winvec1.x() << " y = " << winvec1.y();
// first last
// winvecend1 ------------------------------------ winvecend3
// | p01 | p03
// | |
// | |
// | |
// | |
// | |
// | p02 | p04
// winvecend2 ------------------------------------ winvecend4
//
qreal angle = ArcCos(QVector3D::dotProduct( vecZ, (*segit)->vecvector.at(i)));
if (angle < PI/2) // + (asin(1/distance)))
{
painter->drawLine((int)winvecend1.x(), (painter->device())->height() - (int)winvecend1.y(), (int)winvecend3.x(), (painter->device())->height() - (int)winvecend3.y() );
painter->drawLine((int)winvecend1.x(), (painter->device())->height() - (int)winvecend1.y(), (int)winvecend2.x(), (painter->device())->height() - (int)winvecend2.y() );
painter->drawLine((int)winvecend3.x(), (painter->device())->height() - (int)winvecend3.y(), (int)winvecend4.x(), (painter->device())->height() - (int)winvecend4.y() );
// painter->drawLine((int)winvec1.x(), (painter->device())->height() - (int)winvec1.y(), (int)winvecend1.x(), (painter->device())->height() - (int)winvecend1.y() );
// painter->drawLine((int)winvec2.x(), (painter->device())->height() - (int)winvec2.y(), (int)winvecend2.x(), (painter->device())->height() - (int)winvecend2.y() );
// painter->drawLine((int)winvec1.x(), (painter->device())->height() - (int)winvec1.y(), (int)winvecend3.x(), (painter->device())->height() - (int)winvecend3.y() );
// painter->drawLine((int)winvec2.x(), (painter->device())->height() - (int)winvec2.y(), (int)winvecend4.x(), (painter->device())->height() - (int)winvecend4.y() );
}
}
}
++segit;
}
}
示例3: TestForSegmentGLerr
bool SegmentListOLCI::TestForSegmentGLerr(int x, int realy, float distance, const QMatrix4x4 &m, bool showallsegments, QString &segmentname)
{
bool isselected = false;
qDebug() << QString("Nbr of segments = %1").arg(segmentlist.count());
QList<Segment*>::iterator segit = segmentlist.begin();
QVector2D winvec1, winvec2, winvecend1, winvecend2, winvecend3, winvecend4;
QVector3D vecZ = m.row(2).toVector3D();
segmentname = "";
while ( segit != segmentlist.end() )
{
if(showallsegments ? true : (*segit)->segmentshow)
{
for(int i = 0; i < (*segit)->winvectorfirst.length()-1; i++)
{
winvecend1.setX((*segit)->winvectorfirst.at(i).x()); winvecend1.setY((*segit)->winvectorfirst.at(i).y());
winvecend2.setX((*segit)->winvectorfirst.at(i+1).x()); winvecend2.setY((*segit)->winvectorfirst.at(i+1).y());
winvecend3.setX((*segit)->winvectorlast.at(i).x()); winvecend3.setY((*segit)->winvectorlast.at(i).y());
winvecend4.setX((*segit)->winvectorlast.at(i+1).x()); winvecend4.setY((*segit)->winvectorlast.at(i+1).y());
// first last
// winvecend1 ------------------------------------ winvecend3
// | p01 | p03
// | |
// | |
// | |
// | |
// | |
// | p02 | p04
// winvecend2 ------------------------------------ winvecend4
//
qreal angle = ArcCos(QVector3D::dotProduct( vecZ, (*segit)->vecvector.at(i)));
//qDebug() << QString("angle = %1").arg(angle * 180.0 / PI);
if (angle < PI/2 + (asin(1/distance)))
{
struct point p01;
p01.x = (int)winvecend1.x();
p01.y = (int)winvecend1.y();
struct point p02;
p02.x = (int)winvecend2.x();
p02.y = (int)winvecend2.y();
struct point p03;
p03.x = (int)winvecend3.x();
p03.y = (int)winvecend3.y();
struct point p04;
p04.x = (int)winvecend4.x();
p04.y = (int)winvecend4.y();
QPoint points[4] = {
QPoint(p01.x, p01.y),
QPoint(p02.x, p02.y),
QPoint(p04.x, p04.y),
QPoint(p03.x, p03.y)
};
int result = pnpoly( 4, points, x, realy);
if (result)
{
if((*segit)->ToggleSelected())
{
qDebug() << QString("segment selected is = %1").arg((*segit)->fileInfo.fileName());
isselected = true;
segmentname = (*segit)->fileInfo.fileName();
qApp->processEvents();
}
break;
}
}
}
}
++segit;
}
return isselected;
}
示例4: sync
void FrustumTest::sync( const QMatrix4x4 & perspective, const QMatrix4x4 & modelView )
{
QMatrix4x4 clip = perspective * modelView;
/* Extract the RIGHT plane */
mFrustum[0] = clip.row(3) - clip.row(0);
mFrustum[0] /= mFrustum[0].toVector3D().length();
/* Extract the LEFT plane */
mFrustum[1] = clip.row(3) + clip.row(0);
mFrustum[1] /= mFrustum[1].toVector3D().length();
/* Extract the BOTTOM plane */
mFrustum[2] = clip.row(3) + clip.row(1);
mFrustum[2] /= mFrustum[2].toVector3D().length();
/* Extract the TOP plane */
mFrustum[3] = clip.row(3) - clip.row(1);
mFrustum[3] /= mFrustum[3].toVector3D().length();
/* Extract the FAR plane */
mFrustum[4] = clip.row(3) - clip.row(2);
mFrustum[4] /= mFrustum[4].toVector3D().length();
/* Extract the NEAR plane */
mFrustum[5] = clip.row(3) + clip.row(2);
mFrustum[5] /= mFrustum[5].toVector3D().length();
}