public void TestSample_Cube_50()
        {
            EditorSceneManager.OpenScene(sceneName);

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

            SamplingInformation samplingInformation = new SamplingInformation(gameObject);

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

            SamplingInformation samplingInfo = new SamplingInformation(gameObject);

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


            NormalBinner binner = new NormalBinner(ndosConfig.BinCount, ndosConfig.referenceTransform);
            Dictionary <int, List <Point> > bins = binner.Bin(samplingInformation);

            for (int i = 0; i < bins.Count; i++)
            {
                Assert.That(CountPointsSampledFromBin(actual, bins[i]), Is.EqualTo(2));
            }
        }
        public void TestSample_Pyramid_45()
        {
            EditorSceneManager.OpenScene(sceneName);

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

            SamplingInformation samplingInformation = new SamplingInformation(gameObject);

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

            SamplingInformation             samplingInfo = new SamplingInformation(gameObject);
            Dictionary <int, List <Point> > bins         = new NormalBinner(ndosConfig).Bin(samplingInformation);

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

            Assert.That(CountPointsSampledFromBin(actual, bins[0]), Is.EqualTo(1));
            Assert.That(CountPointsSampledFromBin(actual, bins[1]), Is.EqualTo(1));
            Assert.That(CountPointsSampledFromBin(actual, bins[2]), Is.EqualTo(0));
            Assert.That(CountPointsSampledFromBin(actual, bins[3]), Is.EqualTo(1));
            Assert.That(CountPointsSampledFromBin(actual, bins[4]), Is.EqualTo(1));
            Assert.That(CountPointsSampledFromBin(actual, bins[5]), Is.EqualTo(2));
        }
        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));
        }
        public void ValidProbability_WithConstructor(float percentage, float expected)
        {
            NDOSubsampling.Configuration config = new NDOSubsampling.Configuration(validTransform, percentage, validBinCount);

            float actual = config.Probability;

            Assert.AreEqual(expected, actual);
        }
 public void SetValidBinCountConstructor(int binCount)
 {
     Assert.DoesNotThrow(
         delegate
     {
         object config = new NDOSubsampling.Configuration(validTransform, validPercentage, binCount);
     }
         );
 }
 public void SetValidPercentageConstructor(float percentage)
 {
     Assert.DoesNotThrow(
         delegate
     {
         NDOSubsampling.Configuration config = new NDOSubsampling.Configuration(validTransform, percentage, validBinCount);
     }
         );
 }
 public void SetInvalidPercentageConstructor(float percentage)
 {
     Assert.Throws <ArgumentException>(
         delegate
     {
         NDOSubsampling.Configuration y = new NDOSubsampling.Configuration(validTransform, percentage, validBinCount);
     }
         );
 }
 public void SetValidBinCountSetter(int binCount)
 {
     NDOSubsampling.Configuration config = new NDOSubsampling.Configuration(validTransform, validPercentage, validBinCount);
     Assert.DoesNotThrow(
         delegate
     {
         config.BinCount = binCount;
     }
         );
 }
 public void SetInvalidBinCountConstructor(int binCount)
 {
     Assert.Throws(
         typeof(ArgumentException),
         delegate
     {
         NDOSubsampling.Configuration config = new NDOSubsampling.Configuration(validTransform, validPercentage, binCount);
     }
         );
 }
 public void SetValidPercentageSetter(float percentage)
 {
     NDOSubsampling.Configuration config = new NDOSubsampling.Configuration(validTransform, validPercentage, validBinCount);
     Assert.DoesNotThrow(
         delegate
     {
         config.Percentage = percentage;
     }
         );
 }
 public void SetInvalidPercentageSetter(float percentage)
 {
     NDOSubsampling.Configuration config = new NDOSubsampling.Configuration(validTransform, validPercentage, validBinCount);
     Assert.Throws <ArgumentException>(
         delegate
     {
         config.Percentage = percentage;
     }
         );
 }