修改了Vector3D的Equals和GetHashCode方法
This commit is contained in:
parent
2f692dffbd
commit
cabe390112
@ -109,6 +109,20 @@ namespace ActiveProtect.Models
|
||||
return !(left == right);
|
||||
}
|
||||
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
if (obj is Vector3D other)
|
||||
{
|
||||
return this == other;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine(X, Y, Z);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 计算向量的模长
|
||||
/// </summary>
|
||||
@ -190,6 +204,7 @@ namespace ActiveProtect.Models
|
||||
Vector3D unitDirection = direction.Normalize();
|
||||
return a + unitDirection * distance;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user