重新定义2维向量的大小比较操作符,暂时去掉3维和4纬向量的比较操作符

This commit is contained in:
2025-07-02 22:32:11 +08:00
parent 2520e9589f
commit 8b66098f3d
6 changed files with 42 additions and 54 deletions
+12 -8
View File
@@ -59,6 +59,18 @@ public:
return (x != rkVector.x || y != rkVector.y);
}
inline bool operator > (const TVector2& rkVector) const {
if (y > rkVector.y) return true;
else if (y < rkVector.y) return false;
else return x > rkVector.x;
}
inline bool operator < (const TVector2& rkVector) const {
if (y < rkVector.y) return true;
else if (y > rkVector.y) return false;
else return x < rkVector.x;
}
public:
// Arithmetic operations
inline TVector2 operator + (const TVector2& rkVector) const {
@@ -172,14 +184,6 @@ public:
return *this;
}
inline bool operator < (const TVector2& rhs) const {
return (x < rhs.x && y < rhs.y);
}
inline bool operator > (const TVector2& rhs) const {
return (x > rhs.x && y > rhs.y);
}
public:
inline T length(void) const {
return MathUtil::sqrt(x * x + y * y);
-8
View File
@@ -194,14 +194,6 @@ public:
return *this;
}
inline bool operator < (const TVector3& rhs) const {
return (x < rhs.x && y < rhs.y && z < rhs.z);
}
inline bool operator > (const TVector3& rhs) const {
return (x > rhs.x && y > rhs.y && z > rhs.z);
}
public:
inline T length(void) const {
return MathUtil::sqrt(x * x + y * y + z * z);
-8
View File
@@ -210,14 +210,6 @@ public:
return *this;
}
inline bool operator < (const TVector4& rhs) const {
return (x < rhs.x && y < rhs.y && z < rhs.z && w < rhs.w);
}
inline bool operator > (const TVector4& rhs) const {
return (x > rhs.x && y > rhs.y && z > rhs.z && w > rhs.w);
}
public:
inline T dotProduct(const TVector4& vec) const {