Add project files.
This commit is contained in:
75
Testthings/Program.cs
Normal file
75
Testthings/Program.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
8
Testthings/Testthings.csproj
Normal file
8
Testthings/Testthings.csproj
Normal file
@ -0,0 +1,8 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user