25 const auto& _vecs = rpoly.
vectors();
30 std::vector<Vector2<T>> new_vecs;
33 for (
const auto& next_point : _vecs) {
34 if (current_point.
x() != next_point.x() && current_point.
y() != next_point.y()) {
36 new_vecs.emplace_back(next_point.x(), current_point.
y());
38 new_vecs.emplace_back(next_point);
39 current_point = next_point;
44 if (current_point.
x() != first_point.
x() && current_point.
y() != first_point.
y()) {
45 new_vecs.emplace_back(first_point.
x(), current_point.
y());
48 return Polygon<T>(rpoly.origin(), std::move(new_vecs));
Polygon.
Definition polygon.hpp:23
constexpr const std::vector< Vector2< T > > & vectors() const
Gets the displacement vectors of the polygon.
Definition polygon.hpp:124
Definition rpolygon.hpp:86
2D vector template class.
Definition vector2.hpp:28
constexpr auto x() const noexcept -> const T1 &
Returns a const reference to the x-coordinate of the vector.
Definition vector2.hpp:72
constexpr auto y() const noexcept -> const T2 &
Returns a const reference to the y-coordinate of the vector.
Definition vector2.hpp:81
Definition svg_utils.hpp:12
constexpr auto to_polygon(const RPolygon< T > &rpoly) -> Polygon< T >
Converts a rectilinear polygon to a general polygon.
Definition to_polygon.hpp:24
General polygon template class with geometric properties.
Rectilinear polygon (RPolygon) template class.