docs.unity.cn
    Show / Hide Table of Contents

    Method remap

    remap(Single, Single, Single, Single, Single)

    Returns the result of a non-clamping linear remapping of a value x from source range [a, b] to the destination range [c, d].

    Declaration
    public static float remap(float a, float b, float c, float d, float x)
    Parameters
    Type Name Description
    Single a

    The first endpoint of the source range [a,b].

    Single b

    The second endpoint of the source range [a, b].

    Single c

    The first endpoint of the destination range [c, d].

    Single d

    The second endpoint of the destination range [c, d].

    Single x

    The value to remap from the source to destination range.

    Returns
    Type Description
    Single

    The remap of input x from the source range to the destination range.

    remap(float2, float2, float2, float2, float2)

    Returns the componentwise result of a non-clamping linear remapping of a value x from source range [a, b] to the destination range [c, d].

    Declaration
    public static float2 remap(float2 a, float2 b, float2 c, float2 d, float2 x)
    Parameters
    Type Name Description
    float2 a

    The first endpoint of the source range [a,b].

    float2 b

    The second endpoint of the source range [a, b].

    float2 c

    The first endpoint of the destination range [c, d].

    float2 d

    The second endpoint of the destination range [c, d].

    float2 x

    The value to remap from the source to destination range.

    Returns
    Type Description
    float2

    The componentwise remap of input x from the source range to the destination range.

    remap(float3, float3, float3, float3, float3)

    Returns the componentwise result of a non-clamping linear remapping of a value x from source range [a, b] to the destination range [c, d].

    Declaration
    public static float3 remap(float3 a, float3 b, float3 c, float3 d, float3 x)
    Parameters
    Type Name Description
    float3 a

    The first endpoint of the source range [a,b].

    float3 b

    The second endpoint of the source range [a, b].

    float3 c

    The first endpoint of the destination range [c, d].

    float3 d

    The second endpoint of the destination range [c, d].

    float3 x

    The value to remap from the source to destination range.

    Returns
    Type Description
    float3

    The componentwise remap of input x from the source range to the destination range.

    remap(float4, float4, float4, float4, float4)

    Returns the componentwise result of a non-clamping linear remapping of a value x from source range [a, b] to the destination range [c, d].

    Declaration
    public static float4 remap(float4 a, float4 b, float4 c, float4 d, float4 x)
    Parameters
    Type Name Description
    float4 a

    The first endpoint of the source range [a,b].

    float4 b

    The second endpoint of the source range [a, b].

    float4 c

    The first endpoint of the destination range [c, d].

    float4 d

    The second endpoint of the destination range [c, d].

    float4 x

    The value to remap from the source to destination range.

    Returns
    Type Description
    float4

    The componentwise remap of input x from the source range to the destination range.

    remap(Double, Double, Double, Double, Double)

    Returns the result of a non-clamping linear remapping of a value x from source range [a, b] to the destination range [c, d].

    Declaration
    public static double remap(double a, double b, double c, double d, double x)
    Parameters
    Type Name Description
    Double a

    The first endpoint of the source range [a,b].

    Double b

    The second endpoint of the source range [a, b].

    Double c

    The first endpoint of the destination range [c, d].

    Double d

    The second endpoint of the destination range [c, d].

    Double x

    The value to remap from the source to destination range.

    Returns
    Type Description
    Double

    The remap of input x from the source range to the destination range.

    remap(double2, double2, double2, double2, double2)

    Returns the componentwise result of a non-clamping linear remapping of a value x from source range [a, b] to the destination range [c, d].

    Declaration
    public static double2 remap(double2 a, double2 b, double2 c, double2 d, double2 x)
    Parameters
    Type Name Description
    double2 a

    The first endpoint of the source range [a,b].

    double2 b

    The second endpoint of the source range [a, b].

    double2 c

    The first endpoint of the destination range [c, d].

    double2 d

    The second endpoint of the destination range [c, d].

    double2 x

    The value to remap from the source to destination range.

    Returns
    Type Description
    double2

    The componentwise remap of input x from the source range to the destination range.

    remap(double3, double3, double3, double3, double3)

    Returns the componentwise result of a non-clamping linear remapping of a value x from source range [a, b] to the destination range [c, d].

    Declaration
    public static double3 remap(double3 a, double3 b, double3 c, double3 d, double3 x)
    Parameters
    Type Name Description
    double3 a

    The first endpoint of the source range [a,b].

    double3 b

    The second endpoint of the source range [a, b].

    double3 c

    The first endpoint of the destination range [c, d].

    double3 d

    The second endpoint of the destination range [c, d].

    double3 x

    The value to remap from the source to destination range.

    Returns
    Type Description
    double3

    The componentwise remap of input x from the source range to the destination range.

    remap(double4, double4, double4, double4, double4)

    Returns the componentwise result of a non-clamping linear remapping of a value x from source range [a, b] to the destination range [c, d].

    Declaration
    public static double4 remap(double4 a, double4 b, double4 c, double4 d, double4 x)
    Parameters
    Type Name Description
    double4 a

    The first endpoint of the source range [a,b].

    double4 b

    The second endpoint of the source range [a, b].

    double4 c

    The first endpoint of the destination range [c, d].

    double4 d

    The second endpoint of the destination range [c, d].

    double4 x

    The value to remap from the source to destination range.

    Returns
    Type Description
    double4

    The componentwise remap of input x from the source range to the destination range.

    Back to top Copyright © 2022 Unity Technologies
    Generated by DocFX
    on Tuesday, March 29, 2022
    Terms of use