/// <summary> /// /// </summary> /// <param name="particles"></param> private void UpdateGrid(IReadOnlyList <IBody> particles) { if (_grid == null) { _grid = new HashGrid3d <H>((int)(particles.Count * _targetLoadFactor), Radius * RadiusToBinScale); return; } _grid.BinScale = Radius * RadiusToBinScale; int targCount = (int)(particles.Count * _targetLoadFactor); if (_grid.BinCount < (targCount >> 1)) { _grid.Resize(targCount); } }
/// <summary> /// /// </summary> private void UpdateGrid(double radius) { if (_grid == null) { _grid = new HashGrid3d <V>((int)(_verts.Count * _targetLoadFactor), radius * RadiusToBinScale); return; } _grid.BinScale = radius * RadiusToBinScale; int targCount = (int)(_verts.Count * _targetLoadFactor); if (_grid.BinCount < (targCount >> 1)) { _grid.Resize(targCount); } }