diff options
| author | Juan Linietsky | 2014-02-19 11:57:14 -0300 |
|---|---|---|
| committer | Juan Linietsky | 2014-02-19 11:57:14 -0300 |
| commit | d7d65fa2f2b51d03f7bdfcbceedca99188ce979c (patch) | |
| tree | fecdf1bfa39ba5a4895b4dbf340a3b68098c109a /core/math/math_2d.cpp | |
| parent | 8c1731b67995add31361ae526b0e6af76346181e (diff) | |
| download | godot-d7d65fa2f2b51d03f7bdfcbceedca99188ce979c.tar.gz godot-d7d65fa2f2b51d03f7bdfcbceedca99188ce979c.tar.zst godot-d7d65fa2f2b51d03f7bdfcbceedca99188ce979c.zip | |
Diffstat (limited to 'core/math/math_2d.cpp')
| -rw-r--r-- | core/math/math_2d.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/core/math/math_2d.cpp b/core/math/math_2d.cpp index dbeaea6e7..acaaa327f 100644 --- a/core/math/math_2d.cpp +++ b/core/math/math_2d.cpp @@ -255,6 +255,16 @@ Vector2 Vector2::cubic_interpolate(const Vector2& p_b,const Vector2& p_pre_a, co } +Vector2 Vector2::slide(const Vector2& p_vec) const { + + return p_vec - *this * this->dot(p_vec); +} +Vector2 Vector2::reflect(const Vector2& p_vec) const { + + return p_vec - *this * this->dot(p_vec) * 2.0; + +} + bool Rect2::intersects_segment(const Point2& p_from, const Point2& p_to, Point2* r_pos,Point2* r_normal) const { |
