Add project files.

This commit is contained in:
2021-03-25 22:24:49 +01:00
parent a970f77cf0
commit 0a186bbe30
10 changed files with 512 additions and 0 deletions

75
Testthings/Program.cs Normal file
View File

@ -0,0 +1,75 @@
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;
}
}
}