Пример #1
0
        protected void GenerateTestData(int pointAmount, out IPoint3DCollection <T> instance,
                                        out IList <KeyValuePair <T, Vector3> > items, out Vector3 origin, out Vector3 size)
        {
            var randomSeed = 0;

            Random.InitState(randomSeed);

            instance = CreateInstance();
            Assert.NotNull(instance, "instance != null");

            origin = RandomInUnitAabb() * 100f;
            size   = RandomInUnitAabb().AbsComponents() * 100f;
            var halfSize = size / 2f;

            items = new List <KeyValuePair <T, Vector3> >();

            for (var i = 0; i < pointAmount; i++)
            {
                var vector = RandomInAabb(origin, halfSize);
                Assert.True(vector.IsInAabb(origin, size), $"{vector}.IsInAabb({origin}, {size})");
                var item = GetItem(i);
                Assert.NotNull(item, "item != null");
                items.Add(new KeyValuePair <T, Vector3>(item, vector));
                instance.Add(item, vector);
            }
        }
Пример #2
0
        protected void GenerateTestCollection(int pointAmount, out IPoint3DCollection <T> instance,
                                              out IList <KeyValuePair <T, Vector3> > items, out Vector3 origin, out Vector3 size)
        {
            GenerateTestData(pointAmount, out items, out origin, out size);

            instance = CreateInstance(origin, size, pointAmount);
            Assert.NotNull(instance, "instance != null");

            for (var i = 0; i < pointAmount; i++)
            {
                instance.Add(items[i].Key, items[i].Value);
            }
        }