当前位置: 首页>>代码示例>>C++>>正文


C++ QMatrix4x4::row方法代码示例

本文整理汇总了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);
}
开发者ID:JackTing,项目名称:Sunshine,代码行数:9,代码来源:util.cpp

示例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;
    }
}
开发者ID:hvanruys,项目名称:EUMETCastView,代码行数:63,代码来源:segmentlistolci.cpp

示例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;
}
开发者ID:hvanruys,项目名称:EUMETCastView,代码行数:92,代码来源:segmentlistolci.cpp

示例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();
}
开发者ID:splatterlinge,项目名称:Splatterlinge,代码行数:28,代码来源:FrustumTest.cpp


注:本文中的QMatrix4x4::row方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。