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, 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 vector.

Half y

The Y component of the vector.

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(Vector2, bool)

Initializes a new instance of the Vector2h struct.

Declaration
public Vector2h(Vector2 v, bool throwOnError)
Parameters
Type Name Description
Vector2 v

The Vector2 to convert.

bool throwOnError

Enable checks that will throw if the conversion result is not meaningful.

Vector2h(Vector2)

Initializes a new instance of the Vector2h struct.

Declaration
public Vector2h(Vector2 v)
Parameters
Type Name Description
Vector2 v

The Vector2 to convert.

Vector2h(in Vector2, bool)

Initializes a new instance of the Vector2h struct.

Declaration
public Vector2h(in Vector2 v, bool throwOnError)
Parameters
Type Name Description
Vector2 v

The Vector2 to convert.

bool throwOnError

Enable checks that will throw if the conversion result is not meaningful.

Vector2h(in Vector2)

Initializes a new instance of the Vector2h struct.

Declaration
public Vector2h(in Vector2 v)
Parameters
Type Name Description
Vector2 v

The Vector2 to convert.

Vector2h(Vector2d, bool)

Initializes a new instance of the Vector2h struct.

Declaration
public Vector2h(Vector2d v, bool throwOnError)
Parameters
Type Name Description
Vector2d v

The Vector2d to convert.

bool throwOnError

Enable checks that will throw if the conversion result is not meaningful.

Vector2h(Vector2d)

Initializes a new instance of the Vector2h struct.

Declaration
public Vector2h(Vector2d v)
Parameters
Type Name Description
Vector2d v

The Vector2d to convert.

Vector2h(in Vector2d, bool)

Initializes a new instance of the Vector2h struct.

Declaration
public Vector2h(in Vector2d v, bool throwOnError)
Parameters
Type Name Description
Vector2d v

The Vector2d to convert.

bool throwOnError

Enable checks that will throw if the conversion result is not meaningful.

Vector2h(in Vector2d)

Initializes a new instance of the Vector2h struct.

Declaration
public Vector2h(in Vector2d v)
Parameters
Type Name Description
Vector2d v

The Vector2d to convert.

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, float, bool)

Initializes a new instance of the Vector2h struct.

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

The X component of the vector.

float y

The Y component of the vector.

bool throwOnError

Enable checks that will throw if the conversion result is not meaningful.

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 vector.

float y

The Y component of the vector.

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.

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)

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

Equals(object)

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
object obj
Returns
Type Description
bool
Overrides
ValueType.Equals(object)

FromBinaryStream(BinaryReader)

Updates the X and Y components of this instance by reading from a Stream.

Declaration
public void FromBinaryStream(BinaryReader bin)
Parameters
Type Name Description
BinaryReader bin

A BinaryReader instance associated with an open Stream.

FromBytes(byte[], int)

Converts an array of bytes into Half2.

Declaration
[Pure]
public static Vector2h FromBytes(byte[] value, int startIndex)
Parameters
Type Name Description
byte[] value

A Half2 in it's byte[] representation.

int startIndex

The starting position within value.

Returns
Type Description
Vector2h

A new Half2 instance.

GetBytes(Vector2h)

Returns the Half2 as an array of bytes.

Declaration
[Pure]
public static byte[] GetBytes(Vector2h h)
Parameters
Type Name Description
Vector2h h

The Half2 to convert.

Returns
Type Description
byte[]

The input as byte array.

GetHashCode()

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

GetObjectData(SerializationInfo, StreamingContext)

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

ToBinaryStream(BinaryWriter)

Writes the X and Y components of this instance into a Stream.

Declaration
public void ToBinaryStream(BinaryWriter bin)
Parameters
Type Name Description
BinaryWriter bin

A BinaryWriter instance associated with an open Stream.

ToString()

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

ToString(IFormatProvider)

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

ToString(string, IFormatProvider)

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

ToString(string)

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

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