aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/Vector2.h
diff options
context:
space:
mode:
authorJAROWMR <jarorutjes07@gmail.com>2024-12-07 15:24:51 +0100
committerJAROWMR <jarorutjes07@gmail.com>2024-12-07 15:24:51 +0100
commit478f5f6232c46e1a60c023bf5dcbe2a934f42d84 (patch)
tree7788dc9ae1f340d30565a92c38aa87d962cb06fe /src/crepe/api/Vector2.h
parentfdb4c99e139a264d4e15e6913a3756fc6cccb2f2 (diff)
parent33a072db28d71ba65e59f9491abd42dbf9695fc4 (diff)
pulled AI
Diffstat (limited to 'src/crepe/api/Vector2.h')
-rw-r--r--src/crepe/api/Vector2.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/crepe/api/Vector2.h b/src/crepe/api/Vector2.h
index c278c87..bf9d124 100644
--- a/src/crepe/api/Vector2.h
+++ b/src/crepe/api/Vector2.h
@@ -66,6 +66,30 @@ struct Vector2 {
//! Checks if this vector is not equal to another vector.
bool operator!=(const Vector2<T> & other) const;
+
+ //! Truncates the vector to a maximum length.
+ void truncate(T max);
+
+ //! Normalizes the vector (resulting in vector with a length of 1).
+ void normalize();
+
+ //! Returns the length of the vector.
+ T length() const;
+
+ //! Returns the squared length of the vector.
+ T length_squared() const;
+
+ //! Returns the dot product (inwendig product) of this vector and another vector.
+ T dot(const Vector2<T> & other) const;
+
+ //! Returns the distance between this vector and another vector.
+ T distance(const Vector2<T> & other) const;
+
+ //! Returns the squared distance between this vector and another vector.
+ T distance_squared(const Vector2<T> & other) const;
+
+ //! Returns the perpendicular vector to this vector.
+ Vector2 perpendicular() const;
};
} // namespace crepe