zoukankan      html  css  js  c++  java
  • 为什么在球坐标系中,sinTheta2=std::max(T(0), 1

    球坐标系中,计算sin2θ时,采用的是如下公式,感觉不理解为什么要搞一个max函数,直接1 - cosTheta(w) * cosTheta(w)不行吗,另外,即使要用max,max的第一个参数应该是T(0)的平方吧

    //计算sin(theta)的平方
    template<typename T>
    inline T sinTheta2(const Vec3<T> &w)
    {
        return std::max(T(0), 1 - cosTheta(w) * cosTheta(w));
    }

    把图画出来分析一下

    后来发现我眼拙了,T(0)我理解成了w[0],实际上这里T(0)只是转型成T类型的0 

  • 相关阅读:
    python中的unlink
    if
    python中if __name__ == '__main__'
    rename函数
    win2003的密钥
    url
    python中的os.stat
    python中的mysql
    防火墙
    网址
  • 原文地址:https://www.cnblogs.com/heben/p/9200796.html
Copyright © 2011-2022 走看看