diff options
author | tatiana-yan <tatiana.kondakova@gmail.com> | 2019-04-10 12:31:19 +0300 |
---|---|---|
committer | mpimenov <mpimenov@users.noreply.github.com> | 2019-04-10 14:06:59 +0300 |
commit | 5d9dc344478b3ada00695a18b3a7d69a02b66e9e (patch) | |
tree | acc78689f0e3cc2d50b4b9bc1a267d04cd48d2e9 /geometry | |
parent | dc6fa6d3e2309c32fd280b77767b18d25af048c8 (diff) |
[std][geometry] Use new include style for geometry.
Diffstat (limited to 'geometry')
-rw-r--r-- | geometry/geometry_tests/algorithm_test.cpp | 6 | ||||
-rw-r--r-- | geometry/geometry_tests/clipping_test.cpp | 6 | ||||
-rw-r--r-- | geometry/geometry_tests/covering_test.cpp | 4 | ||||
-rw-r--r-- | geometry/geometry_tests/robust_test.cpp | 4 | ||||
-rw-r--r-- | geometry/geometry_tests/spline_test.cpp | 5 | ||||
-rw-r--r-- | geometry/polygon.hpp | 27 | ||||
-rw-r--r-- | geometry/spline.cpp | 4 | ||||
-rw-r--r-- | geometry/spline.hpp | 30 | ||||
-rw-r--r-- | geometry/triangle2d.hpp | 8 |
9 files changed, 55 insertions, 39 deletions
diff --git a/geometry/geometry_tests/algorithm_test.cpp b/geometry/geometry_tests/algorithm_test.cpp index efde4580c5..1ef0a8d0ca 100644 --- a/geometry/geometry_tests/algorithm_test.cpp +++ b/geometry/geometry_tests/algorithm_test.cpp @@ -2,7 +2,11 @@ #include "geometry/algorithm.hpp" -#include "std/vector.hpp" +#include "base/assert.hpp" + +#include <vector> + +using namespace std; using m2::PointD; using m2::RectD; diff --git a/geometry/geometry_tests/clipping_test.cpp b/geometry/geometry_tests/clipping_test.cpp index 3aa200705d..7211fc5f88 100644 --- a/geometry/geometry_tests/clipping_test.cpp +++ b/geometry/geometry_tests/clipping_test.cpp @@ -2,7 +2,11 @@ #include "geometry/clipping.hpp" -#include "std/utility.hpp" +#include <cstddef> +#include <utility> +#include <vector> + +using namespace std; namespace { diff --git a/geometry/geometry_tests/covering_test.cpp b/geometry/geometry_tests/covering_test.cpp index a3803560ce..73da4af258 100644 --- a/geometry/geometry_tests/covering_test.cpp +++ b/geometry/geometry_tests/covering_test.cpp @@ -7,8 +7,12 @@ #include "base/stl_helpers.hpp" +#include <vector> + // TODO: Add covering unit tests here. +using namespace std; + using CellId = m2::CellId<5>; UNIT_TEST(CoverTriangle_Simple) diff --git a/geometry/geometry_tests/robust_test.cpp b/geometry/geometry_tests/robust_test.cpp index c26433b198..f1b7e1f51d 100644 --- a/geometry/geometry_tests/robust_test.cpp +++ b/geometry/geometry_tests/robust_test.cpp @@ -4,7 +4,7 @@ #include "geometry/segment2d.hpp" #include "geometry/triangle2d.hpp" -#include "std/iterator.hpp" +#include <iterator> using namespace m2::robust; @@ -16,7 +16,7 @@ template <typename TIt> void CheckSelfIntersections(TIt beg, TIt end, bool res) { TEST_EQUAL(CheckPolygonSelfIntersections(beg, end), res, ()); - using TRevIt = reverse_iterator<TIt>; + using TRevIt = std::reverse_iterator<TIt>; TEST_EQUAL(CheckPolygonSelfIntersections(TRevIt(end), TRevIt(beg)), res, ()); } diff --git a/geometry/geometry_tests/spline_test.cpp b/geometry/geometry_tests/spline_test.cpp index 2dd88f1b46..ea13bcb677 100644 --- a/geometry/geometry_tests/spline_test.cpp +++ b/geometry/geometry_tests/spline_test.cpp @@ -1,7 +1,12 @@ #include "testing/testing.hpp" + #include "geometry/geometry_tests/equality.hpp" #include "geometry/spline.hpp" +#include <vector> + +using namespace std; + using m2::Spline; using m2::PointD; diff --git a/geometry/polygon.hpp b/geometry/polygon.hpp index 8b67bc070a..59ddf5b835 100644 --- a/geometry/polygon.hpp +++ b/geometry/polygon.hpp @@ -7,9 +7,8 @@ #include "base/math.hpp" #include "base/stl_helpers.hpp" -#include "std/iterator.hpp" -#include "std/limits.hpp" - +#include <iterator> +#include <limits> template <typename IsVisibleF> bool FindSingleStripForIndex(size_t i, size_t n, IsVisibleF isVisible) @@ -20,7 +19,7 @@ bool FindSingleStripForIndex(size_t i, size_t n, IsVisibleF isVisible) size_t b = base::NextModN(i, n); for (size_t j = 2; j < n; ++j) { - ASSERT_NOT_EQUAL ( a, b, () ); + ASSERT_NOT_EQUAL(a, b, ()); if (!isVisible(a, b)) return false; if (j & 1) @@ -29,7 +28,7 @@ bool FindSingleStripForIndex(size_t i, size_t n, IsVisibleF isVisible) b = base::NextModN(b, n); } - ASSERT_EQUAL ( a, b, () ); + ASSERT_EQUAL(a, b, ()); return true; } @@ -49,8 +48,8 @@ size_t FindSingleStrip(size_t n, IsVisibleF isVisible) #ifdef DEBUG template <typename IterT> bool TestPolygonPreconditions(IterT beg, IterT end) { - ASSERT_GREATER ( distance(beg, end), 2, () ); - ASSERT ( !AlmostEqualULPs(*beg, *(--end)), () ); + ASSERT_GREATER(std::distance(beg, end), 2, ()); + ASSERT(!AlmostEqualULPs(*beg, *(--end)), ()); return true; } #endif @@ -58,10 +57,10 @@ template <typename IterT> bool TestPolygonPreconditions(IterT beg, IterT end) /// Is polygon [beg, end) has CCW orientation. template <typename IterT> bool IsPolygonCCW(IterT beg, IterT end) { - ASSERT ( TestPolygonPreconditions(beg, end), () ); + ASSERT(TestPolygonPreconditions(beg, end), ()); // find the most down (left) point - double minY = numeric_limits<double>::max(); + double minY = std::numeric_limits<double>::max(); IterT iRes; for (IterT i = beg; i != end; ++i) { @@ -78,7 +77,7 @@ template <typename IterT> bool IsPolygonCCW(IterT beg, IterT end) return (cp > 0.0); // find the most up (left) point - double maxY = numeric_limits<double>::min(); + double maxY = std::numeric_limits<double>::min(); for (IterT i = beg; i != end; ++i) { if ((*i).y > maxY || ((*i).y == maxY && (*i).x < (*iRes).x)) @@ -101,9 +100,9 @@ template <typename IterT> bool IsPolygonCCW(IterT beg, IterT end) template <typename IterT> bool IsDiagonalVisible(IterT beg, IterT end, IterT i0, IterT i1) { - ASSERT ( IsPolygonCCW(beg, end), () ); - ASSERT ( TestPolygonPreconditions(beg, end), () ); - ASSERT ( i0 != i1, () ); + ASSERT(IsPolygonCCW(beg, end), ()); + ASSERT(TestPolygonPreconditions(beg, end), ()); + ASSERT(i0 != i1, ()); IterT const prev = base::PrevIterInCycle(i0, beg, end); IterT const next = base::NextIterInCycle(i0, beg, end); @@ -164,7 +163,7 @@ namespace detail template <typename F> void MakeSingleStripFromIndex(size_t i, size_t n, F f) { - ASSERT_LESS ( i, n, () ); + ASSERT_LESS(i, n, ()); f(i); FindSingleStripForIndex(i, n, detail::StripEmitter<F>(f)); } diff --git a/geometry/spline.cpp b/geometry/spline.cpp index cb9b9e1d94..b80e22a50d 100644 --- a/geometry/spline.cpp +++ b/geometry/spline.cpp @@ -2,7 +2,9 @@ #include "base/logging.hpp" -#include "std/numeric.hpp" +#include <numeric> + +using namespace std; namespace m2 { diff --git a/geometry/spline.hpp b/geometry/spline.hpp index 211f5a9d47..d1a50dc2ad 100644 --- a/geometry/spline.hpp +++ b/geometry/spline.hpp @@ -1,13 +1,12 @@ #pragma once -#include "std/vector.hpp" -#include "std/shared_ptr.hpp" - #include "geometry/point2d.hpp" +#include <memory> +#include <vector> + namespace m2 { - class Spline { public: @@ -48,16 +47,16 @@ public: public: Spline() {} Spline(size_t reservedSize); - Spline(vector<PointD> const & path); + Spline(std::vector<PointD> const & path); Spline const & operator = (Spline const & spl); void AddPoint(PointD const & pt); void ReplacePoint(PointD const & pt); bool IsPrelonging(PointD const & pt); size_t GetSize() const; - vector<PointD> const & GetPath() const { return m_position; } - vector<double> const & GetLengths() const { return m_length; } - vector<PointD> const & GetDirections() const { return m_direction; } + std::vector<PointD> const & GetPath() const { return m_position; } + std::vector<double> const & GetLengths() const { return m_length; } + std::vector<PointD> const & GetDirections() const { return m_direction; } void Clear(); iterator GetPoint(double step) const; @@ -82,22 +81,22 @@ public: double GetLength() const; private: - vector<PointD> m_position; - vector<PointD> m_direction; - vector<double> m_length; + std::vector<PointD> m_position; + std::vector<PointD> m_direction; + std::vector<double> m_length; }; class SharedSpline { public: SharedSpline() {} - SharedSpline(vector<PointD> const & path); + SharedSpline(std::vector<PointD> const & path); SharedSpline(SharedSpline const & other); SharedSpline const & operator= (SharedSpline const & spl); bool IsNull() const; void Reset(Spline * spline); - void Reset(vector<PointD> const & path); + void Reset(std::vector<PointD> const & path); Spline::iterator CreateIterator() const; @@ -107,7 +106,6 @@ public: Spline const * Get() const; private: - shared_ptr<Spline> m_spline; + std::shared_ptr<Spline> m_spline; }; - -} +} // namespace m2 diff --git a/geometry/triangle2d.hpp b/geometry/triangle2d.hpp index e63e8ee832..c022f44f33 100644 --- a/geometry/triangle2d.hpp +++ b/geometry/triangle2d.hpp @@ -2,7 +2,7 @@ #include "point2d.hpp" -#include "std/vector.hpp" +#include <vector> namespace m2 { @@ -33,11 +33,11 @@ double GetTriangleArea(Point<T> const & p1, Point<T> const & p2, Point<T> const } m2::PointD GetRandomPointInsideTriangle(m2::TriangleD const & t); -m2::PointD GetRandomPointInsideTriangles(vector<m2::TriangleD> const & v); +m2::PointD GetRandomPointInsideTriangles(std::vector<m2::TriangleD> const & v); // Project point to the nearest edge of the nearest triangle from list of triangles. // pt must be outside triangles. -m2::PointD ProjectPointToTriangles(m2::PointD const & pt, vector<m2::TriangleD> const & v); +m2::PointD ProjectPointToTriangles(m2::PointD const & pt, std::vector<m2::TriangleD> const & v); /// @param[in] pt - Point to check /// @param[in] p1, p2, p3 - Triangle @@ -48,7 +48,7 @@ bool IsPointInsideTriangle(m2::PointD const & pt, m2::PointD const & p1, bool IsPointStrictlyInsideTriangle(m2::PointD const & pt, m2::PointD const & p1, m2::PointD const & p2, m2::PointD const & p3); -bool IsPointInsideTriangles(m2::PointD const & pt, vector<m2::TriangleD> const & v); +bool IsPointInsideTriangles(m2::PointD const & pt, std::vector<m2::TriangleD> const & v); //@} } // namespace m2 |