public void TestMean_EmptyList() { List <float> errors = new List <float>(); float expected = 0.0f; float actual = AggregationMethods.Mean(errors); Assert.That(actual, Is.EqualTo(expected).Within(tolerance)); }
public void TestMean_NormalList() { List <float> errors = new List <float> { 1, 2, 3, 4, 5.5f }; float expected = 3.1f; float actual = AggregationMethods.Mean(errors); Assert.That(actual, Is.EqualTo(expected).Within(tolerance)); }
public float ComputeInitialError(CorrespondenceCollection correspondences) { Matrix4x4 normalizationMatrix = Matrix4x4.identity; if (configuration.NormalizePoints) { normalizationMatrix = new PointNormalizer().ComputeNormalizationMatrix(correspondences.ModelPoints, correspondences.StaticPoints); } List <float> errors = ComputeCorrespondenceErrors( normalizationMatrix, modelPoints: correspondences.ModelPoints, staticPoints: correspondences.StaticPoints ); //Aggregate the errors, use mean to ensure that the number of correspondences does not influence the error float error = AggregationMethods.Mean(errors); return(error); }