- float x1 = lastPoint.x(); //lastPoint 起点
- float y1 = lastPoint.y();
- float x2 = endPoint.x(); //endPoint 终点
- float y2 = endPoint.y();
- float l = 10.0; //箭头的那长度
- float a = 0.5; //箭头与线段角度
- float x3 = x2 - l * cos(atan2((y2 - y1) , (x2 - x1)) - a);
- float y3 = y2 - l * sin(atan2((y2 - y1) , (x2 - x1)) - a);
- float x4 = x2 - l * sin(atan2((x2 - x1) , (y2 - y1)) - a);
- float y4 = y2 - l * cos(atan2((x2 - x1) , (y2 - y1)) - a);
- painter.drawLine(x1,y1,x3,y3);
- painter.drawLine(x1,y1,x4,y4);
- painter.drawLine(lastPoint,endPoint);
相关文章
- 02-16SPOJ 2916 Can you answer these queries V(线段树-分类讨论)
- 02-16SPOJ 1557. Can you answer these queries II 线段树
- 02-16Qt C++自定义Qt组件
- 02-16qt for vs 界面显示乱码
- 02-16qt一定要先有父对象再有子对象,否则崩溃
- 02-16Qt中检查槽函数connect是否正确
- 02-16Qt 构建一个私有的信号
- 02-16绘制Gaussian Distribution曲线的三种方式
- 02-16在VS里面使用QT,实现:信号与槽
- 02-16Segments - POJ 3304 (判断直线与线段是否相交)