docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method AreApproxEqual

    AreApproxEqual(float, float, float)

    Checks if the magnitude of the difference between the given two floats is almost zero, using an absolute tolerance.

    Declaration
    public static bool AreApproxEqual(float a, float b, float toleranceSquared = 1E-12)
    Parameters
    Type Name Description
    float a

    The first value.

    float b

    The second value.

    float toleranceSquared

    The absolute tolerance, squared. The default value is EpsilonSquared.

    Returns
    Type Description
    bool

    True if the magnitude of the difference between the given two values is smaller than the tolerance.

    AreApproxEqual(Vector2, Vector2, float)

    Checks if the magnitude of the difference between the given two 2D vectors is almost zero, using an absolute tolerance.

    Declaration
    public static bool AreApproxEqual(Vector2 a, Vector2 b, float toleranceSquared = 1E-12)
    Parameters
    Type Name Description
    Vector2 a

    The first value.

    Vector2 b

    The second value.

    float toleranceSquared

    The absolute tolerance, squared. The default value is EpsilonSquared.

    Returns
    Type Description
    bool

    True if the magnitude of the difference between the given two values is smaller than the tolerance.

    AreApproxEqual(Vector3, Vector3, float)

    Checks if the magnitude of the difference between the given two 3D vectors is almost zero, using an absolute tolerance.

    Declaration
    public static bool AreApproxEqual(Vector3 a, Vector3 b, float toleranceSquared = 1E-12)
    Parameters
    Type Name Description
    Vector3 a

    The first value.

    Vector3 b

    The second value.

    float toleranceSquared

    The absolute tolerance, squared. The default value is EpsilonSquared.

    Returns
    Type Description
    bool

    True if the magnitude of the difference between the given two values is smaller than the tolerance.

    AreApproxEqual(Vector4, Vector4, float)

    Checks if the magnitude of the difference between the given two 4D vectors is almost zero, using an absolute tolerance.

    Declaration
    public static bool AreApproxEqual(Vector4 a, Vector4 b, float toleranceSquared = 1E-12)
    Parameters
    Type Name Description
    Vector4 a

    The first value.

    Vector4 b

    The second value.

    float toleranceSquared

    The absolute tolerance, squared. The default value is EpsilonSquared.

    Returns
    Type Description
    bool

    True if the magnitude of the difference between the given two values is smaller than the tolerance.

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)