private void computeButton_Click(object sender, EventArgs e) { var bb = input.Trajectory.BuildBoundingBox(); var bbDiagonal = Math.Sqrt(Math.Pow(bb.Width, 2) + Math.Pow(bb.Height, 2)); var detailFactor = ((double)detailPercentileNumericUpDown.Value) * bbDiagonal; var zoomFactor = (double)zoomFactorNumericUpDown.Value; var numLevels = (int)numLevelsNumericUpDown.Value; var errors = new List <double>(); for (var level = 1; level <= numLevels; level++) { errors.Add(detailFactor / Math.Pow(zoomFactor, numLevels - level)); } NewSamples.Invoke(errors); }
private void BuildErrorDistribution() { if (maxErrors == null) { return; } var numEpsilons = maxErrors.Count; var start = (double)(lowerPercentageChooser.Value / 100 * (numEpsilons - 1)); var end = (double)(upperPercentageChooser.Value / 100 * (numEpsilons - 1)); var numLevels = (int)numLevelsNumericUpDown.Value; var range = end - start; var step = numLevels == 1 ? 0 : range / (numLevels - 1); var errors = new List <double>(); var index = start; for (var level = 1; level <= numLevels; level++) { var intIndex = (int)index; var epsilon = maxErrors[intIndex]; if (index > intIndex && (intIndex + 1 <= maxErrors.Count - 1)) { var nextEpsilon = maxErrors[intIndex + 1]; var remainder = index - intIndex; epsilon += (nextEpsilon - epsilon) * remainder; } errors.Add(epsilon); index += step; } NewSamples.Invoke(errors); }