Stride

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
    Show / Hide Table of Contents

    Half2 Struct

    Namespace: Stride.Core.Mathematics
    Assembly: Stride.Core.Mathematics.dll

    Represents a two dimensional mathematical vector with half-precision floats.

    [DataContract]
    public struct Half2 : IEquatable<Half2>
    Name Description
    Constructors
    Half2(Half)

    Initializes a new instance of the Half2 structure.

    Half2(Half, Half)

    Initializes a new instance of the Half2 structure.

    Half2(Half[])

    Initializes a new instance of the Half2 struct.

    Half2(Single)

    Initializes a new instance of the Half2 structure.

    Half2(Single, Single)

    Initializes a new instance of the Half2 structure.

    Fields
    One

    A Half2 with all of its components set to one.

    SizeInBytes

    The size of the Half2 type, in bytes.

    UnitX

    The X unit Half2 (1, 0).

    UnitY

    The Y unit Half2 (0, 1).

    X

    Gets or sets the X component of the vector.

    Y

    Gets or sets the Y component of the vector.

    Zero

    A Half2 with all of its components set to zero.

    Methods
    Equals(Half2)

    Returns a value that indicates whether the current instance is equal to the specified object.

    Equals(ref Half2, ref Half2)

    Determines whether the specified object instances are considered equal.

    Equals(Object)

    Returns a value that indicates whether the current instance is equal to a specified object.

    GetHashCode()

    Returns the hash code for this instance.

    Operators
    Equality(Half2, Half2)

    Tests for equality between two objects.

    Explicit(Half2 to Vector2)

    Performs an explicit conversion from Half2 to Vector2.

    Explicit(Vector2 to Half2)

    Performs an explicit conversion from Vector2 to Half2.

    Inequality(Half2, Half2)

    Tests for inequality between two objects.

    | Improve this Doc View Source

    Constructors


    Half2(Half)

    Initializes a new instance of the Half2 structure.

    public Half2(Half value)
    Parameters
    Type Name Description
    Half value

    The value to set for both the X and Y components.


    Half2(Half, Half)

    Initializes a new instance of the Half2 structure.

    public Half2(Half x, Half y)
    Parameters
    Type Name Description
    Half x

    The X component.

    Half y

    The Y component.


    Half2(Half[])

    Initializes a new instance of the Half2 struct.

    public Half2(Half[] values)
    Parameters
    Type Name Description
    Half[] values

    The values to assign to the X and Y components of the vector. This must be an array with two elements.

    Exceptions
    Type Condition
    System.ArgumentNullException

    Thrown when values is null.

    System.ArgumentOutOfRangeException

    Thrown when values contains more or less than two elements.


    Half2(Single)

    Initializes a new instance of the Half2 structure.

    public Half2(float value)
    Parameters
    Type Name Description
    System.Single value

    The value to set for both the X and Y components.


    Half2(Single, Single)

    Initializes a new instance of the Half2 structure.

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

    The X component.

    System.Single y

    The Y component.

    | Improve this Doc View Source

    Fields


    One

    A Half2 with all of its components set to one.

    public static readonly Half2 One
    Field Value
    Type Description
    Half2

    SizeInBytes

    The size of the Half2 type, in bytes.

    public static readonly int SizeInBytes
    Field Value
    Type Description
    System.Int32

    UnitX

    The X unit Half2 (1, 0).

    public static readonly Half2 UnitX
    Field Value
    Type Description
    Half2

    UnitY

    The Y unit Half2 (0, 1).

    public static readonly Half2 UnitY
    Field Value
    Type Description
    Half2

    X

    Gets or sets the X component of the vector.

    public Half X
    Field Value
    Type Description
    Half

    The X component of the vector.


    Y

    Gets or sets the Y component of the vector.

    public Half Y
    Field Value
    Type Description
    Half

    The Y component of the vector.


    Zero

    A Half2 with all of its components set to zero.

    public static readonly Half2 Zero
    Field Value
    Type Description
    Half2
    | Improve this Doc View Source

    Methods


    Equals(Half2)

    Returns a value that indicates whether the current instance is equal to the specified object.

    public bool Equals(Half2 other)
    Parameters
    Type Name Description
    Half2 other

    Object to make the comparison with.

    Returns
    Type Description
    System.Boolean

    true if the current instance is equal to the specified object; false otherwise.


    Equals(ref Half2, ref Half2)

    Determines whether the specified object instances are considered equal.

    public static bool Equals(ref Half2 value1, ref Half2 value2)
    Parameters
    Type Name Description
    Half2 value1

    The first value.

    Half2 value2

    The second value.

    Returns
    Type Description
    System.Boolean

    true if value1 is the same instance as value2 or if both are null references or if value1.Equals(value2) returns true; otherwise, false.


    Equals(Object)

    Returns a value that indicates whether the current instance is equal to a specified object.

    public override bool Equals(object obj)
    Parameters
    Type Name Description
    System.Object obj

    Object to make the comparison with.

    Returns
    Type Description
    System.Boolean

    true if the current instance is equal to the specified object; false otherwise.

    Overrides
    System.ValueType.Equals(System.Object)

    GetHashCode()

    Returns the hash code for this instance.

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

    A 32-bit signed integer hash code.

    Overrides
    System.ValueType.GetHashCode()
    | Improve this Doc View Source

    Operators


    Equality(Half2, Half2)

    Tests for equality between two objects.

    public static bool operator ==(Half2 left, Half2 right)
    Parameters
    Type Name Description
    Half2 left

    The first value to compare.

    Half2 right

    The second value to compare.

    Returns
    Type Description
    System.Boolean

    true if left has the same value as right; otherwise, false.


    Explicit(Half2 to Vector2)

    Performs an explicit conversion from Half2 to Vector2.

    public static explicit operator Vector2(Half2 value)
    Parameters
    Type Name Description
    Half2 value

    The value.

    Returns
    Type Description
    Vector2

    The result of the conversion.


    Explicit(Vector2 to Half2)

    Performs an explicit conversion from Vector2 to Half2.

    public static explicit operator Half2(Vector2 value)
    Parameters
    Type Name Description
    Vector2 value

    The value.

    Returns
    Type Description
    Half2

    The result of the conversion.


    Inequality(Half2, Half2)

    Tests for inequality between two objects.

    public static bool operator !=(Half2 left, Half2 right)
    Parameters
    Type Name Description
    Half2 left

    The first value to compare.

    Half2 right

    The second value to compare.

    Returns
    Type Description
    System.Boolean

    true if left has a different value than right; otherwise, false.


    Inherited Members

    System.ValueType.ToString()

    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    • Improve this Doc
    • View Source
    In This Article

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation