本文整理汇总了C++中Pnt2f::dist方法的典型用法代码示例。如果您正苦于以下问题:C++ Pnt2f::dist方法的具体用法?C++ Pnt2f::dist怎么用?C++ Pnt2f::dist使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pnt2f
的用法示例。
在下文中一共展示了Pnt2f::dist方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mapping
//.........这里部分代码省略.........
tmp_m[12] = p[9];
tmp_m[13] = p[10];
tmp_m[14] = p[11];
tmp_m[15] = 1;
/*for(int t(0);t<12;++t){
//if(t<=7)
// tmp_m[t] = 0.1*p[t];
//else
tmp_m[t] = p[t];
}*/
glMultMatrixf(tmp_m);
// load new matrix
//glMultMatrixd(p);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
//glMultMatrixf(m);
float scalev = 1.92;
glScalef(scalev,scalev,scalev);
glGetDoublev(GL_MODELVIEW_MATRIX, modelview);
glGetDoublev(GL_PROJECTION_MATRIX, projection2);
glGetIntegerv(GL_VIEWPORT, viewport);
// project 3d point
//for ever line
int thres = (int)(_LINES.size());/*0.1*;*/
int count(0);
/*int test = rand()%7;
while(test != 0 || test!=2 || test !=4||test!=6)
test = rand()%7;
*/
for(int i(0);i<thres;i=i+2){
// get hitpoints by line
vector<Pnt2f> hitpoints = _HITPOINTS[i];
/*if(hitpoints.size()>10){
int t = rand() % 2;
if(t == 0)
continue;
}*/
if(hitpoints.empty())
continue;
// jump over small lines
//if(hitpoints.size()<5)
// continue;
//for every controlpoint
vector<Pnt3f> cps = _CONTROLPOINTS[i];
for(int j(0);j<cps.size();++j){
Pnt2f hit = hitpoints[j];
if(hit[0] == -1)
continue;
Pnt3f cp = cps[j];
double x1,y,z;
gluProject(cp[0], cp[1], cp[2],
modelview, projection2, viewport,
&x1,&y,&z);
Pnt2d tmp2d;
tmp2d[0] = x1;
tmp2d[1] = y;
float length = hit.dist(tmp2d);
if(i <1){
length = _FIX.dist(tmp2d);
}
if(count > n)
continue;
//normal caluclation
x[count] = (double)length*(double)length;
//file << (double)length * (double)length<<endl;
//huber calc
float c = 0.5;
//cout << "l:"<<length<<endl;
/*if(length <= c){
x[count] = ((double)length * (double)length ) / 2 ;
file << ((double)length * (double)length ) / 2<<endl;
} else {
x[count] = c * (double)length - (c * c) / 2;
file << c * (double)length - (c * c) / 2 << endl;
}*/
count++;
}
if(count < n && i>=thres){
cout << "dammit...not enough points...start over!!"<<endl;
i = 0;
}
hitpoints.clear();
cps.clear();
}
//file.close();
//exit(0);
}