using System; using System.Diagnostics; namespace Testthings { class Program { static int countNum = 0; static void Main(string[] args) { var x = 0.0001; for (int i = 0; i < 360; i++) { x = x + .017453292519; var y = Math.Sin(x) * 250; Debug.WriteLine($"pos [{i}] x={x}, y={y}"); } //Console.WriteLine($"testar scaling {445} -> {scaleStep(445, 8)}"); } private static long scaleStep(decimal maxValue, int maxSteps) { long stepValue = nextValue(true); long tmpValue = stepValue; int _maxSteps = (int)((int) maxValue/stepValue); while (_maxSteps > maxSteps) { stepValue = tmpValue * nextValue(); _maxSteps = (int)((int)maxValue / stepValue); tmpValue = stepValue == tmpValue * 10 ? stepValue : tmpValue; } return stepValue; } private static int nextValue(bool first=false) { if (first) { countNum = 1; } else { switch (countNum) { case 1: { countNum = 2; break; } case 2: { countNum = 5; break; } case 5: { countNum = 10; break; } case 10: { countNum = 2; break; } } } return countNum; } } }