示例#1
0
void
removeClosePoints( SoMFVec3f& point, float minDist )
{
	int numPoints = point.getNum();
	if( numPoints >= 2 )
	{		
		for( int ni = numPoints - 1, i = 0; i < numPoints; )
		{
			if( (point[ni] - point[i]).length() <= minDist )
			{
				point.deleteValues( i, 1 );
				-- numPoints;
			}
			else // move forward
			{
				ni = i ++;
			}
		}
	}
}
示例#2
0
void
removeClosePoints( const SoMFVec3f& point, SoMFVec3f& cleanPoints, float minDist )
{
	cleanPoints.setNum( point.getNum() );
	cleanPoints.setValues( 0, point.getNum(), point.getValues(0) );

	int numPoints = cleanPoints.getNum();
	if( cleanPoints.getNum() >= 2 )
	{		
		for( int ni = numPoints - 1, i = 0; i < numPoints; )
		{
			if( (cleanPoints[ni] - cleanPoints[i]).length() <= minDist )
			{
				cleanPoints.deleteValues( i, 1 );
				-- numPoints;
			}
			else // move forward
			{
				ni = i ++;
			}
		}
	}
}