aboutsummaryrefslogtreecommitdiff
path: root/core/math/math_2d.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/math/math_2d.cpp')
-rw-r--r--core/math/math_2d.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/math/math_2d.cpp b/core/math/math_2d.cpp
index acaaa327f..6c160abac 100644
--- a/core/math/math_2d.cpp
+++ b/core/math/math_2d.cpp
@@ -74,7 +74,7 @@ float Vector2::distance_squared_to(const Vector2& p_vector2) const {
float Vector2::angle_to(const Vector2& p_vector2) const {
- return Math::atan2( x-p_vector2.x, y - p_vector2.y );
+ return Math::atan2( tangent().dot(p_vector2), dot(p_vector2) );
}
float Vector2::dot(const Vector2& p_other) const {
@@ -594,6 +594,10 @@ Matrix32 Matrix32::rotated(float p_phi) const {
}
+float Matrix32::basis_determinant() const {
+
+ return elements[0].x * elements[1].y - elements[0].y * elements[1].x;
+}
Matrix32 Matrix32::interpolate_with(const Matrix32& p_transform, float p_c) const {