I am trying to calculate the co-ordinates for the red lines shown in the image.
I've written the following:
QPoint clsLOFmimic::ptCalcEndPt(QPoint* pptOrigin
,int intRadius
,float fltAngle) {
double dblRadians = ((double)fltAngle) * (M_PI / 180.0);
return QPoint(((double)intRadius * cos(dblRadians)) + pptOrigin->x()
,((double)intRadius * sin(dblRadians)) + pptOrigin->y());
}
However the orientation of the calculated end point isn't correct. 'pptOrigin' is the co-ordinates at the bottom left where the lines intersect.
The goal is to calculate the correct end points to reflect the lines shown in the diagram. X increases from left to right and Y increases from top to bottom.
If y is increasing downward, you'll have to apply a minus sign to the sin()
function. The trig functions work as you would expect when x increases to the right and y increases upwards.