Class MBMath
- Namespace
- TaleWorlds.Library
- Assembly
- TaleWorlds.Library.dll
public static class MBMath
- Inheritance
-
MBMath
- Inherited Members
Fields
DegreesToRadians
public const float DegreesToRadians = 0.017453292
Field Value
E
public const float E = 2.7182817
Field Value
Epsilon
public const float Epsilon = 1E-05
Field Value
HalfPI
public const float HalfPI = 1.5707964
Field Value
PI
public const float PI = 3.1415927
Field Value
RadiansToDegrees
public const float RadiansToDegrees = 57.295776
Field Value
TwoPI
public const float TwoPI = 6.2831855
Field Value
Methods
ApproximatelyEquals(float, float, float)
public static bool ApproximatelyEquals(float first, float second, float epsilon = 1E-05)
Parameters
Returns
ApproximatelyEqualsTo(float, float, float)
public static bool ApproximatelyEqualsTo(this float f, float comparedValue, float epsilon = 1E-05)
Parameters
Returns
BilinearLerp(float, float, float, float, float, float)
public static float BilinearLerp(float topLeft, float topRight, float botLeft, float botRight, float x, float y)
Parameters
Returns
CheckLineToLineSegmentIntersection(Vec2, Vec2, Vec2, Vec2, out float, out Vec2)
public static bool CheckLineToLineSegmentIntersection(Vec2 lineOrigin, Vec2 lineDirection, Vec2 segmentA, Vec2 segmentB, out float t, out Vec2 intersect)
Parameters
Returns
ClampAngle(float, float, float)
public static float ClampAngle(float angle, float restrictionCenter, float restrictionRange)
Parameters
Returns
ClampFloat(float, float, float)
public static float ClampFloat(float value, float minValue, float maxValue)
Parameters
Returns
ClampIndex(int, int, int)
public static int ClampIndex(int value, int minValue, int maxValue)
Parameters
Returns
ClampInt(int, int, int)
public static int ClampInt(int value, int minValue, int maxValue)
Parameters
Returns
ClampUnit(ref float)
public static void ClampUnit(ref float value)
Parameters
value
float
ColorFromRGBA(float, float, float, float)
public static uint ColorFromRGBA(float red, float green, float blue, float alpha)
Parameters
Returns
DistributeShares<T>(int, IEnumerable<T>, Func<T, int>)
public static IEnumerable<(T, int)> DistributeShares<T>(int totalAward, IEnumerable<T> stakeHolders, Func<T, int> shareFunction)
Parameters
totalAward
intstakeHolders
IEnumerable<T>shareFunction
Func<T, int>
Returns
- IEnumerable<(T, int)>
Type Parameters
T
GammaCorrectRGB(float, Vec3)
public static Vec3 GammaCorrectRGB(float gamma, Vec3 rgb)
Parameters
Returns
GetClosestPointInLineSegmentToPoint(Vec2, Vec2, Vec2)
public static Vec2 GetClosestPointInLineSegmentToPoint(Vec2 point, Vec2 lineSegmentBegin, Vec2 lineSegmentEnd)
Parameters
Returns
GetClosestPointInLineSegmentToPoint(Vec3, Vec3, Vec3)
public static Vec3 GetClosestPointInLineSegmentToPoint(Vec3 point, Vec3 lineSegmentBegin, Vec3 lineSegmentEnd)
Parameters
Returns
GetClosestPointOnLineSegment(Vec2, Vec2, Vec2, out Vec2)
public static float GetClosestPointOnLineSegment(Vec2 point, Vec2 segmentA, Vec2 segmentB, out Vec2 closest)
Parameters
Returns
GetNumberOfBitsToRepresentNumber(uint)
public static int GetNumberOfBitsToRepresentNumber(uint value)
Parameters
value
uint
Returns
GetNumberOfBitsToRepresentNumber(ulong)
public static int GetNumberOfBitsToRepresentNumber(ulong value)
Parameters
value
ulong
Returns
GetRayPlaneIntersectionPoint(in Vec3, in Vec3, in Vec3, in Vec3, out float)
public static bool GetRayPlaneIntersectionPoint(in Vec3 planeNormal, in Vec3 planeCenter, in Vec3 rayOrigin, in Vec3 rayDirection, out float t)
Parameters
Returns
GetSmallestDifferenceBetweenTwoAngles(float, float)
public static float GetSmallestDifferenceBetweenTwoAngles(float fromAngle, float toAngle)
Parameters
Returns
HSBtoRGB(float, float, float, float)
public static Color HSBtoRGB(float hue, float saturation, float brightness, float outputAlpha)
Parameters
Returns
IndexOfMax<T>(MBReadOnlyList<T>, Func<T, int>)
public static int IndexOfMax<T>(MBReadOnlyList<T> array, Func<T, int> func)
Parameters
array
MBReadOnlyList<T>func
Func<T, int>
Returns
Type Parameters
T
IntersectRayWithBoundaryList(Vec2, Vec2, List<Vec2>, out Vec2)
public static bool IntersectRayWithBoundaryList(Vec2 rayOrigin, Vec2 rayDir, List<Vec2> boundaries, out Vec2 intersectionPoint)
Parameters
Returns
InverseLerp(float, float, float)
public static float InverseLerp(float valueFrom, float valueTo, float value)
Parameters
Returns
IsBetween(int, int, int)
public static bool IsBetween(int value, int minValue, int maxValue)
Parameters
Returns
IsBetween(float, float, float)
public static bool IsBetween(float numberToCheck, float bottom, float top)
Parameters
Returns
IsBetweenInclusive(float, float, float)
public static bool IsBetweenInclusive(float numberToCheck, float bottom, float top)
Parameters
Returns
IsValidValue(float)
public static bool IsValidValue(float f)
Parameters
f
float
Returns
Lerp(float, float, float, float)
public static float Lerp(float valueFrom, float valueTo, float amount, float minimumDifference = 1E-05)
Parameters
Returns
Lerp(ref Mat3, ref Mat3, float, float)
public static Mat3 Lerp(ref Mat3 matFrom, ref Mat3 matTo, float amount, float minimumDifference)
Parameters
Returns
Lerp(Vec2, Vec2, float, float)
public static Vec2 Lerp(Vec2 vecFrom, Vec2 vecTo, float amount, float minimumDifference)
Parameters
Returns
Lerp(Vec3, Vec3, float, float)
public static Vec3 Lerp(Vec3 vecFrom, Vec3 vecTo, float amount, float minimumDifference)
Parameters
Returns
LerpRadians(float, float, float, float, float)
public static float LerpRadians(float valueFrom, float valueTo, float amount, float minChange, float maxChange)
Parameters
Returns
LinearExtrapolation(float, float, float)
public static float LinearExtrapolation(float valueFrom, float valueTo, float amount)
Parameters
Returns
Map(float, float, float, float, float)
public static float Map(float input, float inputMinimum, float inputMaximum, float outputMinimum, float outputMaximum)
Parameters
Returns
MaxElement<T>(IEnumerable<T>, Func<T, float>)
public static T MaxElement<T>(IEnumerable<T> collection, Func<T, float> func)
Parameters
collection
IEnumerable<T>func
Func<T, float>
Returns
- T
Type Parameters
T
MaxElements2<T>(IEnumerable<T>, Func<T, float>)
public static (T, T) MaxElements2<T>(IEnumerable<T> collection, Func<T, float> func)
Parameters
collection
IEnumerable<T>func
Func<T, float>
Returns
- (T, T)
Type Parameters
T
MaxElements3<T>(IEnumerable<T>, Func<T, float>)
public static (T, T, T) MaxElements3<T>(IEnumerable<T> collection, Func<T, float> func)
Parameters
collection
IEnumerable<T>func
Func<T, float>
Returns
- (T, T, T)
Type Parameters
T
MaxElements4<T>(IEnumerable<T>, Func<T, float>)
public static (T, T, T, T) MaxElements4<T>(IEnumerable<T> collection, Func<T, float> func)
Parameters
collection
IEnumerable<T>func
Func<T, float>
Returns
- (T, T, T, T)
Type Parameters
T
MaxElements5<T>(IEnumerable<T>, Func<T, float>)
public static (T, T, T, T, T) MaxElements5<T>(IEnumerable<T> collection, Func<T, float> func)
Parameters
collection
IEnumerable<T>func
Func<T, float>
Returns
- (T, T, T, T, T)
Type Parameters
T
RGBtoHSB(Color)
public static Vec3 RGBtoHSB(Color rgb)
Parameters
rgb
Color
Returns
SmoothStep(float, float, float)
public static float SmoothStep(float edge0, float edge1, float value)
Parameters
Returns
SplitLerp(float, float, float, float, float, float)
public static float SplitLerp(float value1, float value2, float value3, float cutOff, float amount, float minimumDifference)
Parameters
Returns
ToDegrees(float)
public static float ToDegrees(this float f)
Parameters
f
float
Returns
ToOrdinal(int)
public static string ToOrdinal(int number)
Parameters
number
int
Returns
ToRadians(float)
public static float ToRadians(this float f)
Parameters
f
float
Returns
TopologySort<T>(IEnumerable<T>, Func<T, IEnumerable<T>>)
public static IList<T> TopologySort<T>(IEnumerable<T> source, Func<T, IEnumerable<T>> getDependencies)
Parameters
source
IEnumerable<T>getDependencies
Func<T, IEnumerable<T>>
Returns
- IList<T>
Type Parameters
T
WrapAngle(float)
public static float WrapAngle(float angle)
Parameters
angle
float
Returns
This page was last modified at 09/01/2024 16:12:00 +00:00 (UTC).