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