Textual improvement
This commit is contained in:
parent
0c54276bd5
commit
c411b43949
@ -53,6 +53,10 @@ const Vector2 Vector2::down = Vector2(0, -1);
|
|||||||
const Vector2 Vector2::forward = Vector2(0, 1);
|
const Vector2 Vector2::forward = Vector2(0, 1);
|
||||||
const Vector2 Vector2::back = Vector2(0, -1);
|
const Vector2 Vector2::back = Vector2(0, -1);
|
||||||
|
|
||||||
|
bool Vector2::operator==(const Vector2 &v) {
|
||||||
|
return (this->x == v.x && this->y == v.y);
|
||||||
|
}
|
||||||
|
|
||||||
float Vector2::Magnitude(const Vector2 &a) {
|
float Vector2::Magnitude(const Vector2 &a) {
|
||||||
return sqrtf(a.x * a.x + a.y * a.y);
|
return sqrtf(a.x * a.x + a.y * a.y);
|
||||||
}
|
}
|
||||||
@ -104,10 +108,6 @@ float Vector2::Dot(const Vector2 &v1, const Vector2 &v2) {
|
|||||||
return v1.x * v2.x + v1.y * v2.y;
|
return v1.x * v2.x + v1.y * v2.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Vector2::operator==(const Vector2 &v) {
|
|
||||||
return (this->x == v.x && this->y == v.y);
|
|
||||||
}
|
|
||||||
|
|
||||||
float Vector2::Distance(const Vector2 &p1, const Vector2 &p2) {
|
float Vector2::Distance(const Vector2 &p1, const Vector2 &p2) {
|
||||||
return Magnitude(p1 - p2);
|
return Magnitude(p1 - p2);
|
||||||
}
|
}
|
||||||
|
16
Vector2.h
16
Vector2.h
@ -98,6 +98,13 @@ public:
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
const static Vector2 back;
|
const static Vector2 back;
|
||||||
|
|
||||||
|
/// @brief Check if this vector to the given vector
|
||||||
|
/// @param vector The vector to check against
|
||||||
|
/// @return true if it is identical to the given vector
|
||||||
|
/// @note This uses float comparison to check equality which may
|
||||||
|
/// have strange effects. Equality on floats should be avoided.
|
||||||
|
bool operator==(const Vector2 &vector);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The length of a vector
|
/// The length of a vector
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -189,15 +196,6 @@ public:
|
|||||||
/// <returns>The dot product of the two vectors</returns>
|
/// <returns>The dot product of the two vectors</returns>
|
||||||
static float Dot(const Vector2 &vector1, const Vector2 &vector2);
|
static float Dot(const Vector2 &vector1, const Vector2 &vector2);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Check is this vector is equal to the given vector
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="vector">The vector to check against</param>
|
|
||||||
/// <returns>True if it is identical to the given vector</returns>
|
|
||||||
/// Note this uses float comparison to check equality which
|
|
||||||
/// may have strange effects. Equality on float should be avoided.
|
|
||||||
bool operator==(const Vector2 &vector);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The distance between two vectors
|
/// The distance between two vectors
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user