27.09.2020
~ Moved Default-Shader to 2D to provied 2D-specific feature ~ Fixed UVs in Polygon
This commit is contained in:
parent
617a7ef044
commit
2aa12f8d25
19 changed files with 166 additions and 83 deletions
23
SMCode/SM.Base/Utility/BezierCurve.cs
Normal file
23
SMCode/SM.Base/Utility/BezierCurve.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
using System;
|
||||
|
||||
namespace SM.Utility
|
||||
{
|
||||
public class BezierCurve
|
||||
{
|
||||
public static float Calculate(float t, params float[] points)
|
||||
{
|
||||
int pointAmount = points.Length;
|
||||
int itterations = pointAmount - 1;
|
||||
|
||||
double x = Math.Pow(1 - t, itterations) * points[0];
|
||||
for (int i = 1; i < itterations; i++)
|
||||
{
|
||||
if (i % 2 == 0) x += itterations * (1 - t) * Math.Pow(t, itterations - 1) * points[i];
|
||||
else x += itterations * Math.Pow(1 - t, itterations - 1) * t * points[i];
|
||||
}
|
||||
|
||||
x += Math.Pow(t, itterations) * points[pointAmount - 1];
|
||||
return (float)x;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue