24 #include <boost/math/constants/constants.hpp> 28 MEColor::MEColor(
unsigned char red,
unsigned char green,
unsigned char blue) :
29 Red(red), Green(green), Blue(blue)
34 MEPoint::MEPoint(
int x,
int y) : X(x), Y(y)
39 bool MEPoint::IsValid()
const 41 return X >= 0 && Y >= 0;
47 float p12 = sqrt((
float)((point1.
X-point3.
X)*(point1.
X-point3.
X)+(point1.
Y-point3.
Y)*(point1.
Y-point3.
Y)));
48 float p13 = sqrt((
float)((point1.
X-point2.
X)*(point1.
X-point2.
X)+(point1.
Y-point2.
Y)*(point1.
Y-point2.
Y)));
49 float p23 = sqrt((
float)((point3.
X-point2.
X)*(point3.
X-point2.
X)+(point3.
Y-point2.
Y)*(point3.
Y-point2.
Y)));
51 return (
float)acos((p12*p12+p13*p13-p23*p23) / (2*p12*p13))*180 / boost::math::constants::pi<float>();
58 int x1 = line1_point1.
X;
59 int y1 = line1_point1.
Y;
60 int x2 = line1_point2.
X;
61 int y2 = line1_point2.
Y;
62 int x3 = line2_point1.
X;
63 int y3 = line2_point1.
Y;
64 int x4 = line2_point2.
X;
65 int y4 = line2_point2.
Y;
66 int Distance = (x1-x2)*(y3-y4)-(y1-y2)*(x3-x4);
72 Point.
X = (int)((
float)((x1*y2-y1*x2)*(x3-x4)-(x1-x2)*(x3*y4-y3*x4)) / Distance);
73 Point.
Y = (int)((
float)((x1*y2-y1*x2)*(y3-y4)-(y1-y2)*(x3*y4-y3*x4)) / Distance);
float MEGetInteriorAngle(const MEPoint &point1, const MEPoint &point2, const MEPoint &point3)
Get the interior angle between three points.
MEPoint MEComputeLineIntersection(const MEPoint &line1_point1, const MEPoint &line1_point2, const MEPoint &line2_point1, const MEPoint &line2_point2)
Compute intersection point between two lines.