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


C++ GenericIndexedCloudPersist::getPointScalarValue方法代码示例

本文整理汇总了C++中cclib::GenericIndexedCloudPersist::getPointScalarValue方法的典型用法代码示例。如果您正苦于以下问题:C++ GenericIndexedCloudPersist::getPointScalarValue方法的具体用法?C++ GenericIndexedCloudPersist::getPointScalarValue怎么用?C++ GenericIndexedCloudPersist::getPointScalarValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cclib::GenericIndexedCloudPersist的用法示例。


在下文中一共展示了GenericIndexedCloudPersist::getPointScalarValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ICP


//.........这里部分代码省略.........
			result = CCLib::DistanceComputationTools::computeCloud2MeshDistance(dataCloud, modelMesh, c2mParams, progressDlg.data());
		}
		else
		{
			result = CCLib::DistanceComputationTools::computeApproxCloud2CloudDistance(	dataCloud,
																						modelCloud,
																						gridLevel,
																						-1,
																						progressDlg.data());
		}

		if (result < 0)
		{
			ccLog::Error("Failed to determine the max (overlap) distance (not enough memory?)");
			return false;
		}

		//determine the max distance that (roughly) corresponds to the input overlap ratio
		ScalarType maxSearchDist = 0;
		{
			unsigned count = dataCloud->size();
			std::vector<ScalarType> distances;
			try
			{
				distances.resize(count);
			}
			catch (const std::bad_alloc&)
			{
				ccLog::Error("Not enough memory!");
				return false;
			}
			for (unsigned i=0; i<count; ++i)
			{
				distances[i] = dataCloud->getPointScalarValue(i);
			}
			
			ParallelSort(distances.begin(), distances.end());
			
			//now look for the max value at 'finalOverlapRatio+margin' percent
			maxSearchDist = distances[static_cast<unsigned>(std::max(1.0,count*(finalOverlapRatio+s_overlapMarginRatio)))-1];
		}

		//evntually select the points with distance below 'maxSearchDist'
		//(should roughly correspond to 'finalOverlapRatio + margin' percent)
		{
			CCLib::ReferenceCloud* refCloud = new CCLib::ReferenceCloud(dataCloud);
			cloudGarbage.add(refCloud);
			unsigned countBefore = dataCloud->size();
			unsigned baseIncrement = static_cast<unsigned>(std::max(100.0,countBefore*finalOverlapRatio*0.05));
			for (unsigned i=0; i<countBefore; ++i)
			{
				if (dataCloud->getPointScalarValue(i) <= maxSearchDist)
				{
					if (	refCloud->size() == refCloud->capacity()
						&&	!refCloud->reserve(refCloud->size() + baseIncrement) )
					{
						ccLog::Error("Not enough memory!");
						return false;
					}
					refCloud->addPointIndex(i);
				}
			}
			refCloud->resize(refCloud->size());
			dataCloud = refCloud;

			unsigned countAfter = dataCloud->size();
开发者ID:cloudcompare,项目名称:trunk,代码行数:67,代码来源:ccRegistrationTools.cpp

示例2: SavePolyline


//.........这里部分代码省略.........
				const CCVector3* A = vertices->getPoint(leftMostPointIndex+1 < realNumPoints ? leftMostPointIndex+1 : 0);
			
				CCVector3 PA = *A-*P;
				CCVector3 PB = *B-*P;
				PointCoordinateType anglePA = atan2(PA.u[dim2],PA.u[dim1]); //forward
				PointCoordinateType anglePB = atan2(PB.u[dim2],PB.u[dim1]); //backward
				//angles should all be in [-PI/2;0]
				if (anglePA < anglePB)
					inverseOrder = true;
			}
		}
	}

	//Points (An array of length NumPoints)
	{
		for (int32_t i=0; i<numPoints; ++i)
		{
			int32_t ii = (inverseOrder ? numPoints-1-i : i);
			const CCVector3* P = vertices->getPoint(ii % realNumPoints); //warning: handle loop if polyline is closed

			double x = qToLittleEndian<double>(P->x);
			double y = qToLittleEndian<double>(P->y);
			/*Byte 0*/file.write((const char*)&x,8);
			/*Byte 8*/file.write((const char*)&y,8);
			bytesWritten += 16;
		}
	}

	//3D polylines
	if (!is2D)
	{
		//Z boundaries
		{
			double zMin = qToLittleEndian<double>(box.minCorner().z);
			double zMax = qToLittleEndian<double>(box.maxCorner().z);
			file.write((const char*)&zMin,8);
			file.write((const char*)&zMax,8);
			bytesWritten += 16;
		}

		//Z coordinates (for each part - just one here)
		{
			for (int32_t i=0; i<numPoints; ++i)
			{
				int32_t ii = (inverseOrder ? numPoints-1-i : i);
				const CCVector3* P = vertices->getPoint(ii % realNumPoints); //warning: handle loop if polyline is closed
				double z = qToLittleEndian<double>(P->z);
				file.write((const char*)&z,8);
				bytesWritten += 8;
			}
		}

		//M boundaries
		bool hasSF = vertices->isScalarFieldEnabled();
		{
			double mMin = ESRI_NO_DATA;
			double mMax = ESRI_NO_DATA;
			if (hasSF)
			{
				for (int32_t i=0; i<realNumPoints; ++i)
				{
					ScalarType scalar = vertices->getPointScalarValue(i);
					if (i != 0)
					{
						if (mMin > scalar)
							mMin = static_cast<double>(scalar);
						else if (mMax < scalar)
							mMax = static_cast<double>(scalar);
					}
					else
					{
						mMin = mMax = static_cast<double>(scalar);
					}
				}
			}
			mMin = qToLittleEndian<double>(mMin);
			mMax = qToLittleEndian<double>(mMax);
			file.write((const char*)&mMin,8);
			file.write((const char*)&mMax,8);
			bytesWritten += 16;
		}

		//M values (for each part - just one here)
		{
			double scalar = qToLittleEndian<double>(ESRI_NO_DATA);
			for (int32_t i=0; i<numPoints; ++i)
			{
				if (hasSF)
				{
					scalar = static_cast<double>(vertices->getPointScalarValue(i % realNumPoints)); //warning: handle loop if polyline is closed
					scalar = qToLittleEndian<double>(scalar);
				}
				file.write((const char*)&scalar,8);
				bytesWritten += 8;
			}
		}
	}

	return CC_FERR_NO_ERROR;
}
开发者ID:sniperx2,项目名称:trunk,代码行数:101,代码来源:ShpFilter.cpp


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