You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
NodeEditor/Extensions/MathExtensions.cs

51 lines
1.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
namespace NodeEditor.Extensions
{
class MathExtensions
{
public static int Map(int value, int min, int max)
{
if (value > max)
return max;
if (value < min)
return min;
return value;
}
public static double Map(double value, int min, int max)
{
if (value > max)
return max;
if (value < min)
return min;
return value;
}
public static bool InRange(int value, int min, int max)
{
return value > min && value < max;
}
public static bool InRange(double value, double min, double max)
{
return value > min && value < max;
}
public static TransformGroup applyMultiTransform(params Transform[] transforms)
{
TransformGroup temp = new TransformGroup();
foreach (Transform t in transforms)
temp.Children.Add(t);
return temp;
}
}
}