docs.unity.cn
    Show / Hide Table of Contents

    Method square

    square(Single)

    Computes the square (x * x) of the input argument x.

    Declaration
    public static float square(float x)
    Parameters
    Type Name Description
    Single x

    Value to square.

    Returns
    Type Description
    Single

    Returns the square of the input.

    square(float2)

    Computes the component-wise square (x * x) of the input argument x.

    Declaration
    public static float2 square(float2 x)
    Parameters
    Type Name Description
    float2 x

    Value to square.

    Returns
    Type Description
    float2

    Returns the square of the input.

    square(float3)

    Computes the component-wise square (x * x) of the input argument x.

    Declaration
    public static float3 square(float3 x)
    Parameters
    Type Name Description
    float3 x

    Value to square.

    Returns
    Type Description
    float3

    Returns the square of the input.

    square(float4)

    Computes the component-wise square (x * x) of the input argument x.

    Declaration
    public static float4 square(float4 x)
    Parameters
    Type Name Description
    float4 x

    Value to square.

    Returns
    Type Description
    float4

    Returns the square of the input.

    square(Double)

    Computes the square (x * x) of the input argument x.

    Declaration
    public static double square(double x)
    Parameters
    Type Name Description
    Double x

    Value to square.

    Returns
    Type Description
    Double

    Returns the square of the input.

    square(double2)

    Computes the component-wise square (x * x) of the input argument x.

    Declaration
    public static double2 square(double2 x)
    Parameters
    Type Name Description
    double2 x

    Value to square.

    Returns
    Type Description
    double2

    Returns the square of the input.

    square(double3)

    Computes the component-wise square (x * x) of the input argument x.

    Declaration
    public static double3 square(double3 x)
    Parameters
    Type Name Description
    double3 x

    Value to square.

    Returns
    Type Description
    double3

    Returns the square of the input.

    square(double4)

    Computes the component-wise square (x * x) of the input argument x.

    Declaration
    public static double4 square(double4 x)
    Parameters
    Type Name Description
    double4 x

    Value to square.

    Returns
    Type Description
    double4

    Returns the square of the input.

    square(Int32)

    Computes the square (x * x) of the input argument x.

    Declaration
    public static int square(int x)
    Parameters
    Type Name Description
    Int32 x

    Value to square.

    Returns
    Type Description
    Int32

    Returns the square of the input.

    Remarks

    Due to integer overflow, it's not always guaranteed that square(x) is positive. For example, square(46341) will return -2147479015.

    square(int2)

    Computes the component-wise square (x * x) of the input argument x.

    Declaration
    public static int2 square(int2 x)
    Parameters
    Type Name Description
    int2 x

    Value to square.

    Returns
    Type Description
    int2

    Returns the square of the input.

    Remarks

    Due to integer overflow, it's not always guaranteed that square(x) is positive. For example, square(new int2(46341)) will return new int2(-2147479015).

    square(int3)

    Computes the component-wise square (x * x) of the input argument x.

    Declaration
    public static int3 square(int3 x)
    Parameters
    Type Name Description
    int3 x

    Value to square.

    Returns
    Type Description
    int3

    Returns the square of the input.

    Remarks

    Due to integer overflow, it's not always guaranteed that square(x) is positive. For example, square(new int3(46341)) will return new int3(-2147479015).

    square(int4)

    Computes the component-wise square (x * x) of the input argument x.

    Declaration
    public static int4 square(int4 x)
    Parameters
    Type Name Description
    int4 x

    Value to square.

    Returns
    Type Description
    int4

    Returns the square of the input.

    Remarks

    Due to integer overflow, it's not always guaranteed that square(x) is positive. For example, square(new int4(46341)) will return new int4(-2147479015).

    square(UInt32)

    Computes the square (x * x) of the input argument x.

    Declaration
    public static uint square(uint x)
    Parameters
    Type Name Description
    UInt32 x

    Value to square.

    Returns
    Type Description
    UInt32

    Returns the square of the input.

    Remarks

    Due to integer overflow, it's not always guaranteed that square(x) >= x. For example, square(4294967295u) will return 1u.

    square(uint2)

    Computes the component-wise square (x * x) of the input argument x.

    Declaration
    public static uint2 square(uint2 x)
    Parameters
    Type Name Description
    uint2 x

    Value to square.

    Returns
    Type Description
    uint2

    Returns the square of the input.

    Remarks

    Due to integer overflow, it's not always guaranteed that square(x) >= x. For example, square(new uint2(4294967295u)) will return new uint2(1u).

    square(uint3)

    Computes the component-wise square (x * x) of the input argument x.

    Declaration
    public static uint3 square(uint3 x)
    Parameters
    Type Name Description
    uint3 x

    Value to square.

    Returns
    Type Description
    uint3

    Returns the square of the input.

    Remarks

    Due to integer overflow, it's not always guaranteed that square(x) >= x. For example, square(new uint3(4294967295u)) will return new uint3(1u).

    square(uint4)

    Computes the component-wise square (x * x) of the input argument x.

    Declaration
    public static uint4 square(uint4 x)
    Parameters
    Type Name Description
    uint4 x

    Value to square.

    Returns
    Type Description
    uint4

    Returns the square of the input.

    Remarks

    Due to integer overflow, it's not always guaranteed that square(x) >= x. For example, square(new uint4(4294967295u)) will return new uint4(1u).

    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