예제 #1
0
        public void TestSample_100(string gameObjectName, AllPointsSampler.Configuration.NormalProcessing normalProcessing)
        {
            EditorSceneManager.OpenScene(sceneName);

            //The 'default' child of a mesh contains the stuff we are interested in
            GameObject gameObject = GameObject.Find(gameObjectName).transform.GetChild(0).gameObject;
            DoubleConnectedEdgeListStorage dcelStorage = gameObject.GetComponent <DoubleConnectedEdgeListStorage>();

            dcelStorage.DCEL = DCEL.FromMesh(gameObject.GetComponent <MeshFilter>().sharedMesh);

            SamplingInformation samplingInformation = new SamplingInformation(gameObject);

            RandomSubSampling.Configuration randomConfig = new RandomSubSampling.Configuration(
                referenceTransform: gameObject.transform.root,
                normalProcessing: normalProcessing,
                percentage: 100
                );

            AllPointsSampler.Configuration allPointsConfig = new AllPointsSampler.Configuration(
                referenceTransform: gameObject.transform.root,
                normalProcessing: normalProcessing
                );

            SamplingInformation samplingInfo = new SamplingInformation(gameObject);

            List <Point> expected = new AllPointsSampler(allPointsConfig).Sample(samplingInfo);
            List <Point> actual   = new RandomSubSampling(randomConfig).Sample(samplingInfo);

            Assert.That(actual, Is.EquivalentTo(expected));
        }
예제 #2
0
        public void TestSample(string gameObjectname, float percentage, int expectedSampleSize, AllPointsSampler.Configuration.NormalProcessing normalProcessing)
        {
            EditorSceneManager.OpenScene(sceneName);

            //The 'default' child of a mesh contains the stuff we are interested in
            GameObject gameObject = GameObject.Find(gameObjectname).transform.GetChild(0).gameObject;
            DoubleConnectedEdgeListStorage dcelStorage = gameObject.GetComponent <DoubleConnectedEdgeListStorage>();

            dcelStorage.DCEL = DCEL.FromMesh(gameObject.GetComponent <MeshFilter>().sharedMesh);

            SamplingInformation samplingInformation = new SamplingInformation(gameObject);

            RandomSubSampling.Configuration randomConfig = new RandomSubSampling.Configuration(
                referenceTransform: gameObject.transform.root,
                normalProcessing: normalProcessing,
                percentage: percentage
                );

            SamplingInformation samplingInfo = new SamplingInformation(gameObject);

            AllPointsSampler.Configuration allPointsConfig = new AllPointsSampler.Configuration(
                referenceTransform: gameObject.transform.root,
                normalProcessing: normalProcessing
                );
            List <Point> allPoints = new AllPointsSampler(allPointsConfig).Sample(samplingInfo);

            List <Point> actual = new RandomSubSampling(randomConfig).Sample(samplingInfo);

            Assert.AreEqual(expectedSampleSize, actual.Count);
            Assert.That(actual, Is.SubsetOf(allPoints));

            bool allUnique = actual.GroupBy(x => x).All(g => g.Count() == 1);

            Assert.IsTrue(allUnique);
        }
        public void TestSample_100(string gameObjectName)
        {
            EditorSceneManager.OpenScene(sceneName);

            //The 'default' child of a mesh contains the stuff we are interested in
            GameObject gameObject = GameObject.Find(gameObjectName).transform.GetChild(0).gameObject;

            SamplingInformation samplingInformation = new SamplingInformation(gameObject);

            NDOSubsampling.Configuration ndosConfig = new NDOSubsampling.Configuration(
                referenceTransform: gameObject.transform.root,
                percentage: 100,
                binCount: 6
                );

            AllPointsSampler.Configuration allPointsConfig = new AllPointsSampler.Configuration(
                referenceTransform: gameObject.transform.root,
                normalProcessing: AllPointsSampler.Configuration.NormalProcessing.VertexNormals
                );

            SamplingInformation samplingInfo = new SamplingInformation(gameObject);

            List <Point> expected = new AllPointsSampler(allPointsConfig).Sample(samplingInfo);
            List <Point> actual   = new NDOSubsampling(ndosConfig).Sample(samplingInfo);

            Assert.That(actual, Is.EquivalentTo(expected));
        }