forked from codysauermann/GeometricDataStructures2D
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPoint2D.cpp
More file actions
31 lines (25 loc) · 836 Bytes
/
Copy pathPoint2D.cpp
File metadata and controls
31 lines (25 loc) · 836 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "Point2D.h"
#include <algorithm>
using namespace std;
struct Point2D::Impl
{
Impl(){};
Impl(vector<SimplePoint2D> _pointCollection): pointCollection(move(_pointCollection)){};
vector<SimplePoint2D> pointCollection;
};
Point2D::Point2D() {}
Point2D::Point2D(vector<SimplePoint2D> _pointCollection):pimpl(new Impl())
{
_pointCollection.erase(unique(_pointCollection.begin(), _pointCollection.end()), _pointCollection.end());
sort(_pointCollection.begin(), _pointCollection.end());
this->pimpl->pointCollection = _pointCollection;
}
Point2D::Point2D(Point2D const &sourcePoint2D): pimpl(new Impl(*sourcePoint2D.pimpl))
{
}
Point2D::Point2D(Point2D &&sourcePoint2D)
{
this->pimpl = move(sourcePoint2D.pimpl);
sourcePoint2D.pimpl = nullptr;
}
Point2D::~Point2D(){}