System.Collections.Generic.HashSet.Add(Vector2f)

Here are the examples of the csharp api System.Collections.Generic.HashSet.Add(Vector2f) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

19 Source : VoronoiDiagram.cs
with MIT License
from squeakyspacebar

private List<Vector2f> CreateRandomPoints(int n) {
        HashSet<Vector2f> points = new HashSet<Vector2f>();
        for (int i = 0; i < n; i++) {
            float x = (float)this.randGen.Next(this.Width);
            float y = (float)this.randGen.Next(this.Height);

            while (!points.Add(new Vector2f(x, y))) {
                x = (float)this.randGen.Next(this.Width);
                y = (float)this.randGen.Next(this.Height);
            }
        }

        return points.ToList();
    }