class SC_Rotate_Line
{
public:
dxy_t sc_Begin, sc_End;
double sc_Angle;
dxy_t sc_LeftPoint;
public:
SC_Rotate_Line() {}
SC_Rotate_Line(dxy_t Begin,dxy_t End, float Angle, CDC* pDC)
{
sc_Begin = Begin;
sc_End = End;
sc_Angle = -Angle/180*PI;

sc_LeftPoint.x = cos(sc_Angle)*(sc_End.x - sc_Begin.x) - sin(sc_Angle)*(sc_End.y - sc_Begin.y);
sc_LeftPoint.y = sin(sc_Angle)*(sc_End.x - sc_Begin.x) + cos(sc_Angle)*(sc_End.y - sc_Begin.y);
sc_LeftPoint.x = sc_LeftPoint.x + sc_Begin.x;
sc_LeftPoint.y = sc_LeftPoint.y + sc_Begin.y;

pDC->MoveTo(long(sc_Begin.x+0.5), long(sc_Begin.y+0.5));
pDC->LineTo(long(sc_LeftPoint.x+0.5), long(sc_LeftPoint.y+0.5));
}
SC_Rotate_Line(double Beginx,double Beginy,double Endx,double Endy ,float Angle, CDC* pDC)
{
sc_Begin.x = Beginx;
sc_Begin.y = Beginy;
sc_End.x = Endx;
sc_End.y = Endy;
sc_Angle = -Angle/180*PI;

sc_LeftPoint.x = cos(sc_Angle)*(sc_End.x - sc_Begin.x) - sin(sc_Angle)*(sc_End.y - sc_Begin.y);
sc_LeftPoint.y = sin(sc_Angle)*(sc_End.x - sc_Begin.x) + cos(sc_Angle)*(sc_End.y - sc_Begin.y);
sc_LeftPoint.x = sc_LeftPoint.x + sc_Begin.x;
sc_LeftPoint.y = sc_LeftPoint.y + sc_Begin.y;

pDC->MoveTo(long(sc_Begin.x+0.5), long(sc_Begin.y+0.5));
pDC->LineTo(long(sc_LeftPoint.x+0.5), long(sc_LeftPoint.y+0.5));
}
SC_Rotate_Line(CPoint Begin, CPoint End, float Angle, CDC* pDC)
{
sc_Begin.x = Begin.x;
sc_Begin.y = Begin.y;
sc_End.x = End.x;
sc_End.y = End.y;
sc_Angle = -Angle/180*PI;

sc_LeftPoint.x = cos(sc_Angle)*(sc_End.x - sc_Begin.x) - sin(sc_Angle)*(sc_End.y - sc_Begin.y);
sc_LeftPoint.y = sin(sc_Angle)*(sc_End.x - sc_Begin.x) + cos(sc_Angle)*(sc_End.y - sc_Begin.y);
sc_LeftPoint.x = sc_LeftPoint.x + sc_Begin.x;
sc_LeftPoint.y = sc_LeftPoint.y + sc_Begin.y;

pDC->MoveTo(long(sc_Begin.x+0.5), long(sc_Begin.y+0.5));
pDC->LineTo(long(sc_LeftPoint.x+0.5), long(sc_LeftPoint.y+0.5));
}
CPoint SC_Return(CPoint Begin, CPoint End, double Angle)
{
sc_Begin.x = Begin.x;
sc_Begin.y = Begin.y;
sc_End.x = End.x;
sc_End.y = End.y;
sc_Angle = -Angle/180*PI;

sc_LeftPoint.x = cos(sc_Angle)*(sc_End.x - sc_Begin.x) - sin(sc_Angle)*(sc_End.y - sc_Begin.y);
sc_LeftPoint.y = sin(sc_Angle)*(sc_End.x - sc_Begin.x) + cos(sc_Angle)*(sc_End.y - sc_Begin.y);
sc_LeftPoint.x = sc_LeftPoint.x + sc_Begin.x;
sc_LeftPoint.y = sc_LeftPoint.y + sc_Begin.y;

return CPoint(long(sc_LeftPoint.x+0.5), long(sc_LeftPoint.y+0.5));
}
};

+ Recent posts