Struct float2 | Package Manager UI website
docs.unity.cn
    Show / Hide Table of Contents

    Struct float2

    Namespace: Unity.Mathematics
    Syntax
    [Serializable]
    public struct float2 : IEquatable<float2>, IFormattable

    Constructors

    float2(Boolean)

    Constructs a float2 vector from a single bool value by converting it to float and assigning it to every component.

    Declaration
    public float2(bool v)
    Parameters
    Type Name Description
    System.Boolean v

    float2(Double)

    Constructs a float2 vector from a single double value by converting it to float and assigning it to every component.

    Declaration
    public float2(double v)
    Parameters
    Type Name Description
    System.Double v

    float2(Int32)

    Constructs a float2 vector from a single int value by converting it to float and assigning it to every component.

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

    float2(Single)

    Constructs a float2 vector from a single float value by assigning it to every component.

    Declaration
    public float2(float v)
    Parameters
    Type Name Description
    System.Single v

    float2(Single, Single)

    Constructs a float2 vector from two float values.

    Declaration
    public float2(float x, float y)
    Parameters
    Type Name Description
    System.Single x
    System.Single y

    float2(UInt32)

    Constructs a float2 vector from a single uint value by converting it to float and assigning it to every component.

    Declaration
    public float2(uint v)
    Parameters
    Type Name Description
    System.UInt32 v

    float2(bool2)

    Constructs a float2 vector from a bool2 vector by componentwise conversion.

    Declaration
    public float2(bool2 v)
    Parameters
    Type Name Description
    bool2 v

    float2(double2)

    Constructs a float2 vector from a double2 vector by componentwise conversion.

    Declaration
    public float2(double2 v)
    Parameters
    Type Name Description
    double2 v

    float2(float2)

    Constructs a float2 vector from a float2 vector.

    Declaration
    public float2(float2 xy)
    Parameters
    Type Name Description
    float2 xy

    float2(half)

    Constructs a float2 vector from a single half value by converting it to float and assigning it to every component.

    Declaration
    public float2(half v)
    Parameters
    Type Name Description
    half v

    float2(half2)

    Constructs a float2 vector from a half2 vector by componentwise conversion.

    Declaration
    public float2(half2 v)
    Parameters
    Type Name Description
    half2 v

    float2(int2)

    Constructs a float2 vector from a int2 vector by componentwise conversion.

    Declaration
    public float2(int2 v)
    Parameters
    Type Name Description
    int2 v

    float2(uint2)

    Constructs a float2 vector from a uint2 vector by componentwise conversion.

    Declaration
    public float2(uint2 v)
    Parameters
    Type Name Description
    uint2 v

    Fields

    x

    Declaration
    public float x
    Field Value
    Type Description
    System.Single

    y

    Declaration
    public float y
    Field Value
    Type Description
    System.Single

    zero

    float2 zero value.

    Declaration
    public static readonly float2 zero
    Field Value
    Type Description
    float2

    Properties

    Item[Int32]

    Returns the float element at a specified index.

    Declaration
    public float this[int index] { get; set; }
    Parameters
    Type Name Description
    System.Int32 index
    Property Value
    Type Description
    System.Single

    xx

    Declaration
    public float2 xx { get; }
    Property Value
    Type Description
    float2

    xxx

    Declaration
    public float3 xxx { get; }
    Property Value
    Type Description
    float3

    xxxx

    Declaration
    public float4 xxxx { get; }
    Property Value
    Type Description
    float4

    xxxy

    Declaration
    public float4 xxxy { get; }
    Property Value
    Type Description
    float4

    xxy

    Declaration
    public float3 xxy { get; }
    Property Value
    Type Description
    float3

    xxyx

    Declaration
    public float4 xxyx { get; }
    Property Value
    Type Description
    float4

    xxyy

    Declaration
    public float4 xxyy { get; }
    Property Value
    Type Description
    float4

    xy

    Declaration
    public float2 xy { get; set; }
    Property Value
    Type Description
    float2

    xyx

    Declaration
    public float3 xyx { get; }
    Property Value
    Type Description
    float3

    xyxx

    Declaration
    public float4 xyxx { get; }
    Property Value
    Type Description
    float4

    xyxy

    Declaration
    public float4 xyxy { get; }
    Property Value
    Type Description
    float4

    xyy

    Declaration
    public float3 xyy { get; }
    Property Value
    Type Description
    float3

    xyyx

    Declaration
    public float4 xyyx { get; }
    Property Value
    Type Description
    float4

    xyyy

    Declaration
    public float4 xyyy { get; }
    Property Value
    Type Description
    float4

    yx

    Declaration
    public float2 yx { get; set; }
    Property Value
    Type Description
    float2

    yxx

    Declaration
    public float3 yxx { get; }
    Property Value
    Type Description
    float3

    yxxx

    Declaration
    public float4 yxxx { get; }
    Property Value
    Type Description
    float4

    yxxy

    Declaration
    public float4 yxxy { get; }
    Property Value
    Type Description
    float4

    yxy

    Declaration
    public float3 yxy { get; }
    Property Value
    Type Description
    float3

    yxyx

    Declaration
    public float4 yxyx { get; }
    Property Value
    Type Description
    float4

    yxyy

    Declaration
    public float4 yxyy { get; }
    Property Value
    Type Description
    float4

    yy

    Declaration
    public float2 yy { get; }
    Property Value
    Type Description
    float2

    yyx

    Declaration
    public float3 yyx { get; }
    Property Value
    Type Description
    float3

    yyxx

    Declaration
    public float4 yyxx { get; }
    Property Value
    Type Description
    float4

    yyxy

    Declaration
    public float4 yyxy { get; }
    Property Value
    Type Description
    float4

    yyy

    Declaration
    public float3 yyy { get; }
    Property Value
    Type Description
    float3

    yyyx

    Declaration
    public float4 yyyx { get; }
    Property Value
    Type Description
    float4

    yyyy

    Declaration
    public float4 yyyy { get; }
    Property Value
    Type Description
    float4

    Methods

    Equals(Object)

    Returns true if the float2 is equal to a given float2, false otherwise.

    Declaration
    public override bool Equals(object o)
    Parameters
    Type Name Description
    System.Object o
    Returns
    Type Description
    System.Boolean
    Overrides
    System.ValueType.Equals(System.Object)

    Equals(float2)

    Returns true if the float2 is equal to a given float2, false otherwise.

    Declaration
    public bool Equals(float2 rhs)
    Parameters
    Type Name Description
    float2 rhs
    Returns
    Type Description
    System.Boolean

    GetHashCode()

    Returns a hash code for the float2.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    System.Int32
    Overrides
    System.ValueType.GetHashCode()

    ToString()

    Returns a string representation of the float2.

    Declaration
    public override string ToString()
    Returns
    Type Description
    System.String
    Overrides
    System.ValueType.ToString()

    ToString(String, IFormatProvider)

    Returns a string representation of the float2 using a specified format and culture-specific format information.

    Declaration
    public string ToString(string format, IFormatProvider formatProvider)
    Parameters
    Type Name Description
    System.String format
    System.IFormatProvider formatProvider
    Returns
    Type Description
    System.String

    Operators

    Addition(Single, float2)

    Returns the result of a componentwise addition operation on a float value and a float2 vector.

    Declaration
    public static float2 operator +(float lhs, float2 rhs)
    Parameters
    Type Name Description
    System.Single lhs
    float2 rhs
    Returns
    Type Description
    float2

    Addition(float2, Single)

    Returns the result of a componentwise addition operation on a float2 vector and a float value.

    Declaration
    public static float2 operator +(float2 lhs, float rhs)
    Parameters
    Type Name Description
    float2 lhs
    System.Single rhs
    Returns
    Type Description
    float2

    Addition(float2, float2)

    Returns the result of a componentwise addition operation on two float2 vectors.

    Declaration
    public static float2 operator +(float2 lhs, float2 rhs)
    Parameters
    Type Name Description
    float2 lhs
    float2 rhs
    Returns
    Type Description
    float2

    Decrement(float2)

    Returns the result of a componentwise decrement operation on a float2 vector.

    Declaration
    public static float2 operator --(float2 val)
    Parameters
    Type Name Description
    float2 val
    Returns
    Type Description
    float2

    Division(Single, float2)

    Returns the result of a componentwise division operation on a float value and a float2 vector.

    Declaration
    public static float2 operator /(float lhs, float2 rhs)
    Parameters
    Type Name Description
    System.Single lhs
    float2 rhs
    Returns
    Type Description
    float2

    Division(float2, Single)

    Returns the result of a componentwise division operation on a float2 vector and a float value.

    Declaration
    public static float2 operator /(float2 lhs, float rhs)
    Parameters
    Type Name Description
    float2 lhs
    System.Single rhs
    Returns
    Type Description
    float2

    Division(float2, float2)

    Returns the result of a componentwise division operation on two float2 vectors.

    Declaration
    public static float2 operator /(float2 lhs, float2 rhs)
    Parameters
    Type Name Description
    float2 lhs
    float2 rhs
    Returns
    Type Description
    float2

    Equality(Single, float2)

    Returns the result of a componentwise equality operation on a float value and a float2 vector.

    Declaration
    public static bool2 operator ==(float lhs, float2 rhs)
    Parameters
    Type Name Description
    System.Single lhs
    float2 rhs
    Returns
    Type Description
    bool2

    Equality(float2, Single)

    Returns the result of a componentwise equality operation on a float2 vector and a float value.

    Declaration
    public static bool2 operator ==(float2 lhs, float rhs)
    Parameters
    Type Name Description
    float2 lhs
    System.Single rhs
    Returns
    Type Description
    bool2

    Equality(float2, float2)

    Returns the result of a componentwise equality operation on two float2 vectors.

    Declaration
    public static bool2 operator ==(float2 lhs, float2 rhs)
    Parameters
    Type Name Description
    float2 lhs
    float2 rhs
    Returns
    Type Description
    bool2

    Explicit(Boolean to float2)

    Explicitly converts a single bool value to a float2 vector by converting it to float and assigning it to every component.

    Declaration
    public static explicit operator float2(bool v)
    Parameters
    Type Name Description
    System.Boolean v
    Returns
    Type Description
    float2

    Explicit(Double to float2)

    Explicitly converts a single double value to a float2 vector by converting it to float and assigning it to every component.

    Declaration
    public static explicit operator float2(double v)
    Parameters
    Type Name Description
    System.Double v
    Returns
    Type Description
    float2

    Explicit(bool2 to float2)

    Explicitly converts a bool2 vector to a float2 vector by componentwise conversion.

    Declaration
    public static explicit operator float2(bool2 v)
    Parameters
    Type Name Description
    bool2 v
    Returns
    Type Description
    float2

    Explicit(double2 to float2)

    Explicitly converts a double2 vector to a float2 vector by componentwise conversion.

    Declaration
    public static explicit operator float2(double2 v)
    Parameters
    Type Name Description
    double2 v
    Returns
    Type Description
    float2

    GreaterThan(Single, float2)

    Returns the result of a componentwise greater than operation on a float value and a float2 vector.

    Declaration
    public static bool2 operator>(float lhs, float2 rhs)
    Parameters
    Type Name Description
    System.Single lhs
    float2 rhs
    Returns
    Type Description
    bool2

    GreaterThan(float2, Single)

    Returns the result of a componentwise greater than operation on a float2 vector and a float value.

    Declaration
    public static bool2 operator>(float2 lhs, float rhs)
    Parameters
    Type Name Description
    float2 lhs
    System.Single rhs
    Returns
    Type Description
    bool2

    GreaterThan(float2, float2)

    Returns the result of a componentwise greater than operation on two float2 vectors.

    Declaration
    public static bool2 operator>(float2 lhs, float2 rhs)
    Parameters
    Type Name Description
    float2 lhs
    float2 rhs
    Returns
    Type Description
    bool2

    GreaterThanOrEqual(Single, float2)

    Returns the result of a componentwise greater or equal operation on a float value and a float2 vector.

    Declaration
    public static bool2 operator >=(float lhs, float2 rhs)
    Parameters
    Type Name Description
    System.Single lhs
    float2 rhs
    Returns
    Type Description
    bool2

    GreaterThanOrEqual(float2, Single)

    Returns the result of a componentwise greater or equal operation on a float2 vector and a float value.

    Declaration
    public static bool2 operator >=(float2 lhs, float rhs)
    Parameters
    Type Name Description
    float2 lhs
    System.Single rhs
    Returns
    Type Description
    bool2

    GreaterThanOrEqual(float2, float2)

    Returns the result of a componentwise greater or equal operation on two float2 vectors.

    Declaration
    public static bool2 operator >=(float2 lhs, float2 rhs)
    Parameters
    Type Name Description
    float2 lhs
    float2 rhs
    Returns
    Type Description
    bool2

    Implicit(Int32 to float2)

    Implicitly converts a single int value to a float2 vector by converting it to float and assigning it to every component.

    Declaration
    public static implicit operator float2(int v)
    Parameters
    Type Name Description
    System.Int32 v
    Returns
    Type Description
    float2

    Implicit(Single to float2)

    Implicitly converts a single float value to a float2 vector by assigning it to every component.

    Declaration
    public static implicit operator float2(float v)
    Parameters
    Type Name Description
    System.Single v
    Returns
    Type Description
    float2

    Implicit(UInt32 to float2)

    Implicitly converts a single uint value to a float2 vector by converting it to float and assigning it to every component.

    Declaration
    public static implicit operator float2(uint v)
    Parameters
    Type Name Description
    System.UInt32 v
    Returns
    Type Description
    float2

    Implicit(float2 to Vector2)

    Declaration
    public static implicit operator Vector2(float2 v)
    Parameters
    Type Name Description
    float2 v
    Returns
    Type Description
    Vector2

    Implicit(half to float2)

    Implicitly converts a single half value to a float2 vector by converting it to float and assigning it to every component.

    Declaration
    public static implicit operator float2(half v)
    Parameters
    Type Name Description
    half v
    Returns
    Type Description
    float2

    Implicit(half2 to float2)

    Implicitly converts a half2 vector to a float2 vector by componentwise conversion.

    Declaration
    public static implicit operator float2(half2 v)
    Parameters
    Type Name Description
    half2 v
    Returns
    Type Description
    float2

    Implicit(int2 to float2)

    Implicitly converts a int2 vector to a float2 vector by componentwise conversion.

    Declaration
    public static implicit operator float2(int2 v)
    Parameters
    Type Name Description
    int2 v
    Returns
    Type Description
    float2

    Implicit(uint2 to float2)

    Implicitly converts a uint2 vector to a float2 vector by componentwise conversion.

    Declaration
    public static implicit operator float2(uint2 v)
    Parameters
    Type Name Description
    uint2 v
    Returns
    Type Description
    float2

    Implicit(Vector2 to float2)

    Declaration
    public static implicit operator float2(Vector2 v)
    Parameters
    Type Name Description
    Vector2 v
    Returns
    Type Description
    float2

    Increment(float2)

    Returns the result of a componentwise increment operation on a float2 vector.

    Declaration
    public static float2 operator ++(float2 val)
    Parameters
    Type Name Description
    float2 val
    Returns
    Type Description
    float2

    Inequality(Single, float2)

    Returns the result of a componentwise not equal operation on a float value and a float2 vector.

    Declaration
    public static bool2 operator !=(float lhs, float2 rhs)
    Parameters
    Type Name Description
    System.Single lhs
    float2 rhs
    Returns
    Type Description
    bool2

    Inequality(float2, Single)

    Returns the result of a componentwise not equal operation on a float2 vector and a float value.

    Declaration
    public static bool2 operator !=(float2 lhs, float rhs)
    Parameters
    Type Name Description
    float2 lhs
    System.Single rhs
    Returns
    Type Description
    bool2

    Inequality(float2, float2)

    Returns the result of a componentwise not equal operation on two float2 vectors.

    Declaration
    public static bool2 operator !=(float2 lhs, float2 rhs)
    Parameters
    Type Name Description
    float2 lhs
    float2 rhs
    Returns
    Type Description
    bool2

    LessThan(Single, float2)

    Returns the result of a componentwise less than operation on a float value and a float2 vector.

    Declaration
    public static bool2 operator <(float lhs, float2 rhs)
    Parameters
    Type Name Description
    System.Single lhs
    float2 rhs
    Returns
    Type Description
    bool2

    LessThan(float2, Single)

    Returns the result of a componentwise less than operation on a float2 vector and a float value.

    Declaration
    public static bool2 operator <(float2 lhs, float rhs)
    Parameters
    Type Name Description
    float2 lhs
    System.Single rhs
    Returns
    Type Description
    bool2

    LessThan(float2, float2)

    Returns the result of a componentwise less than operation on two float2 vectors.

    Declaration
    public static bool2 operator <(float2 lhs, float2 rhs)
    Parameters
    Type Name Description
    float2 lhs
    float2 rhs
    Returns
    Type Description
    bool2

    LessThanOrEqual(Single, float2)

    Returns the result of a componentwise less or equal operation on a float value and a float2 vector.

    Declaration
    public static bool2 operator <=(float lhs, float2 rhs)
    Parameters
    Type Name Description
    System.Single lhs
    float2 rhs
    Returns
    Type Description
    bool2

    LessThanOrEqual(float2, Single)

    Returns the result of a componentwise less or equal operation on a float2 vector and a float value.

    Declaration
    public static bool2 operator <=(float2 lhs, float rhs)
    Parameters
    Type Name Description
    float2 lhs
    System.Single rhs
    Returns
    Type Description
    bool2

    LessThanOrEqual(float2, float2)

    Returns the result of a componentwise less or equal operation on two float2 vectors.

    Declaration
    public static bool2 operator <=(float2 lhs, float2 rhs)
    Parameters
    Type Name Description
    float2 lhs
    float2 rhs
    Returns
    Type Description
    bool2

    Modulus(Single, float2)

    Returns the result of a componentwise modulus operation on a float value and a float2 vector.

    Declaration
    public static float2 operator %(float lhs, float2 rhs)
    Parameters
    Type Name Description
    System.Single lhs
    float2 rhs
    Returns
    Type Description
    float2

    Modulus(float2, Single)

    Returns the result of a componentwise modulus operation on a float2 vector and a float value.

    Declaration
    public static float2 operator %(float2 lhs, float rhs)
    Parameters
    Type Name Description
    float2 lhs
    System.Single rhs
    Returns
    Type Description
    float2

    Modulus(float2, float2)

    Returns the result of a componentwise modulus operation on two float2 vectors.

    Declaration
    public static float2 operator %(float2 lhs, float2 rhs)
    Parameters
    Type Name Description
    float2 lhs
    float2 rhs
    Returns
    Type Description
    float2

    Multiply(Single, float2)

    Returns the result of a componentwise multiplication operation on a float value and a float2 vector.

    Declaration
    public static float2 operator *(float lhs, float2 rhs)
    Parameters
    Type Name Description
    System.Single lhs
    float2 rhs
    Returns
    Type Description
    float2

    Multiply(float2, Single)

    Returns the result of a componentwise multiplication operation on a float2 vector and a float value.

    Declaration
    public static float2 operator *(float2 lhs, float rhs)
    Parameters
    Type Name Description
    float2 lhs
    System.Single rhs
    Returns
    Type Description
    float2

    Multiply(float2, float2)

    Returns the result of a componentwise multiplication operation on two float2 vectors.

    Declaration
    public static float2 operator *(float2 lhs, float2 rhs)
    Parameters
    Type Name Description
    float2 lhs
    float2 rhs
    Returns
    Type Description
    float2

    Subtraction(Single, float2)

    Returns the result of a componentwise subtraction operation on a float value and a float2 vector.

    Declaration
    public static float2 operator -(float lhs, float2 rhs)
    Parameters
    Type Name Description
    System.Single lhs
    float2 rhs
    Returns
    Type Description
    float2

    Subtraction(float2, Single)

    Returns the result of a componentwise subtraction operation on a float2 vector and a float value.

    Declaration
    public static float2 operator -(float2 lhs, float rhs)
    Parameters
    Type Name Description
    float2 lhs
    System.Single rhs
    Returns
    Type Description
    float2

    Subtraction(float2, float2)

    Returns the result of a componentwise subtraction operation on two float2 vectors.

    Declaration
    public static float2 operator -(float2 lhs, float2 rhs)
    Parameters
    Type Name Description
    float2 lhs
    float2 rhs
    Returns
    Type Description
    float2

    UnaryNegation(float2)

    Returns the result of a componentwise unary minus operation on a float2 vector.

    Declaration
    public static float2 operator -(float2 val)
    Parameters
    Type Name Description
    float2 val
    Returns
    Type Description
    float2

    UnaryPlus(float2)

    Returns the result of a componentwise unary plus operation on a float2 vector.

    Declaration
    public static float2 operator +(float2 val)
    Parameters
    Type Name Description
    float2 val
    Returns
    Type Description
    float2
    Back to top Copyright © 2019 Unity Technologies
    Generated by DocFX