Viewing 0 reply threads
  • Author
    Posts
    • #9008 Score: 0
      hide on bush
      Participant

      有没有大佬帮忙解释一下:
      为什么一个点的模型矩阵可以这样计算?
      并且为什么计算出来的C向量一定是上向量?
      Vector3f toWorld(const Vector3f &a, const Vector3f &N){
      Vector3f B, C;
      if (std::fabs(N.x) > std::fabs(N.y)){
      float invLen = 1.0f / std::sqrt(N.x * N.x + N.z * N.z);
      C = Vector3f(N.z * invLen, 0.0f, -N.x *invLen);
      }
      else {
      float invLen = 1.0f / std::sqrt(N.y * N.y + N.z * N.z);
      C = Vector3f(0.0f, N.z * invLen, -N.y *invLen);
      }
      B = crossProduct(C, N);
      return a.x * B + a.y * C + a.z * N;
      }

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