mirror of
https://github.com/ZDoom/Raze.git
synced 2025-05-31 01:11:15 +00:00
- added a Sum function to TVector familiy
Duke uses this kind of distance check quite a lot so it makes sense to add it to the vectors.
This commit is contained in:
parent
1d7f2c81b6
commit
3352783be2
3 changed files with 24 additions and 6 deletions
|
@ -237,6 +237,12 @@ struct TVector2
|
|||
{
|
||||
return X*X + Y*Y;
|
||||
}
|
||||
|
||||
double Sum() const
|
||||
{
|
||||
return abs(X) + abs(Y);
|
||||
}
|
||||
|
||||
|
||||
// Return a unit vector facing the same direction as this one
|
||||
TVector2 Unit() const
|
||||
|
@ -601,6 +607,12 @@ struct TVector3
|
|||
{
|
||||
return X*X + Y*Y + Z*Z;
|
||||
}
|
||||
|
||||
double Sum() const
|
||||
{
|
||||
return abs(X) + abs(Y) + abs(Z);
|
||||
}
|
||||
|
||||
|
||||
// Return a unit vector facing the same direction as this one
|
||||
TVector3 Unit() const
|
||||
|
@ -900,6 +912,12 @@ struct TVector4
|
|||
{
|
||||
return X*X + Y*Y + Z*Z + W*W;
|
||||
}
|
||||
|
||||
double Sum() const
|
||||
{
|
||||
return abs(X) + abs(Y) + abs(Z) + abs(W);
|
||||
}
|
||||
|
||||
|
||||
// Return a unit vector facing the same direction as this one
|
||||
TVector4 Unit() const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue