示例#1
0
        public void RubiksCubeDataValidationCentered()
        {
            SetVersion rubikSetVersion = this.GenerateRubiksCubeLOD(new[] { 27, 9, 3 }, new Vector3(27, 27, 27));
            IEnumerable <QueryDetailContract> results = rubikSetVersion.Query("L2", new Vector3(13, 13, 13));

            Assert.AreEqual(3, results.Count());

            foreach (QueryDetailContract lod in results)
            {
                Trace.WriteLine(lod.Name, "Level of Detail Name");
                Assert.IsTrue(lod.Cubes.Count() <= 27);

                var allCubes = rubikSetVersion.DetailLevels[lod.Name].Cubes.AllItems();
                var lookup   = allCubes.ToDictionary(c => c.BoundingBox.Min.X + "," + c.BoundingBox.Min.Y + "," + c.BoundingBox.Min.Z);

                Trace.WriteLine(lookup.Count, "Lookups");

                var cubes = lod.Cubes.ToArray();

                foreach (var key in cubes)
                {
                    var keyString = key[0] + "," + key[1] + "," + key[2];
                    Trace.WriteLine(keyString);
                    CubeBounds hit;
                    Assert.IsTrue(lookup.TryGetValue(keyString, out hit));
                    Assert.IsInstanceOfType(hit, typeof(ValidCube));
                }
            }
        }
示例#2
0
        public void TestBoundingBox()
        {
            SetVersion setVersion = this.Get4x4x4DataSet1();

            int[][] results = setVersion.Query("L1", new BoundingBox(new Vector3(10, 10, 10), new Vector3(20, 20, 20))).ToArray();
            Assert.AreEqual(3, results.Length);
            Assert.AreEqual("0,0,0", results.Select(i => String.Format("{0},{1},{2}", i[0], i[1], i[2])).First());
        }
示例#3
0
        public void LargeDataSetQueryPerformanceCube()
        {
            SetVersion setVersion = this.GetLargeDataSet();

            SetVersionLevelOfDetail lod0 = setVersion.DetailLevels.Values.FirstOrDefault();

            Stopwatch timer = new Stopwatch();

            timer.Start();
            int[][] results = setVersion.Query("L1", lod0.WorldBounds).ToArray();
            Trace.WriteLine(results.Count(), "Elements");
            timer.Stop();
            Trace.WriteLine(timer.ElapsedMilliseconds, "Query Performance (ms)");
        }
        public IEnumerable <QueryDetailContract> Query(string setId, string versionId, string boundaryReferenceLoD, Vector3 worldCenter)
        {
            SetVersion setVersion = this.loadedSetData.Get().FindSetVersion(setId, versionId);

            return(setVersion.Query(boundaryReferenceLoD, worldCenter));
        }
        public IEnumerable <QueryDetailContract> Query(string setId, string versionId, string profile, BoundingSphere worldSphere)
        {
            SetVersion setVersion = this.loadedSetData.Get().FindSetVersion(setId, versionId);

            return(setVersion.Query(profile, worldSphere));
        }
        public IEnumerable <int[]> Query(string setId, string versionId, string detail, BoundingBox worldBox)
        {
            SetVersion setVersion = this.loadedSetData.Get().FindSetVersion(setId, versionId);

            return(setVersion.Query(detail, worldBox));
        }