当前位置: 首页>>代码示例>>C++>>正文


C++ Point2f::Norm方法代码示例

本文整理汇总了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);
}
开发者ID:GuoXinxiao,项目名称:meshlab,代码行数:35,代码来源:parameters.cpp

示例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);
}
开发者ID:34985086,项目名称:meshlab,代码行数:21,代码来源:parameters.cpp


注:本文中的Point2f::Norm方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。