mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 07:53:26 +00:00
Merge pull request #109897 from WhalesState/geo2d-opt
Geometry2D minor optimization
This commit is contained in:
commit
075d99fc11
1 changed files with 9 additions and 5 deletions
|
@ -292,14 +292,16 @@ Vector<Vector<Point2>> Geometry2D::_polypaths_do_operation(PolyBooleanOperation
|
|||
}
|
||||
|
||||
Vector<Vector<Point2>> polypaths;
|
||||
for (PathsD::size_type i = 0; i < paths.size(); ++i) {
|
||||
polypaths.resize(paths.size());
|
||||
for (PathsD::size_type i = 0; i < paths.size(); i++) {
|
||||
const PathD &path = paths[i];
|
||||
|
||||
Vector<Vector2> polypath;
|
||||
polypath.resize(path.size());
|
||||
for (PathsD::size_type j = 0; j < path.size(); ++j) {
|
||||
polypath.push_back(Point2(static_cast<real_t>(path[j].x), static_cast<real_t>(path[j].y)));
|
||||
polypath.set(j, Point2(static_cast<real_t>(path[j].x), static_cast<real_t>(path[j].y)));
|
||||
}
|
||||
polypaths.push_back(polypath);
|
||||
polypaths.set(i, polypath);
|
||||
}
|
||||
return polypaths;
|
||||
}
|
||||
|
@ -353,14 +355,16 @@ Vector<Vector<Point2>> Geometry2D::_polypath_offset(const Vector<Point2> &p_poly
|
|||
// to attain the desired precision.
|
||||
|
||||
Vector<Vector<Point2>> polypaths;
|
||||
polypaths.resize(paths.size());
|
||||
for (PathsD::size_type i = 0; i < paths.size(); ++i) {
|
||||
const PathD &path = paths[i];
|
||||
|
||||
Vector<Vector2> polypath2;
|
||||
polypath2.resize(path.size());
|
||||
for (PathsD::size_type j = 0; j < path.size(); ++j) {
|
||||
polypath2.push_back(Point2(static_cast<real_t>(path[j].x), static_cast<real_t>(path[j].y)));
|
||||
polypath2.set(j, Point2(static_cast<real_t>(path[j].x), static_cast<real_t>(path[j].y)));
|
||||
}
|
||||
polypaths.push_back(polypath2);
|
||||
polypaths.set(i, polypath2);
|
||||
}
|
||||
return polypaths;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue