-
Notifications
You must be signed in to change notification settings - Fork 123
VRageMath.MathHelper
← Index ← Namespace Index
public abstract sealed class MathHelper
Contains commonly used precalculated values.
Namespace: VRageMath
Assembly: VRage.Math.dll
Represents the mathematical constant e.
Represents the value of pi times two.
Represents the log base ten of e.
Represents the log base two of e.
Represents the value of pi.
Represents the value of pi divided by two.
Represents the value of pi divided by four.
static float RadiansPerSecondToRPM
60 / 2*pi
static float RPMToRadiansPerMillisec
2*pi / 60000
static float RPMToRadiansPerSecond
2*pi / 60
Represents the value of the square root of two
Represents the value of the square root of three
Represents the value of pi times two.
static int Align(int value, int alignment)
Faster Atan implementation. Good only in the [-pi/2, pi/2] range.
Faster Atan implementation. Good only in the [-pi/2, pi/2] range.
static float Barycentric(float value1, float value2, float value3, float amount1, float amount2)
Returns the Cartesian coordinate for one axis of a point that is defined by a given triangle and two normalized barycentric (areal) coordinates.
static Vector3D CalculateBezierPoint(double t, Vector3D p0, Vector3D p1, Vector3D p2, Vector3D p3)
static Vector3 CalculateVectorOnSphere(Vector3 northPoleDir, float phi, float theta)
static float CatmullRom(float value1, float value2, float value3, float value4, float amount)
Performs a Catmull-Rom interpolation using the specified positions.
static int CeilToInt(double x)
static float Clamp(float value, float min, float max)
Restricts a value to be within a specified range. Reference page contains links to related code samples.
static double Clamp(double value, double min, double max)
Restricts a value to be within a specified range. Reference page contains links to related code samples.
static MyFixedPoint Clamp(MyFixedPoint value, MyFixedPoint min, MyFixedPoint max)
Restricts a value to be within a specified range. Reference page contains links to related code samples.
static int Clamp(int value, int min, int max)
Restricts a value to be within a specified range. Reference page contains links to related code samples.
static byte Clamp(byte value, byte min, byte max)
Restricts a value to be within a specified range.
static int ComputeHashFromBytes(Byte[] bytes)
static double CubicInterp(double p0, double p1, double p2, double p3, double t)
static float Distance(float value1, float value2)
Calculates the absolute value of the difference of two values.
static int FloorToInt(float x)
static int FloorToInt(double x)
static int GetNearestBiggerPowerOfTwo(int v)
static uint GetNearestBiggerPowerOfTwo(uint v)
static int GetNearestBiggerPowerOfTwo(float f)
Returns nearest bigger power of two
static int GetNearestBiggerPowerOfTwo(double f)
static int GetNumberOfMipmaps(int v)
static float Hermite(float value1, float tangent1, float value2, float tangent2, float amount)
Performs a Hermite spline interpolation.
static float InterpLog(float value, float amount1, float amount2)
Performs interpolation on logarithmic scale.
static float InterpLogInv(float value, float amount1, float amount2)
static bool IsEqual(float value1, float value2)
static bool IsEqual(Vector2 value1, Vector2 value2)
static bool IsEqual(Vector3 value1, Vector3 value2)
static bool IsEqual(Quaternion value1, Quaternion value2)
static bool IsEqual(QuaternionD value1, QuaternionD value2)
static bool IsEqual(Matrix value1, Matrix value2)
static bool IsPowerOfTwo(int x)
Returns true if value is power of two
static bool IsValid(Matrix matrix)
static bool IsValid(MatrixD matrix)
static bool IsValid(Vector3 vec)
static bool IsValid(Vector3D vec)
static bool IsValid(Vector2 vec)
static bool IsValid(Vector3? vec)
static bool IsValid(Quaternion q)
static bool IsValidNormal(Vector3 vec)
static bool IsValidOrZero(Matrix matrix)
static bool IsZero(float value, float epsilon = 1E-05)
static bool IsZero(double value, float epsilon = 1E-05)
static bool IsZero(Vector3 value, float epsilon = 1E-05)
static bool IsZero(Vector3D value, float epsilon = 1E-05)
static bool IsZero(Quaternion value, float epsilon = 1E-05)
static bool IsZero(Vector4 value)
static float Lerp(float value1, float value2, float amount)
Linearly interpolates between two values.
static double Lerp(double value1, double value2, double amount)
Linearly interpolates between two values.
static void LimitRadians(ref float angle)
Returns angle in range 0..2*PI
static void LimitRadians2PI(ref double angle)
Returns angle in range 0..2*PI
static void LimitRadiansPI(ref double angle)
Returns angle in range -PI..PI
static void LimitRadiansPI(ref float angle)
Returns angle in range -PI..PI
static int Log2Ceiling(int value)
static int Log2Floor(int value)
static float Max(float value1, float value2)
Returns the greater of two values.
static double Max(double value1, double value2)
Returns the greater of two values.
static float Max(float a, float b, float c)
static int Max(int a, int b, int c)
static double Max(double a, double b, double c)
static float Min(float value1, float value2)
Returns the lesser of two values.
static double Min(double value1, double value2)
Returns the lesser of two values.
static float Min(float a, float b, float c)
static double Min(double a, double b, double c)
static float MonotonicAcos(float cos)
static float MonotonicCosine(float radians)
Calculate the monotonic cosine of a value. Monotonic cosine is an alternative cosine encoding that is monotonic in the [-pi, pi] interval. We use this when some parameter of an onject in a planet is constrained by latitude. The 'monotonicity' is guaranteed by subtracting the cosine value from 2 if the angle is positive. So for instance MonotonicCos(pi/2) = 2. This only works in the above interval of course.
Returns 2^n
static float RoundOn2(float x)
static int RoundToInt(float x)
static int RoundToInt(double x)
static float Saturate(float n)
static double Saturate(double n)
static double SCurve3(double t)
static double SCurve5(double t)
static int Smooth(int newValue, int lastSmooth)
static float Smooth(float newValue, float lastSmooth)
static float SmoothStep(float value1, float value2, float amount)
Interpolates between two values using a cubic equation.
static double SmoothStep(double value1, double value2, double amount)
Interpolates between two values using a cubic equation.
static float SmoothStepStable(float amount)
Interpolates between zero and one using cubic equiation, solved by de Casteljau.
static double SmoothStepStable(double amount)
Interpolates between zero and one using cubic equiation, solved by de Casteljau.
static float ToDegrees(float radians)
Converts radians to degrees.
static double ToDegrees(double radians)
static float ToRadians(float degrees)
Converts degrees to radians.
static Vector3 ToRadians(Vector3 v)
static double ToRadians(double degrees)
Converts degrees to radians.
static float WrapAngle(float angle)
Reduces a given angle to a value between π and -π.
Do you have questions, comments, suggestions for improvements? Is there something I can do better? Did I make a mistake? Please add an issue here, and prefix your issue title with Wiki. Thank you, your help will be very appreciated!