diff options
author | Andrii Doroshenko (Xrayez) <xrayez@gmail.com> | 2019-06-27 00:20:22 +0300 |
---|---|---|
committer | Andrii Doroshenko (Xrayez) <xrayez@gmail.com> | 2019-06-27 00:20:22 +0300 |
commit | 6f2233d13a1524ea184c30af066fd65278dcc610 (patch) | |
tree | 5bbf553984661a4664e76ab351ce36c74d09eb1b /core/bind | |
parent | 43a69694706ee5084c154aafb4377e10a2df1ed7 (diff) |
Bind is_point_in_polygon in Geometry singleton
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 8a898f3b53..b6591a4901 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -1524,6 +1524,11 @@ bool _Geometry::is_polygon_clockwise(const Vector<Vector2> &p_polygon) { return Geometry::is_polygon_clockwise(p_polygon); } +bool _Geometry::is_point_in_polygon(const Point2 &p_point, const Vector<Vector2> &p_polygon) { + + return Geometry::is_point_in_polygon(p_point, p_polygon); +} + Vector<int> _Geometry::triangulate_polygon(const Vector<Vector2> &p_polygon) { return Geometry::triangulate_polygon(p_polygon); @@ -1706,6 +1711,7 @@ void _Geometry::_bind_methods() { ClassDB::bind_method(D_METHOD("point_is_inside_triangle", "point", "a", "b", "c"), &_Geometry::point_is_inside_triangle); ClassDB::bind_method(D_METHOD("is_polygon_clockwise", "polygon"), &_Geometry::is_polygon_clockwise); + ClassDB::bind_method(D_METHOD("is_point_in_polygon", "point", "polygon"), &_Geometry::is_point_in_polygon); ClassDB::bind_method(D_METHOD("triangulate_polygon", "polygon"), &_Geometry::triangulate_polygon); ClassDB::bind_method(D_METHOD("triangulate_delaunay_2d", "points"), &_Geometry::triangulate_delaunay_2d); ClassDB::bind_method(D_METHOD("convex_hull_2d", "points"), &_Geometry::convex_hull_2d); diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index 7d0c158f51..2885e7c0e0 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -408,6 +408,7 @@ public: int get_uv84_normal_bit(const Vector3 &p_vector); bool is_polygon_clockwise(const Vector<Vector2> &p_polygon); + bool is_point_in_polygon(const Point2 &p_point, const Vector<Vector2> &p_polygon); Vector<int> triangulate_polygon(const Vector<Vector2> &p_polygon); Vector<int> triangulate_delaunay_2d(const Vector<Vector2> &p_points); Vector<Point2> convex_hull_2d(const Vector<Point2> &p_points); |