添加视图比对
This commit is contained in:
1 parent
5e4872f41d
commit
e8e84643f6
10 files changed
+1923
-24
No files matched your search
@@ -579,6 +579,16 @@ inline TPoint3<TYPE> ComputeTriangleNormal(const TPoint3<TYPE>& v0, const TPoint
|
||||
} // ComputeTriangleNormal
|
||||
/*----------------------------------------------------------------*/
|
||||
|
||||
template<typename ColorType>
|
||||
ColorType ComputeTriangleColor(const ColorType& c0, const ColorType& c1, const ColorType& c2) {
|
||||
// 手动计算每个通道的平均值
|
||||
ColorType result;
|
||||
result.r = static_cast<uint8_t>((static_cast<int>(c0.r) + c1.r + c2.r) / 3 + 0.5f); // 整数运算避免溢出
|
||||
result.g = static_cast<uint8_t>((c0.g + c1.g + c2.g) / 3 + 0.5f);
|
||||
result.b = static_cast<uint8_t>((c0.b + c1.b + c2.b) / 3 + 0.5f);
|
||||
return result;
|
||||
}
|
||||
|
||||
// compute the area of a triangle using Heron's formula
|
||||
template <typename TYPE>
|
||||
TYPE ComputeTriangleAreaSqLen(TYPE lena, TYPE lenb, TYPE lenc) {
|
||||
|
||||
Reference in new issue
Block a user