Show / Hide Table of Contents

    Class MathUtils

    Inheritance
    System.Object
    MathUtils
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: AGS.API
    Assembly: AGS.API.dll
    Syntax
    public static class MathUtils

    Methods

    | Improve this Doc View Source

    Clamp(Single, Single, Single)

    Clamps "x" to be between min and max.

    Declaration
    public static float Clamp(float x, float min, float max)
    Parameters
    Type Name Description
    System.Single x

    The x coordinate.

    System.Single min

    Minimum.

    System.Single max

    Maximum.

    Returns
    Type Description
    System.Single

    The clamp.

    | Improve this Doc View Source

    DegreesToRadians(Single)

    Converts degrees to radians.

    Declaration
    public static float DegreesToRadians(float degrees)
    Parameters
    Type Name Description
    System.Single degrees

    Degrees.

    Returns
    Type Description
    System.Single

    The radians.

    | Improve this Doc View Source

    Distance(PointF, PointF)

    Returns the distance between 2 points.

    Declaration
    public static float Distance(PointF p1, PointF p2)
    Parameters
    Type Name Description
    PointF p1

    First point

    PointF p2

    Second point

    Returns
    Type Description
    System.Single

    The distance between the points

    | Improve this Doc View Source

    FloatEquals(Single, Single)

    Compare two floating numbers (with tolerance, as this is the only sensible way to compare floats: http://floating-point-gui.de/).

    Declaration
    public static bool FloatEquals(float x, float y)
    Parameters
    Type Name Description
    System.Single x

    The x coordinate.

    System.Single y

    The y coordinate.

    Returns
    Type Description
    System.Boolean

    true, if equals was floated, false otherwise.

    | Improve this Doc View Source

    GetNextPowerOf2(Int32)

    Gets the next number after "v" which is a power of 2.

    Declaration
    public static int GetNextPowerOf2(int v)
    Parameters
    Type Name Description
    System.Int32 v

    The value.

    Returns
    Type Description
    System.Int32

    The next power of 2.

    | Improve this Doc View Source

    IsPowerOf2(Int32)

    Is "x" the power of 2?

    Declaration
    public static bool IsPowerOf2(int x)
    Parameters
    Type Name Description
    System.Int32 x

    The x coordinate.

    Returns
    Type Description
    System.Boolean

    true, if x is the power of 2, false otherwise.

    | Improve this Doc View Source

    Lerp(Single, Single, Single, Single, Single)

    Performs a linear interpolation between values (https://en.wikipedia.org/wiki/Linear_interpolation).

    Declaration
    public static float Lerp(float x1, float y1, float x2, float y2, float targetX)
    Parameters
    Type Name Description
    System.Single x1

    The first x value.

    System.Single y1

    The first y value.

    System.Single x2

    The second x value.

    System.Single y2

    The second y value.

    System.Single targetX

    Target x.

    Returns
    Type Description
    System.Single

    The interpolated value.

    | Improve this Doc View Source

    Max(Single[])

    Returns the maximum between multiple values.

    Declaration
    public static float Max(params float[] values)
    Parameters
    Type Name Description
    System.Single[] values

    Values.

    Returns
    Type Description
    System.Single

    The max.

    | Improve this Doc View Source

    Min(Single[])

    Returns a minimum between multiple values.

    Declaration
    public static float Min(params float[] values)
    Parameters
    Type Name Description
    System.Single[] values

    Values.

    Returns
    Type Description
    System.Single

    The minimum.

    | Improve this Doc View Source

    Random()

    Returns a thread local random number generator.

    Declaration
    public static Random Random()
    Returns
    Type Description
    System.Random

    The random number generator.

    • Improve this Doc
    • View Source
    Back to top Generated by DocFX