Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: GLM, triangle intersect and barycentric result

Hybrid View

  1. #1
    Newbie Newbie
    Join Date
    Jan 2013
    Posts
    2

    GLM, triangle intersect and barycentric result

    Hi,

    I work on raytracing project and i have few questions:
    When i use :
    Code :
    glm::intersectLineTriangle(rayon->Direction,ray->Origine,
    									  m_Model->listVertex[m_Model->listFaces[i].s1],
    									  m_Model->listVertex[m_Model->listFaces[i].s2],
    									  m_Model->listVertex[m_Model->listFaces[i].s3],
    									  tmp)
    tmp contains the result as barycentric coordinate.
    As i understand barycentric result:
    tmp.x,tmp.y and tmp.z sould be between 0 and 1 if the line interssect the triangle.
    and must be right tmp.x+tmp.y+tmp.z=1
    But when i run my code, results are different:
    ie : tmp.x+tmp.y+tmp.z=
    Code :
    1.11251
    0.827902
    0.582208
    1.03863
    0.587821
    1.12883
    0.649694
    1.10107
    0.522131
    0.409886
    1.09019
    0.98119
    0.805814
    0.701678
    0.484763
    0.969776
    0.883093
    1.12744
    is this normal?

  2. #2
    Newbie Newbie
    Join Date
    Jan 2013
    Posts
    2
    oops, a bug!
    glm::intersectLineTriangle(ray->Origine,rayon->Direction,
    m_Model->listVertex[m_Model->listFaces[i].s1],
    m_Model->listVertex[m_Model->listFaces[i].s2],
    m_Model->listVertex[m_Model->listFaces[i].s3],
    tmp)

    Is better but always a big problem with bary :
    -2.50849 0.19588 0.299395
    -2.47599 0.18083 0.404559
    -2.51029 0.0094359 0.88424
    etc

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •