本文整理汇总了C++中Point2f::Norm方法的典型用法代码示例。如果您正苦于以下问题:C++ Point2f::Norm方法的具体用法?C++ Point2f::Norm怎么用?C++ Point2f::Norm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point2f
的用法示例。
在下文中一共展示了Point2f::Norm方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pixelDiff
double Parameters::pixelDiff(Shot &test, CMeshO &mesh)
{
double maxdist = 0.0;
double avedist = 0.0;
int count = 0;
CMeshO::VertexIterator vi;
for(vi = pointSamples->vert.begin(); vi != pointSamples->vert.end(); ++vi )
{
vcg::Point3f c;
c.Import((*vi).P());
Point2f diff = pixelDiff(test, c);
double dd = diff.Norm();
if(dd <= 0) continue; //outside of viewpoint
if(dd > maxdist) maxdist = dd;
avedist += dd*dd;
count++;
}
//for(int i = 0; i < nsamples; i++)
//{
// double r = (double)rand() / ((double)(RAND_MAX)+(double)(1));
// double g = (double)rand() / ((double)(RAND_MAX)+(double)(1));
// r = r*16000*16000+g*16000;
// int v = ((int)r)%(mesh.vert.size());
// vcg::Point3d c;
// c.Import(mesh.vert[v].P());
// Point2d diff = pixelDiff(test, c);
// double dd = diff.Norm();
// if(dd <= 0) continue; //outside of viewpoint
// if(dd > maxdist) maxdist = dd;
// avedist += dd*dd;
// count++;
//}
if(max_norm) return maxdist;
return sqrt(avedist/count);
}
示例2: pixelDiff
double Parameters::pixelDiff(Shot &test, CMeshO &mesh, int nsamples) {
double maxdist = 0.0;
double avedist = 0.0;
int count = 0;
for(int i = 0; i < nsamples; i++) {
double r = (double)rand() / ((double)(RAND_MAX)+(double)(1));
double g = (double)rand() / ((double)(RAND_MAX)+(double)(1));
r = r*16000*16000+g*16000;
int v = ((int)r)%(mesh.vert.size());
vcg::Point3f c;
c.Import(mesh.vert[v].P());
Point2f diff = pixelDiff(test, c);
double dd = diff.Norm();
if(dd <= 0) continue; //outside of viewpoint
if(dd > maxdist) maxdist = dd;
avedist += dd*dd;
count++;
}
if(max_norm) return maxdist;
return sqrt(avedist/count);
}