Click or drag to resize
MathUtils Class
Contains little math utils that are often used. If there are long methods or multiple methods of the same type, think about moving them into a seperate class, so this file doesn't get too big.
Inheritance Hierarchy
SystemObject
  Slash.Math.UtilsMathUtils

Namespace: Slash.Math.Utils
Assembly: Slash.Math (in Slash.Math.dll) Version: 1.0.6018.40177
Syntax
public static class MathUtils

The MathUtils type exposes the following members.

Methods
  NameDescription
Public methodStatic memberAbs
Returns the absolute value of the passed number.
Public methodStatic memberACos
Returns the angle whose cosine is the specified number, in radians.
Public methodStatic memberASin
Returns the angle whose sine is the specified number, in radians.
Public methodStatic memberATan
Returns the angle whose tangent is the specified number, in radians.
Public methodStatic memberAtan2
Returns the angle in radians between the positive x-axis of a plane and the point given by the coordinates (x, y).
Public methodStatic memberCeil
Returns the smallest integral value that is greater than or equal to the specified value.
Public methodStatic memberCeilToInt
Converts the specified float value to the ceil value as an integer. The smallest integer bigger than or equal the specified value is returned.
Public methodStatic memberClampT
Clamps the passed value to the passed bounds (i.e. if value is smaller than min bound it's set to min bound, if bigger than max bound it's set to max bound).
Public methodStatic memberCos
Returns the cosine of the specified angle in radians.
Public methodStatic memberExp
Returns e raised to the specified power.
Public methodStatic memberFloatEquals(Single, Single)
Checks if the passed float values are "equal". I.e. checking if the difference between the two is smaller than the epsilon value specified in MathUtils.Epsilon.
Public methodStatic memberFloatEquals(Vector2F, Vector2F)
Checks if the passed vector's components are "equal". I.e. checking if the difference between the components of the two is smaller than the epsilon value specified in MathUtils.Epsilon.
Public methodStatic memberFloatEquals(Single, Single, Single)
Checks if a floating point Value is equal to another, within a certain tolerance.
Public methodStatic memberFloatEquals(Vector2F, Vector2F, Single)
Checks if the passed vector's components are "equal". I.e. checking if the difference between the components of the two is smaller than the passed delta.
Public methodStatic memberFloatInRange
Checks if a floating point Value is within a specified range of values (inclusive).
Public methodStatic memberFloor
Rounds the passed float value down.
Public methodStatic memberFloorToInt
Converts the specified float value to the floor value as an integer. The largest integer less than or equal the specified value is returned.
Public methodStatic memberIsWithinBoundsT
Checks if the passed value is within the passed bounds (i.e. bigger or equal minimum bound and smaller maximum bound).
Public methodStatic memberIsWithinBoundsInclusiveT
Checks if the specified value is within the specified bounds (i.e. bigger or equal minimum bound and smaller or equal maximum bound).
Public methodStatic memberLerp
Linear interpolation of a float. TODO: generic
Public methodStatic memberLog(Single)
Returns the natural logarithm of the specified number.
Public methodStatic memberLog(Single, Single)
Returns the logarithm of the specified number in the passed base.
Public methodStatic memberLog10
Returns the base 10 logarithm of the specified number.
Public methodStatic memberLog2
Returns the base 2 logarithm of the specified number.
Public methodStatic memberMaxT(T)
Returns the maximum value of the specified values.
Public methodStatic memberMaxT(T, T)
Returns the maximum value of the two passed values.
Public methodStatic memberMinT(T)
Returns the minimum value of the specified values.
Public methodStatic memberMinT(T, T)
Returns the minimum value of the two passed values.
Public methodStatic memberMod
Returns the remainder of the Euclidean division of a by n.
Public methodStatic memberPow(Int32, UInt32)
Returns the specified number raised to the passed power.
Public methodStatic memberPow(Single, Single)
Returns the specified number raised to the passed power.
Public methodStatic memberPow2(Int32)
Returns the square of the specified number.
Public methodStatic memberPow2(Single)
Returns the square of the specified number.
Public methodStatic memberPow3
Returns the cube of the specified number.
Public methodStatic memberRound(Single)
Rounds the specified number to the nearest integral value.
Public methodStatic memberRound(Single, Int32)
Rounds the specified number to the passed number of fractional digits.
Public methodStatic memberRoundToInt
Rounds the specified value to the nearest integral value.
Public methodStatic memberSaturate
Clamps the passed value to 0...1.
Public methodStatic memberSign
Determines the sign of the passed value. Returns -1 if value is negative, 1 if value is positive, 0 if value is zero.
Public methodStatic memberSin
Returns the sine of the specified angle in radians.
Public methodStatic memberSqrt
Returns the square root of the specified number.
Public methodStatic memberSwapT
Swaps the two specified values.
Public methodStatic memberTan
Returns the tangent of the specified angle in radians.
Public methodStatic memberWrap
Wraps value so that it is between 0.0(included) and 1.0(not included). Examples: 1.5 -> 0.5, 1.0 -> 0.0, -0.75 -> 0.25.
Public methodStatic memberWrapValue
Wraps a value with a specific base. E.g. 360°
Top
Fields
  NameDescription
Public fieldStatic memberE
Euler's number.
Public fieldStatic memberPi
Ratio of a circle's circumference to its diameter.
Public fieldStatic memberPiOver2
Pi divided by two.
Public fieldStatic memberPiOver4
Pi divided by four.
Public fieldStatic memberTwoPi
Pi multiplied with two.
Top
See Also