Home Forums GAMES在线课程(现代计算机图形学入门)讨论区 作业六,dirIsNeg是干什么的?

Tagged: 

Viewing 5 reply threads
  • Author
    Posts
    • #5208 Score: 0
      Knight_Parly
      Participant

      正在进行第三步,

      在代码框架Bounds3.hpp里需要自己完成的函数中传了const std::array<int,3>dirIsNeg这个参数,它是干什么的?

      我把它复制搜索整个框架发现它只存在这一个地方,只有声明,没有定义。

      然后我又搜索IntersectP这个函数,发现这个函数除了在BVH.hpp有个重载声明也是没有定义,我蒙了。。。

      在函数定义内有个第二行注释说什么用来简化了我的逻辑,可是我感觉我的逻辑炸了•﹏•

    • #5209 Score: 0
      Knight_Parly
      Participant

      我好像想明白了,应该是我步骤四还没进行的缘故…

    • #5210 Score: 0
      lhyakn
      Participant
      1 pt

      其实就是用来简化计算的,可以利用这个直接计算出tmax和tmin,少了些判断。

    • #5251 Score: 0
      Keneyr
      Participant
      7 pts

      我咋没想明白。。

      • #5260 Score: 0
        Shi YuChen(助教)
        Keymaster
        4 pts

        这个参数就是给出光线方向在三个轴上的正负的,dirIsNeg=direction is negative

        • #6558 Score: 0
          dzy
          Participant

          direction is negative 结果是>0为true….

    • #5276 Score: 0
      Azaurr
      Participant

      似乎可以不使用disIsNeg进行判断。我的做法是用t1表示光线到AABB上xMax、yMax、zMax这三个面的时间,t2表示到xMin、yMin、zMin这三个面的时间。然后分别计算光线在x、y、z三个方向进入和离开相应平面的时间tMin和tMax。最后得到进入和离开AABB的时间tEnter和tExit。

      • This reply was modified 3 years, 11 months ago by Azaurr.
      Attachments:
      You must be logged in to view attached files.
    • #6559 Score: 0
      dzy
      Participant

      bvh的 intersectp确实木大,删掉即可
      intersectp好像只有bounds3里面那个有用,p的意思也不知道是啥..好像是因为intersect已经有了所以只能叫p…

      其实你仔细看看里面有不少没用的函数,比如triangle和meshtriangle的两个intersect

      还有intersect类型到底是bool还是intersection也没有统一…最好自己改一下…

Viewing 5 reply threads
  • You must be logged in to reply to this topic.