void SpatialGraphKDNode::GetGridPoints( Vector2List& points, int& xPoints, int& yPoints ) { xPoints = 0; yPoints = 0; Vector2 vSmallestDimensions = Tree->GetSmallestDimensions(); Vector2 vMyBoxDimensions = BBox.Max - BBox.Min; /* if( vSmallestDimensions == vMyBoxDimensions ) { xPoints = 1; yPoints = 1; points.push_back( BBox.Centroid() ); return; } */ xPoints = static_cast<int>(vMyBoxDimensions.X / vSmallestDimensions.X); yPoints = static_cast<int>(vMyBoxDimensions.Y / vSmallestDimensions.Y); points.reserve(xPoints*yPoints); Vector2 vBottomLeftStartBox( BBox.Min.X, BBox.Max.Y - vSmallestDimensions.Y ); BoundingBox startBox( vBottomLeftStartBox, vBottomLeftStartBox + vSmallestDimensions); BoundingBox checkBox( startBox ); for( int yDim = 0; yDim < yPoints; yDim++ ) { for( int xDim = 0; xDim < xPoints; xDim++ ) { points.push_back( checkBox.Centroid() ); checkBox.Min.X += vSmallestDimensions.X; checkBox.Max.X += vSmallestDimensions.X; } checkBox.Min.X = startBox.Min.X; checkBox.Max.X = startBox.Max.X; checkBox.Min.Y -= vSmallestDimensions.Y; checkBox.Max.Y -= vSmallestDimensions.Y; } }