Class CoefficientUtils | XR Tools Utilities | 1.0.0
docs.unity3d.com
    Show / Hide Table of Contents

    Class CoefficientUtils

    Utility methods for calculating portions of distances as 0-1 numbers

    Inheritance
    Object
    CoefficientUtils
    Namespace: Unity.XRTools.Utils
    Syntax
    public static class CoefficientUtils

    Methods

    FromDistance(Single, Single, Single)

    Returns the interpolation value covered by a given range. Ensure that max != min to avoid dividing by zero

    Declaration
    public static float FromDistance(float distance, float min, float max)
    Parameters
    Type Name Description
    Single distance

    The actual distance value

    Single min

    the distance at which the coefficient will be 0

    Single max

    the distance at which the coefficient will be 1

    Returns
    Type Description
    Single

    the interpolation value covered by a given range

    FromDistance(Vector3, Vector3, Single, Single)

    Returns the interpolation value covered by a given range. Ensure that max != min to avoid dividing by zero

    Declaration
    public static float FromDistance(Vector3 a, Vector3 b, float min, float max)
    Parameters
    Type Name Description
    Vector3 a

    Either of the pair of points

    Vector3 b

    Either of the pair of points

    Single min

    the distance at which the coefficient will be 0

    Single max

    the distance at which the coefficient will be 1

    Returns
    Type Description
    Single

    the interpolation value covered by a given range

    FromInverseDistance(Vector3, Vector3, Single, Single)

    Returns the interpolation value covered by a given inverse range. Ensure that max != min to avoid dividing by zero

    Declaration
    public static float FromInverseDistance(Vector3 a, Vector3 b, float max, float min)
    Parameters
    Type Name Description
    Vector3 a

    Either of the pair of points

    Vector3 b

    Either of the pair of points

    Single max

    the distance at which the coefficient will be 1

    Single min

    the distance at which the coefficient will be 0

    Returns
    Type Description
    Single

    the interpolation value covered by a given inverse range

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023