I want to use TLine to draw a line, but I can only get the coordinates of a point on the line and the Angle of the line. So I took a trick (as shown in the following code), but there is a problem with this, as the Angle approaches 90°, the resulting line length is extremely large. So I would like to ask you, is there a better way to draw a straight line, such as using Angle?
Thanks,
K.
double b_,xx1,xx2,yy1,yy2,k;
k = delta[ievt]/57.3;
k = tan(k);
//cout<<k<<endl;
b_ = iy_b[ievt]-k*ix_b[ievt];
xx1 = ix_b[ievt]-0.8;xx2 = ix_b[ievt]+0.8;
yy1 = xx1*k+b_;
yy2 = xx2*k+b_;
TLine *line = new TLine(xx1,yy1,xx2,yy2);
line->SetLineWidth(1);
line->SetLineColor(kRed);
line->Draw();