yy1717
2020-05-11 a073dc3c983b4c56c5da92642c9ad11995bdb844
lib/src/main/cpp/test_common/Geometry.cpp
@@ -11,6 +11,9 @@
#include <malloc.h>
#include <initializer_list>
#include <cctype>
#include <iosfwd>
#include <iomanip>
#include <sstream>
#include "../jni_log.h"
@@ -37,6 +40,13 @@
inline double toDegree(double radians)
{
    return (radians * 180.0) / M_PI;
}
double round(double number, unsigned int bits) {
    stringstream ss;
    ss << setiosflags(ios::fixed) << setprecision(bits) << number;
    ss >> number;
    return number;
}
void MakeLine(Line *line, const PointF *p1, const PointF *p2)
@@ -442,6 +452,7 @@
    }
}
// 0 - straight, 1 - left, -1 - right, 2 - front, -2 - back
int IntersectionOfLine(PointF p, Line line)
{
    PointF p1, p2;
@@ -451,7 +462,7 @@
    p2.X = line.X2;
    p2.Y = line.Y2;
    IntersectionOfLine(p1, p2, p);
    return IntersectionOfLine(p1, p2, p);
}
/***************************************************************
@@ -514,6 +525,26 @@
    return false;
}
bool VerticalPointOnLine(PointF point, Line line, PointF &vp)
{
    PointF p1, p2;
    p1.X = line.X1;
    p1.Y = line.Y1;
    p2.X = line.X2;
    p2.Y = line.Y2;
    PointF pv = GetVerticalPoint(p1, p2, point);
    if (isEqual2(pv.X, MIN(p1.X, p2.X)) || isEqual2(pv.X, MAX(p1.X, p2.X)) ||
        (pv.X > MIN(p1.X, p2.X) && pv.X < MAX(p1.X, p2.X))) {
        vp = pv;
        return true;
    }
    return false;
}
/****************************************************************
 *                      p3
 *                      |  'L'