void calcVertexes(double start_x, double start_y, double end_x, double end_y, double& x1, double& y1, double& x2, double& y2,double arrow_lenght_ ,double arrow_degrees_){
double angle = atan2 (end_y - start_y, end_x - start_x) + M_PI;
x1 = end_x + arrow_lenght_ * cos(angle - arrow_degrees_);
y1 = end_y + arrow_lenght_ * sin(angle - arrow_degrees_);
x2 = end_x + arrow_lenght_ * cos(angle + arrow_degrees_);
y2 = end_y + arrow_lenght_ * sin(angle + arrow_degrees_);
}
说明:在项目中遇到了需要使用箭头标识,发现了一篇博客,试用了一下,比自己写的简单很多.在此记录一下方便后面自己使用.
注:转载博客大佬 --:https://www.cnblogs.com/westlife-11358/p/9242474.html