summaryrefslogtreecommitdiffstats
path: root/core/math/math_2d.h
diff options
context:
space:
mode:
authorFerenc Arn <tagcup@yahoo.com>2017-03-31 10:25:09 -0500
committerFerenc Arn <tagcup@yahoo.com>2017-04-03 10:02:12 -0500
commit1a620bd5faebd83015182ea032f40936a9916af6 (patch)
treee1705e3805bae8cb898694136f65d7622dd2bc8c /core/math/math_2d.h
parent6731924dcfa7451d8b31461b438fd2a5aa8af1f6 (diff)
downloadredot-engine-1a620bd5faebd83015182ea032f40936a9916af6.tar.gz
Made slide and reflect active verbs acting on itself in Vector2 and Vector3.
This is in alignment with other functions in vector classes. Also added checks for normalization, fixed the sign of reflect (which now corresponds to reflection along a plane mathematically), added bounce method and updated docs. Fixes #8201.
Diffstat (limited to 'core/math/math_2d.h')
-rw-r--r--core/math/math_2d.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/core/math/math_2d.h b/core/math/math_2d.h
index af6437d7f1..50ebcb845f 100644
--- a/core/math/math_2d.h
+++ b/core/math/math_2d.h
@@ -82,6 +82,7 @@ struct Vector2 {
void normalize();
Vector2 normalized() const;
+ bool is_normalized() const;
real_t length() const;
real_t length_squared() const;
@@ -106,6 +107,7 @@ struct Vector2 {
Vector2 cubic_interpolate_soft(const Vector2 &p_b, const Vector2 &p_pre_a, const Vector2 &p_post_b, real_t p_t) const;
Vector2 slide(const Vector2 &p_vec) const;
+ Vector2 bounce(const Vector2 &p_vec) const;
Vector2 reflect(const Vector2 &p_vec) const;
Vector2 operator+(const Vector2 &p_v) const;