Show / Hide Table of Contents

Struct Vector2h

2-component Vector of the Half type. Occupies 4 Byte total.

Implements
ISerializable
IEquatable<Vector2h>
IFormattable
Inherited Members
object.Equals(object, object)
object.GetType()
object.ReferenceEquals(object, object)
Namespace: OpenTK.Mathematics
Assembly: OpenTK.Mathematics.dll
Syntax
[Serializable]
public struct Vector2h : ISerializable, IEquatable<Vector2h>, IFormattable

Constructors

Vector2h(Half)

Initializes a new instance of the Vector2h struct.

Declaration
public Vector2h(Half value)
Parameters
Type Name Description
Half value

The value that will initialize this instance.

Vector2h(Half, Half)

Initializes a new instance of the Vector2h struct.

Declaration
public Vector2h(Half x, Half y)
Parameters
Type Name Description
Half x

The x component of the Vector2h.

Half y

The y component of the Vector2h.

Vector2h(SerializationInfo, StreamingContext)

Initializes a new instance of the Vector2h struct.

Declaration
public Vector2h(SerializationInfo info, StreamingContext context)
Parameters
Type Name Description
SerializationInfo info

The serialization info.

StreamingContext context

The streaming context.

Vector2h(float)

Initializes a new instance of the Vector2h struct.

Declaration
public Vector2h(float value)
Parameters
Type Name Description
float value

The value that will initialize this instance.

Vector2h(float, float)

Initializes a new instance of the Vector2h struct.

Declaration
public Vector2h(float x, float y)
Parameters
Type Name Description
float x

The x component of the Vector2h.

float y

The y component of the Vector2h.

Fields

SizeInBytes

The size in bytes for an instance of the Half2 struct is 4.

Declaration
public static readonly int SizeInBytes
Field Value
Type Description
int

X

The X component of the Half2.

Declaration
public Half X
Field Value
Type Description
Half

Y

The Y component of the Half2.

Declaration
public Half Y
Field Value
Type Description
Half

Properties

Yx

Gets or sets an OpenTK.Vector2h with the Y and X components of this instance.

Declaration
public Vector2h Yx { readonly get; set; }
Property Value
Type Description
Vector2h

Methods

Deconstruct(out Half, out Half)

Deconstructs the vector into it's individual components.

Declaration
[Pure]
public readonly void Deconstruct(out Half x, out Half y)
Parameters
Type Name Description
Half x

The X component of the vector.

Half y

The Y component of the vector.

Equals(Vector2h)

Indicates whether the current object is equal to another object of the same type.

Declaration
public bool Equals(Vector2h other)
Parameters
Type Name Description
Vector2h other

An object to compare with this object.

Returns
Type Description
bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object)

Indicates whether this instance and a specified object are equal.

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
object obj

The object to compare with the current instance.

Returns
Type Description
bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

Overrides
ValueType.Equals(object)

GetHashCode()

Returns the hash code for this instance.

Declaration
public override readonly int GetHashCode()
Returns
Type Description
int

A 32-bit signed integer that is the hash code for this instance.

Overrides
ValueType.GetHashCode()

GetObjectData(SerializationInfo, StreamingContext)

Populates a SerializationInfo with the data needed to serialize the target object.

Declaration
public readonly void GetObjectData(SerializationInfo info, StreamingContext context)
Parameters
Type Name Description
SerializationInfo info

The SerializationInfo to populate with data.

StreamingContext context

The destination (see StreamingContext) for this serialization.

Exceptions
Type Condition
SecurityException

The caller does not have the required permission.

ToString()

Returns the fully qualified type name of this instance.

Declaration
public override string ToString()
Returns
Type Description
string

The fully qualified type name.

Overrides
ValueType.ToString()

ToString(IFormatProvider)

Formats the value of the current instance using the specified format.

Declaration
public string ToString(IFormatProvider formatProvider)
Parameters
Type Name Description
IFormatProvider formatProvider

The provider to use to format the value.

-or-

A null reference (Nothing in Visual Basic) to obtain the numeric format information from the current locale setting of the operating system.

Returns
Type Description
string

The value of the current instance in the specified format.

ToString(string)

Formats the value of the current instance using the specified format.

Declaration
public string ToString(string format)
Parameters
Type Name Description
string format

The format to use.

-or-

A null reference (Nothing in Visual Basic) to use the default format defined for the type of the IFormattable implementation.

Returns
Type Description
string

The value of the current instance in the specified format.

ToString(string, IFormatProvider)

Formats the value of the current instance using the specified format.

Declaration
public string ToString(string format, IFormatProvider formatProvider)
Parameters
Type Name Description
string format

The format to use.

-or-

A null reference (Nothing in Visual Basic) to use the default format defined for the type of the IFormattable implementation.

IFormatProvider formatProvider

The provider to use to format the value.

-or-

A null reference (Nothing in Visual Basic) to obtain the numeric format information from the current locale setting of the operating system.

Returns
Type Description
string

The value of the current instance in the specified format.

ToVector2()

Returns this Half2 instance's contents as Vector2.

Declaration
public readonly Vector2 ToVector2()
Returns
Type Description
Vector2

The vector.

ToVector2d()

Returns this Half2 instance's contents as Vector2d.

Declaration
public readonly Vector2d ToVector2d()
Returns
Type Description
Vector2d

The vector.

Operators

operator ==(Vector2h, Vector2h)

Compares the specified instances for equality.

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

Left operand.

Vector2h right

Right operand.

Returns
Type Description
bool

True if both instances are equal; false otherwise.

explicit operator Vector2i(Vector2h)

Converts OpenTK.Vector2h to OpenTK.Vector2i.

Declaration
[Pure]
public static explicit operator Vector2i(Vector2h vec)
Parameters
Type Name Description
Vector2h vec

The Vector2h to convert.

Returns
Type Description
Vector2i

The resulting Vector2i.

implicit operator Vector2(Vector2h)

Converts OpenTK.Vector2h to OpenTK.Vector2.

Declaration
[Pure]
public static implicit operator Vector2(Vector2h vec)
Parameters
Type Name Description
Vector2h vec

The Vector2h to convert.

Returns
Type Description
Vector2

The resulting Vector2.

implicit operator Vector2d(Vector2h)

Converts OpenTK.Vector2h to OpenTK.Vector2d.

Declaration
[Pure]
public static implicit operator Vector2d(Vector2h vec)
Parameters
Type Name Description
Vector2h vec

The Vector2h to convert.

Returns
Type Description
Vector2d

The resulting Vector2d.

implicit operator Vector2h((Half X, Half Y))

Initializes a new instance of the Vector2h struct using a tuple containing the component values.

Declaration
[Pure]
public static implicit operator Vector2h((Half X, Half Y) values)
Parameters
Type Name Description
(Half X, Half Y) values

A tuple containing the component values.

Returns
Type Description
Vector2h

A new instance of the Vector2h struct with the given component values.

operator !=(Vector2h, Vector2h)

Compares the specified instances for inequality.

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

Left operand.

Vector2h right

Right operand.

Returns
Type Description
bool

True if both instances are not equal; false otherwise.

Implements

ISerializable
IEquatable<T>
IFormattable
In this article
Back to top Generated by DocFX