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])); } }