Skip to content

Commit

Permalink
Remove redundant transform method in Geometry singleton
Browse files Browse the repository at this point in the history
Transform2D's xform method can be used instead which handles
`PoolVector2Array` now (as well as 3D version).
  • Loading branch information
Andrii Doroshenko (Xrayez) committed Sep 1, 2019
1 parent a758175 commit 0827258
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 31 deletions.
7 changes: 0 additions & 7 deletions core/bind/core_bind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1689,11 +1689,6 @@ Array _Geometry::offset_polyline_2d(const Vector<Vector2> &p_polygon, real_t p_d
return ret;
}

Vector<Point2> _Geometry::transform_points_2d(const Vector<Point2> &p_points, const Transform2D &p_mat) {

return Geometry::transform_points_2d(p_points, p_mat);
}

Dictionary _Geometry::make_atlas(const Vector<Size2> &p_rects) {

Dictionary ret;
Expand Down Expand Up @@ -1773,8 +1768,6 @@ void _Geometry::_bind_methods() {
ClassDB::bind_method(D_METHOD("offset_polygon_2d", "polygon", "delta", "join_type"), &_Geometry::offset_polygon_2d, DEFVAL(JOIN_SQUARE));
ClassDB::bind_method(D_METHOD("offset_polyline_2d", "polyline", "delta", "join_type", "end_type"), &_Geometry::offset_polyline_2d, DEFVAL(JOIN_SQUARE), DEFVAL(END_SQUARE));

ClassDB::bind_method(D_METHOD("transform_points_2d", "points", "transform"), &_Geometry::transform_points_2d);

ClassDB::bind_method(D_METHOD("make_atlas", "sizes"), &_Geometry::make_atlas);

BIND_ENUM_CONSTANT(OPERATION_UNION);
Expand Down
2 changes: 0 additions & 2 deletions core/bind/core_bind.h
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,6 @@ class _Geometry : public Object {
Array offset_polygon_2d(const Vector<Vector2> &p_polygon, real_t p_delta, PolyJoinType p_join_type = JOIN_SQUARE);
Array offset_polyline_2d(const Vector<Vector2> &p_polygon, real_t p_delta, PolyJoinType p_join_type = JOIN_SQUARE, PolyEndType p_end_type = END_SQUARE);

Vector<Point2> transform_points_2d(const Vector<Point2> &p_points, const Transform2D &p_mat);

Dictionary make_atlas(const Vector<Size2> &p_rects);

_Geometry();
Expand Down
10 changes: 0 additions & 10 deletions core/math/geometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -832,16 +832,6 @@ class Geometry {
return _polypath_offset(p_polygon, p_delta, p_join_type, p_end_type);
}

static Vector<Point2> transform_points_2d(const Vector<Point2> &p_points, const Transform2D &p_mat) {

Vector<Point2> points;

for (int i = 0; i < p_points.size(); ++i) {
points.push_back(p_mat.xform(p_points[i]));
}
return points;
}

static Vector<int> triangulate_delaunay_2d(const Vector<Vector2> &p_points) {

Vector<Delaunay2D::Triangle> tr = Delaunay2D::triangulate(p_points);
Expand Down
12 changes: 0 additions & 12 deletions doc/classes/Geometry.xml
Original file line number Diff line number Diff line change
Expand Up @@ -441,18 +441,6 @@
Tests if the segment ([code]from[/code], [code]to[/code]) intersects the triangle [code]a[/code], [code]b[/code], [code]c[/code]. If yes, returns the point of intersection as [Vector3]. If no intersection takes place, an empty [Variant] is returned.
</description>
</method>
<method name="transform_points_2d">
<return type="PoolVector2Array">
</return>
<argument index="0" name="points" type="PoolVector2Array">
</argument>
<argument index="1" name="transform" type="Transform2D">
</argument>
<description>
Transforms an array of points by [code]transform[/code] and returns the result.
Can be useful in conjunction with performing polygon boolean operations in a CSG-like manner, see [method merge_polygons_2d], [method clip_polygons_2d], [method intersect_polygons_2d], [method exclude_polygons_2d].
</description>
</method>
<method name="triangulate_delaunay_2d">
<return type="PoolIntArray">
</return>
Expand Down

0 comments on commit 0827258

Please sign in to comment.