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_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 Test_Bin(string gameObjectName, Dictionary <int, List <Point> > expected) { 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; Transform referenceTransform = gameObject.transform.root; SamplingInformation samplingInformation = new SamplingInformation(gameObject); NormalBinner binner = new NormalBinner(6, referenceTransform); Dictionary <int, List <Point> > actual = binner.Bin(samplingInformation); Assert.That(actual.Keys, Is.EquivalentTo(expected.Keys)); for (int i = 0; i < actual.Count; i++) { Assert.That(actual[i], Is.EquivalentTo(expected[i])); } }
public void Test_Constructor_With_Invalid_Bin_Count() { Assert.Throws <ArgumentException>( delegate { NormalBinner binner = new NormalBinner(7, null); } ); }