为什么在球坐标系中,sinTheta2=std::max(T(0), 1 - cosTheta(w) * cosTheta(w));

球坐标系中,计算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));
}

把图画出来分析一下

猜你喜欢

转载自www.cnblogs.com/heben/p/9200796.html
w
今日推荐