Closed ANTONBORODA closed 8 years ago
I don't believe it is necessary to add the "-1" as Random.Next is exclusive of the upper-bound (https://msdn.microsoft.com/en-us/library/zd1bc8e5(v=vs.110).aspx). If you did get this error, I'd be curious to understand why. Maybe one of your vertices is null (?).
I got out of range exception running latest NuGet package in IIS environment. After adding -1 - error was never observed again with the same data set. Vertex might be null, I'll verify the input data just to make sure.
I am sorry, this was related to our code.
Hello. There seems to an issue with DetermineDimension() in ConvexHullAlgorithm.Initialize.cs. It uses NumberOfVertices as an indexer:
dimensions.Add(Vertices[r.Next(NumberOfVertices)].Position.Length);
which is taken from array length of input. If random produces a maximum number - an out of range exception will be produced because array indexer is 0 based. It probably should bedimensions.Add(Vertices[r.Next(NumberOfVertices-1)].Position.Length);
Thank you.