c語言同名標靶點自動匹配算法實現(xiàn)實例代碼-創(chuàng)新互聯(lián)

1.兩個標靶數(shù)據(jù)

c語言同名標靶點自動匹配算法實現(xiàn)實例代碼

我們提供的服務有:做網(wǎng)站、網(wǎng)站設計、微信公眾號開發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認證、班戈ssl等。為成百上千企事業(yè)單位解決了網(wǎng)站和推廣的問題。提供周到的售前咨詢和貼心的售后服務,是有科學管理、有技術的班戈網(wǎng)站制作公司

c語言同名標靶點自動匹配算法實現(xiàn)實例代碼

2.匹配結(jié)果

c語言同名標靶點自動匹配算法實現(xiàn)實例代碼

3.代碼

#include <iostream>
#include <vector>
#include <math.h>
using namespace std;
struct Point
{
 int id;
 float x,y,z; 
 Point(int _id,float _x,float _y,float _z):id(_id),x(_x),y(_y),z(_z){}
};
struct Triangle
{
 Point p1,p2,p3;
};
class PointCloud
{
public: 
 bool readFile(char *filename);
 //void PointMatch(const PointCloud& pc1,const PointCloud &pc2);  
 vector<Point> pData;
 int r,g,b;
};
bool PointCloud::readFile(char *filename)
{
 if(filename==NULL)return false;
 FILE *fp=fopen(filename,"r");
 if (!fp)
 {
  printf("Load file %s failed\n", filename);
  return false;
 }
 char buffer[100];
 int count=0;
 while(!feof(fp))
 {
  fgets(buffer, 300, fp);
  float x,y,z; 
  sscanf_s(buffer,"%f%f%f",&x,&y,&z);
  Point p(count++,x,y,z);
  pData.push_back(p);
 } 
 pData.pop_back();
}
float calDis(const Point &p1,const Point &p2)
{
 return sqrt((p2.x-p1.x)*(p2.x-p1.x)+(p2.y-p1.y)*(p2.y-p1.y)+(p2.z-p1.z)*(p2.z-p1.z));
}
void PointMatch(const PointCloud& pc1,const PointCloud &pc2)
{ 
 for (int i=0;i<pc1.pData.size()-2;++i)
  for(int j=i+1;j<pc1.pData.size()-1;++j)
   for (int k=j+1;k<pc1.pData.size();++k)
   {
    Point p1=pc1.pData[i];
    Point p2=pc1.pData[j];
    Point p3=pc1.pData[k];
    float s12=calDis(p1,p2);
    float s13=calDis(p1,p3);
    float s23=calDis(p2,p3);
    for (int m=0;m<pc2.pData.size();++m)
     for (int n=0;n<pc2.pData.size();++n)
      for (int l=0;l<pc2.pData.size();++l)
      {
       if (n!=m&&m!=l&&n!=l)
       {      
        Point _p1=pc2.pData[m];
        Point _p2=pc2.pData[n];
        Point _p3=pc2.pData[l];
        float _s12=calDis(_p1,_p2);
        float _s13=calDis(_p1,_p3);
        float _s23=calDis(_p2,_p3);
        if (fabs(s12-_s12)<0.45&&fabs(s13-_s13)<0.45&&fabs(s23-_s23)<0.45)
        {
         cout<<"pc1....."<<p1.id<<"pc2......"<<_p1.id<<endl;
         cout<<"pc1....."<<p2.id<<"pc2......"<<_p2.id<<endl;
         cout<<"pc1....."<<p3.id<<"pc2......"<<_p3.id<<endl;
        }
       }
      }

   }

}
int main()
{
 char *file1="測試點云\\點云Mark0.txt";
 char *file2="測試點云\\點云Mark1.txt";
 PointCloud pc1,pc2;
 pc1.readFile(file1);
 pc2.readFile(file2);
 PointMatch(pc1,pc2);
}

另外有需要云服務器可以了解下創(chuàng)新互聯(lián)建站bm7419.com,海內(nèi)外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。

網(wǎng)站題目:c語言同名標靶點自動匹配算法實現(xiàn)實例代碼-創(chuàng)新互聯(lián)
鏈接地址:http://bm7419.com/article28/didcjp.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站內(nèi)鏈移動網(wǎng)站建設、關鍵詞優(yōu)化、搜索引擎優(yōu)化、全網(wǎng)營銷推廣、外貿(mào)建站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設公司