diff options
author | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2017-03-04 01:55:12 +0100 |
---|---|---|
committer | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2017-03-04 01:55:12 +0100 |
commit | eaa6433b3ba22bc047c3cb65be305814ad5b60f9 (patch) | |
tree | 5eae034783475f0270d5e1d83d217e9aa841dec2 /core/bind | |
parent | ee53f85bea20f1d579dae5cce849b4ad9806a9bd (diff) |
Expose Geometry::get_closest_point_to_segment_2d()
Diffstat (limited to 'core/bind')
-rw-r--r-- | core/bind/core_bind.cpp | 6 | ||||
-rw-r--r-- | core/bind/core_bind.h | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 54ab51657b..79cfae0a3a 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -1221,6 +1221,11 @@ PoolVector<Vector3> _Geometry::get_closest_points_between_segments(const Vector3 return r; } +Vector2 _Geometry::get_closest_point_to_segment_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_2d(p_point,s); +} Vector3 _Geometry::get_closest_point_to_segment(const Vector3& p_point, const Vector3& p_a,const Vector3& p_b) { Vector3 s[2]={p_a,p_b}; @@ -1342,6 +1347,7 @@ void _Geometry::_bind_methods() { ClassDB::bind_method(D_METHOD("get_closest_points_between_segments_2d","p1","q1","p2","q2"),&_Geometry::get_closest_points_between_segments_2d); ClassDB::bind_method(D_METHOD("get_closest_points_between_segments","p1","p2","q1","q2"),&_Geometry::get_closest_points_between_segments); + 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_uv84_normal_bit","normal"),&_Geometry::get_uv84_normal_bit); diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index 00cbb254d6..4241912ddd 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -334,6 +334,7 @@ public: Variant segment_intersects_segment_2d(const Vector2& p_from_a,const Vector2& p_to_a,const Vector2& p_from_b,const Vector2& p_to_b); PoolVector<Vector2> get_closest_points_between_segments_2d( const Vector2& p1,const Vector2& q1, const Vector2& p2,const Vector2& q2); 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); 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); |