Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 72 additions & 30 deletions include/Vector2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,73 +202,115 @@ class Vector2 : public ::Vector2 {
}

/**
* Calculate vector length
* Normalize provided vector
*/
inline float Length() const {
return Vector2Length(*this);
inline Vector2 Normalize() const {
return Vector2Normalize(*this);
}

/**
* Calculate vector square length
* Transforms a Vector2 by a given Matrix
*/
inline float LengthSqr() const {
return Vector2LengthSqr(*this);
inline Vector2 Transform(::Matrix mat) {
return ::Vector2Transform(*this, mat);
}

/**
* Normalize provided vector
* Calculate linear interpolation between two vectors
*/
inline Vector2 Normalize() const {
return Vector2Normalize(*this);
inline Vector2 Lerp(const ::Vector2& vector2, float amount) const {
return Vector2Lerp(*this, vector2, amount);
}

/**
* Calculate two vectors dot product
* Calculate reflected vector to normal
*/
inline float DotProduct(const ::Vector2& vector2) const {
return Vector2DotProduct(*this, vector2);
inline Vector2 Reflect(const ::Vector2& normal) const {
return Vector2Reflect(*this, normal);
}

/**
* Calculate angle from two vectors in X-axis
* Rotate Vector by float in Degrees
*/
inline float Angle(const ::Vector2& vector2) const {
return Vector2Angle(*this, vector2);
inline Vector2 Rotate(float degrees) const {
return Vector2Rotate(*this, degrees);
}

/**
* Calculate distance between two vectors
* Move Vector towards target
*/
inline float Distance(const ::Vector2& vector2) const {
return Vector2Distance(*this, vector2);
inline Vector2 MoveTowards(const ::Vector2& target, float maxDistance) const {
return Vector2MoveTowards(*this, target, maxDistance);
}

/**
* Calculate linear interpolation between two vectors
* Invert the given vector
*/
inline Vector2 Lerp(const ::Vector2& vector2, float amount) const {
return Vector2Lerp(*this, vector2, amount);
inline Vector2 Invert() {
return ::Vector2Invert(*this);
}

/**
* Calculate reflected vector to normal
* Clamp the components of the vector between
*/
inline Vector2 Reflect(const ::Vector2& normal) const {
return Vector2Reflect(*this, normal);
inline Vector2 Clamp(::Vector2 min, ::Vector2 max) {
return ::Vector2Clamp(*this, min, max);
}

/**
* Rotate Vector by float in Degrees
* // Clamp the magnitude of the vector between two min and max values
*/
inline Vector2 Rotate(float degrees) const {
return Vector2Rotate(*this, degrees);
inline Vector2 Clamp(float min, float max) {
return ::Vector2ClampValue(*this, min, max);
}

/**
* Move Vector towards target
* Check whether two given vectors are almost equal
*/
inline Vector2 MoveTowards(const ::Vector2& target, float maxDistance) const {
return Vector2MoveTowards(*this, target, maxDistance);
inline int Equals(::Vector2 q) {
return ::Vector2Equals(*this, q);
}

/**
* Calculate vector length
*/
inline float Length() const {
return Vector2Length(*this);
}

/**
* Calculate vector square length
*/
inline float LengthSqr() const {
return Vector2LengthSqr(*this);
}

/**
* Calculate two vectors dot product
*/
inline float DotProduct(const ::Vector2& vector2) const {
return Vector2DotProduct(*this, vector2);
}

/**
* Calculate distance between two vectors
*/
inline float Distance(const ::Vector2& vector2) const {
return Vector2Distance(*this, vector2);
}

/**
* Calculate square distance between two vectors
*/
inline float DistanceSqr(::Vector2 v2) {
return ::Vector2DistanceSqr(*this, v2);
}

/**
* Calculate angle from two vectors in X-axis
*/
inline float Angle(const ::Vector2& vector2) const {
return Vector2Angle(*this, vector2);
}

/**
Expand Down