Search code examples
qtqt3d

What is `uvw` property of QPickTriangleEvent class


QPickTriangleEvent class has a uvw property. What is it? Is uvw the normal vector of the triangle?


I log the QPickTriangleEvent properties:

Qt3DRender::QPickTriangleEvent *eventTri = static_cast<Qt3DRender::QPickTriangleEvent *>(event);
qDebug() << "Triangle Index: " << eventTri->triangleIndex();
qDebug() << "Triangle Vertex 1: " << eventTri->vertex1Index();
qDebug() << "Triangle Vertex 2: " << eventTri->vertex2Index();
qDebug() << "Triangle Vertex 3: " << eventTri->vertex3Index();
qDebug() << "Triangle UVW: " << eventTri->uvw();

The output:

Triangle Index:  79540
Triangle Vertex 1:  238620
Triangle Vertex 2:  238621
Triangle Vertex 3:  238622
Triangle UVW:  QVector3D(0.0390438, 0.151772, 0.809184)

Even with examining the output I cannot figure uvw out. Is it the normal vector of the triangle?


I'm examining these source codes to figure out what uvw is:

triangleboundingvolume_p.h

triangleboundingvolume.cpp


Solution

  • In source code triangleboundingvolume.cpp it is commented:

    // RealTime Collision Detection page 192
    bool intersectsSegmentTriangle(const RayCasting::QRay3D &ray, ...
    

    Page 193 of the book comments

    ... also returns the barycentric coordinates (u,v,w) of the intersection point s, ...

    and page 194

    ... Segment intersects tri at distance t in position s (s = uA + vB + w*C) ...