1、原理

C++绘制箭头—原理和代码

2、代码

void calcVertexes(double start_x, double start_y, double end_x, double end_y, double& x1, double& y1, double& x2, double& y2){

    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_);

}

相关文章:

  • 2021-12-20
  • 2022-12-23
  • 2022-12-23
  • 2021-12-09
  • 2021-07-29
  • 2021-09-07
  • 2021-10-06
  • 2021-06-23
猜你喜欢
  • 2021-07-27
  • 2021-07-26
  • 2021-12-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-20
相关资源
相似解决方案