欧美大屁股bbbbxxxx,狼人大香伊蕉国产www亚洲,男ji大巴进入女人的视频小说,男人把ji大巴放进女人免费视频,免费情侣作爱视频

歡迎來到入門教程網(wǎng)!

C語言

當(dāng)前位置:主頁 > 軟件編程 > C語言 >

c語言同名標(biāo)靶點(diǎn)自動匹配算法實(shí)現(xiàn)實(shí)例代碼

來源:本站原創(chuàng)|時(shí)間:2020-01-10|欄目:C語言|點(diǎn)擊: 次

1.兩個(gè)標(biāo)靶數(shù)據(jù)

2.匹配結(jié)果

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="測試點(diǎn)云\\點(diǎn)云Mark0.txt";
 char *file2="測試點(diǎn)云\\點(diǎn)云Mark1.txt";
 PointCloud pc1,pc2;
 pc1.readFile(file1);
 pc2.readFile(file2);
 PointMatch(pc1,pc2);
}

總結(jié)

以上就是本文關(guān)于c語言同名標(biāo)靶點(diǎn)自動匹配算法實(shí)現(xiàn)實(shí)例代碼的全部內(nèi)容,希望對大家有所幫助。感興趣的朋友可以繼續(xù)參閱本站其他相關(guān)專題,如有不足之處,歡迎留言指出。感謝朋友們對本站的支持!

上一篇:C語言通訊錄實(shí)例分享

欄    目:C語言

下一篇:C語言實(shí)現(xiàn)數(shù)字雨效果

本文標(biāo)題:c語言同名標(biāo)靶點(diǎn)自動匹配算法實(shí)現(xiàn)實(shí)例代碼

本文地址:http://mengdiqiu.com.cn/a1/Cyuyan/885.html

網(wǎng)頁制作CMS教程網(wǎng)絡(luò)編程軟件編程腳本語言數(shù)據(jù)庫服務(wù)器

如果侵犯了您的權(quán)利,請與我們聯(lián)系,我們將在24小時(shí)內(nèi)進(jìn)行處理、任何非本站因素導(dǎo)致的法律后果,本站均不負(fù)任何責(zé)任。

聯(lián)系QQ:835971066 | 郵箱:835971066#qq.com(#換成@)

Copyright © 2002-2020 腳本教程網(wǎng) 版權(quán)所有