mirror of
https://github.com/ZDoom/Raze.git
synced 2025-03-13 20:42:11 +00:00
- added a 'dot' function to DVector2 because using the '|' operator is not intuitive.
This commit is contained in:
parent
9d101a4f73
commit
7f3c5ae18d
3 changed files with 10 additions and 0 deletions
|
@ -272,6 +272,11 @@ struct TVector2
|
|||
return X*other.X + Y*other.Y;
|
||||
}
|
||||
|
||||
vec_t dot(const TVector2 &other) const
|
||||
{
|
||||
return X*other.X + Y*other.Y;
|
||||
}
|
||||
|
||||
// Returns the angle that the ray (0,0)-(X,Y) faces
|
||||
TAngle<vec_t> Angle() const;
|
||||
|
||||
|
|
|
@ -81,6 +81,7 @@ class fixedhoriz
|
|||
public:
|
||||
fixedhoriz() = default;
|
||||
fixedhoriz(const fixedhoriz &other) = default;
|
||||
fixedhoriz& operator=(const fixedhoriz&) = default;
|
||||
|
||||
// This class intentionally makes no allowances for implicit type conversions because those would render it ineffective.
|
||||
constexpr short asbuild() const { return FixedToInt(value); }
|
||||
|
|
|
@ -13,6 +13,8 @@ struct vec2_t
|
|||
|
||||
vec2_t() = default;
|
||||
vec2_t(const vec2_t&) = default;
|
||||
vec2_t& operator=(const vec2_t&) = default;
|
||||
|
||||
vec2_t(int x, int y) : X(x), Y(y) {}
|
||||
vec2_t operator+(const vec2_t& other) const { return { X + other.X, Y + other.Y }; }
|
||||
vec2_t operator-(const vec2_t& other) const { return { X - other.X, Y - other.Y }; }
|
||||
|
@ -36,6 +38,8 @@ struct vec3_t
|
|||
|
||||
vec3_t() = default;
|
||||
vec3_t(const vec3_t&) = default;
|
||||
vec3_t& operator=(const vec3_t&) = default;
|
||||
|
||||
vec3_t(int x, int y, int z) : X(x), Y(y), Z(z) {}
|
||||
vec3_t operator+(const vec3_t& other) const { return { X + other.X, Y + other.Y, Z + other.Z }; }
|
||||
vec3_t operator-(const vec3_t& other) const { return { X - other.X, Y - other.Y, Z - other.Z }; }
|
||||
|
|
Loading…
Reference in a new issue