sagoma/geometry.h

29 lines
910 B
C++

#ifdef HAS_OPENCV3
#include <opencv2/core.hpp> //Any OPENCV3 code
#else
#include <opencv2/core/core.hpp> //Any Opencv2 code
#endif
double dist(cv::Point, cv::Point);
double inner_angle(cv::Point, cv::Point, cv::Point);
cv::Point map_point(double, cv::Point, cv::Point);
cv::Point unmap_point(double, cv::Point, cv::Point);
cv::Vec<double,3> get_line(cv::Point, cv::Point);
bool is_in_line(cv::Vec<double,3> line, cv::Point p);
bool is_above_line(cv::Vec<double,3> line, cv::Point p);
cv::Point further_point_from_line(cv::Vec<double,3>, std::vector<cv::Point>);
class CoordinateSystem
{
private:
double theta;
cv::Matx<double,2,2> R, Rt;
cv::Point origin;
void precompute();
public:
CoordinateSystem(cv::Point, cv::Point);
CoordinateSystem(double angle, cv::Point origin_);
cv::Point map(cv::Point p);
cv::Point unmap(cv::Point p);
};