forked from LibreCAD/LibreCAD
/
geospline.h
42 lines (33 loc) · 1.24 KB
/
geospline.h
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
32
33
34
35
36
37
38
39
40
41
42
#ifndef GEOSPLINE_H
#define GEOSPLINE_H
#include "cad/const.h"
#include "geocoordinate.h"
namespace lc {
namespace geo {
// TODO: Should Spline be a arc with a start angle of 0 and a stop angle of 2PI ?
class Spline {
public:
Spline(const std::vector<Coordinate>& control_points, int degree, bool closed);
const std::vector<Coordinate> control_points() const;
int degree() const;
bool closed() const;
/*!
* \brief returns the nearest Point On Path
* \param lc::geo::Coordinate coord
* \return lc::geo::Coordinate
*/
Coordinate nearestPointOnPath(const Coordinate& coord) const;
/*!
* \brief checks if Coordinate is on path
* \param lc::geo::Coordinate coord
* \return bool
*/
bool isCoordinateOnPath(const Coordinate& coord) const;
private:
const std::vector<Coordinate> _control_points; /*!< center of cirlce */
int _degree; /*!< Radius of Spline. */
bool _closed;
};
}
}
#endif // GEOSPLINE_H