資源簡介
用C++模擬圓弧插補(沒有圖形)
http://blog.csdn.net/z893345329/article/details/25922857
代碼片段和文件信息
#include?//調用絕對值函數
#include?
using?namespace?std;
void?main()
{
int?Nxyxeyex0y0xi=0yi=0FMF;
int?i=1;
cout<<“######################“< cout<<“#歡迎來到直線插補程序#“< cout<<“######################“< cout<<“請輸入起點坐標:“< cin>>x0>>y0;
cout<<“請輸入終點坐標:“< cin>>xe>>ye;
cout< Nxy?=abs(?(xe?-?x0))?+?abs((ye?-?y0));
xi?=?x0;//xy分別存放實時的坐標
yi?=?y0;//
//FM?=xe*yi-xi*ye;
while(Nxy!=0)
{
FM?=(xe-x0)*(yi-y0)-(xi-x0)*(ye-y0);
if(xe-x0==0){}
else?if((ye-y0)/(xe-x0)<0)//調整斜率
FM=FM*(-1);
if(FM?>=?0?)
- 上一篇:c++實現NFA與DFA轉換
- 下一篇:超市管理系統C源代碼
評論
共有 條評論