summaryrefslogtreecommitdiff
path: root/core/bind
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2017-03-05 12:04:23 +0100
committerGitHub <noreply@github.com>2017-03-05 12:04:23 +0100
commite6952cad3ac1f80a40f29c950ed15b9d8bb8b588 (patch)
tree3128ce2b16802167fb214d87e2eb543949a58fd1 /core/bind
parent630158c992d62ab1722bf77c26f1be8955b1bce9 (diff)
parent0e0b6ec4439bfb692ddc7a1f0ba15068c0e3a96c (diff)
Merge pull request #7950 from RandomShaper/expose-more-geom
Expose uncapped versions of closest-point-to-segment utilities
Diffstat (limited to 'core/bind')
-rw-r--r--core/bind/core_bind.cpp13
-rw-r--r--core/bind/core_bind.h2
2 files changed, 15 insertions, 0 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index e4348cc406..08e1a311fa 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -1252,6 +1252,16 @@ Vector3 _Geometry::get_closest_point_to_segment(const Vector3& p_point, const Ve
Vector3 s[2]={p_a,p_b};
return Geometry::get_closest_point_to_segment(p_point,s);
}
+Vector2 _Geometry::get_closest_point_to_segment_uncapped_2d(const Vector2& p_point, const Vector2& p_a,const Vector2& p_b) {
+
+ Vector2 s[2]={p_a,p_b};
+ return Geometry::get_closest_point_to_segment_uncapped_2d(p_point,s);
+}
+Vector3 _Geometry::get_closest_point_to_segment_uncapped(const Vector3& p_point, const Vector3& p_a,const Vector3& p_b) {
+
+ Vector3 s[2]={p_a,p_b};
+ return Geometry::get_closest_point_to_segment_uncapped(p_point,s);
+}
Variant _Geometry::ray_intersects_triangle( const Vector3& p_from, const Vector3& p_dir, const Vector3& p_v0,const Vector3& p_v1,const Vector3& p_v2) {
Vector3 res;
@@ -1371,6 +1381,9 @@ void _Geometry::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_closest_point_to_segment_2d","point","s1","s2"),&_Geometry::get_closest_point_to_segment_2d);
ClassDB::bind_method(D_METHOD("get_closest_point_to_segment","point","s1","s2"),&_Geometry::get_closest_point_to_segment);
+ ClassDB::bind_method(D_METHOD("get_closest_point_to_segment_uncapped_2d","point","s1","s2"),&_Geometry::get_closest_point_to_segment_uncapped_2d);
+ ClassDB::bind_method(D_METHOD("get_closest_point_to_segment_uncapped","point","s1","s2"),&_Geometry::get_closest_point_to_segment_uncapped);
+
ClassDB::bind_method(D_METHOD("get_uv84_normal_bit","normal"),&_Geometry::get_uv84_normal_bit);
ClassDB::bind_method(D_METHOD("ray_intersects_triangle","from","dir","a","b","c"),&_Geometry::ray_intersects_triangle);
diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h
index b6aa873767..6b9ae198ef 100644
--- a/core/bind/core_bind.h
+++ b/core/bind/core_bind.h
@@ -341,6 +341,8 @@ public:
PoolVector<Vector3> get_closest_points_between_segments(const Vector3& p1,const Vector3& p2,const Vector3& q1,const Vector3& q2);
Vector2 get_closest_point_to_segment_2d(const Vector2& p_point, const Vector2& p_a,const Vector2& p_b);
Vector3 get_closest_point_to_segment(const Vector3& p_point, const Vector3& p_a,const Vector3& p_b);
+ Vector2 get_closest_point_to_segment_uncapped_2d(const Vector2& p_point, const Vector2& p_a,const Vector2& p_b);
+ Vector3 get_closest_point_to_segment_uncapped(const Vector3& p_point, const Vector3& p_a,const Vector3& p_b);
Variant ray_intersects_triangle( const Vector3& p_from, const Vector3& p_dir, const Vector3& p_v0,const Vector3& p_v1,const Vector3& p_v2);
Variant segment_intersects_triangle( const Vector3& p_from, const Vector3& p_to, const Vector3& p_v0,const Vector3& p_v1,const Vector3& p_v2);
bool point_is_inside_triangle(const Vector2& s, const Vector2& a, const Vector2& b, const Vector2& c) const;