OpenTK.Vector2h Struct Reference

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

List of all members.

Public Member Functions

 Vector2h (Half x, Half y)
 The new Half2 instance will avoid conversion and copy directly from the Half parameters.
 Vector2h (Single x, Single y)
 The new Half2 instance will convert the 2 parameters into 16-bit half-precision floating-point.
 Vector2h (Single x, Single y, bool throwOnError)
 The new Half2 instance will convert the 2 parameters into 16-bit half-precision floating-point.
 Vector2h (Vector2 v)
 The new Half2 instance will convert the Vector2 into 16-bit half-precision floating-point.
 Vector2h (Vector2 v, bool throwOnError)
 The new Half2 instance will convert the Vector2 into 16-bit half-precision floating-point.
 Vector2h (ref Vector2 v)
 The new Half2 instance will convert the Vector2 into 16-bit half-precision floating-point. This is the fastest constructor.
 Vector2h (ref Vector2 v, bool throwOnError)
 The new Half2 instance will convert the Vector2 into 16-bit half-precision floating-point.
 Vector2h (Vector2d v)
 The new Half2 instance will convert the Vector2d into 16-bit half-precision floating-point.
 Vector2h (Vector2d v, bool throwOnError)
 The new Half2 instance will convert the Vector2d into 16-bit half-precision floating-point.
 Vector2h (ref Vector2d v)
 The new Half2 instance will convert the Vector2d into 16-bit half-precision floating-point. This is the faster constructor.
 Vector2h (ref Vector2d v, bool throwOnError)
 The new Half2 instance will convert the Vector2d into 16-bit half-precision floating-point.
Vector2 ToVector2 ()
 Returns this Half2 instance's contents as Vector2.
Vector2d ToVector2d ()
 Returns this Half2 instance's contents as Vector2d.
 Vector2h (SerializationInfo info, StreamingContext context)
 Constructor used by ISerializable to deserialize the object.
void GetObjectData (SerializationInfo info, StreamingContext context)
 Used by ISerialize to serialize the object.
void FromBinaryStream (BinaryReader bin)
 Updates the X and Y components of this instance by reading from a Stream.
void ToBinaryStream (BinaryWriter bin)
 Writes the X and Y components of this instance into a Stream.
bool Equals (Vector2h other)
 Returns a value indicating whether this instance is equal to a specified OpenTK.Half2 vector.
override string ToString ()
 Returns a string that contains this Half2's numbers in human-legible form.

Static Public Member Functions

static operator Vector2h (Vector2 v)
 Converts OpenTK.Vector2 to OpenTK.Half2.
static operator Vector2h (Vector2d v)
 Converts OpenTK.Vector2d to OpenTK.Half2.
static operator Vector2 (Vector2h h)
 Converts OpenTK.Half2 to OpenTK.Vector2.
static operator Vector2d (Vector2h h)
 Converts OpenTK.Half2 to OpenTK.Vector2d.
static byte[] GetBytes (Vector2h h)
 Returns the Half2 as an array of bytes.
static Vector2h FromBytes (byte[] value, int startIndex)
 Converts an array of bytes into Half2.

Public Attributes

Half X
 The X component of the Half2.
Half Y
 The Y component of the Half2.

Static Public Attributes

static readonly int SizeInBytes = 4
 The size in bytes for an instance of the Half2 struct is 4.

Detailed Description

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

Definition at line 35 of file Vector2h.cs.


Constructor & Destructor Documentation

OpenTK.Vector2h.Vector2h ( Half  x,
Half  y 
)

The new Half2 instance will avoid conversion and copy directly from the Half parameters.

Parameters:
x An Half instance of a 16-bit half-precision floating-point number.
y An Half instance of a 16-bit half-precision floating-point number.

Definition at line 54 of file Vector2h.cs.

00055         {
00056             X = x;
00057             Y = y;
00058         }

OpenTK.Vector2h.Vector2h ( Single  x,
Single  y 
)

The new Half2 instance will convert the 2 parameters into 16-bit half-precision floating-point.

Parameters:
x 32-bit single-precision floating-point number.
y 32-bit single-precision floating-point number.

Definition at line 65 of file Vector2h.cs.

00066         {
00067             X = new Half(x);
00068             Y = new Half(y);
00069         }

OpenTK.Vector2h.Vector2h ( Single  x,
Single  y,
bool  throwOnError 
)

The new Half2 instance will convert the 2 parameters into 16-bit half-precision floating-point.

Parameters:
x 32-bit single-precision floating-point number.
y 32-bit single-precision floating-point number.
throwOnError Enable checks that will throw if the conversion result is not meaningful.

Definition at line 77 of file Vector2h.cs.

00078         {
00079             X = new Half(x, throwOnError);
00080             Y = new Half(y, throwOnError);
00081         }

OpenTK.Vector2h.Vector2h ( Vector2  v  ) 

The new Half2 instance will convert the Vector2 into 16-bit half-precision floating-point.

Parameters:
v OpenTK.Vector2

Definition at line 88 of file Vector2h.cs.

00089         {
00090             X = new Half(v.X);
00091             Y = new Half(v.Y);
00092         }

OpenTK.Vector2h.Vector2h ( Vector2  v,
bool  throwOnError 
)

The new Half2 instance will convert the Vector2 into 16-bit half-precision floating-point.

Parameters:
v OpenTK.Vector2
throwOnError Enable checks that will throw if the conversion result is not meaningful.

Definition at line 100 of file Vector2h.cs.

00101         {
00102             X = new Half(v.X, throwOnError);
00103             Y = new Half(v.Y, throwOnError);
00104         }

OpenTK.Vector2h.Vector2h ( ref Vector2  v  ) 

The new Half2 instance will convert the Vector2 into 16-bit half-precision floating-point. This is the fastest constructor.

Parameters:
v OpenTK.Vector2

Definition at line 111 of file Vector2h.cs.

00112         {
00113             X = new Half(v.X);
00114             Y = new Half(v.Y);
00115         }

OpenTK.Vector2h.Vector2h ( ref Vector2  v,
bool  throwOnError 
)

The new Half2 instance will convert the Vector2 into 16-bit half-precision floating-point.

Parameters:
v OpenTK.Vector2
throwOnError Enable checks that will throw if the conversion result is not meaningful.

Definition at line 122 of file Vector2h.cs.

00123         {
00124             X = new Half(v.X, throwOnError);
00125             Y = new Half(v.Y, throwOnError);
00126         }

OpenTK.Vector2h.Vector2h ( Vector2d  v  ) 

The new Half2 instance will convert the Vector2d into 16-bit half-precision floating-point.

Parameters:
v OpenTK.Vector2d

Definition at line 132 of file Vector2h.cs.

00133         {
00134             X = new Half(v.X);
00135             Y = new Half(v.Y);
00136         }

OpenTK.Vector2h.Vector2h ( Vector2d  v,
bool  throwOnError 
)

The new Half2 instance will convert the Vector2d into 16-bit half-precision floating-point.

Parameters:
v OpenTK.Vector2d
throwOnError Enable checks that will throw if the conversion result is not meaningful.

Definition at line 143 of file Vector2h.cs.

00144         {
00145             X = new Half(v.X, throwOnError);
00146             Y = new Half(v.Y, throwOnError);
00147         }

OpenTK.Vector2h.Vector2h ( ref Vector2d  v  ) 

The new Half2 instance will convert the Vector2d into 16-bit half-precision floating-point. This is the faster constructor.

Parameters:
v OpenTK.Vector2d

Definition at line 155 of file Vector2h.cs.

00156         {
00157             X = new Half(v.X);
00158             Y = new Half(v.Y);
00159         }

OpenTK.Vector2h.Vector2h ( ref Vector2d  v,
bool  throwOnError 
)

The new Half2 instance will convert the Vector2d into 16-bit half-precision floating-point.

Parameters:
v OpenTK.Vector2d
throwOnError Enable checks that will throw if the conversion result is not meaningful.

Definition at line 167 of file Vector2h.cs.

00168         {
00169             X = new Half(v.X, throwOnError);
00170             Y = new Half(v.Y, throwOnError);
00171         }

OpenTK.Vector2h.Vector2h ( SerializationInfo  info,
StreamingContext  context 
)

Constructor used by ISerializable to deserialize the object.

Parameters:
info 
context 

Definition at line 244 of file Vector2h.cs.

00245         {
00246             this.X = (Half)info.GetValue("X", typeof(Half));
00247             this.Y = (Half)info.GetValue("Y", typeof(Half));
00248         }


Member Function Documentation

bool OpenTK.Vector2h.Equals ( Vector2h  other  ) 

Returns a value indicating whether this instance is equal to a specified OpenTK.Half2 vector.

Parameters:
other OpenTK.Half2 to compare to this instance..
Returns:
True, if other is equal to this instance; false otherwise.

Definition at line 286 of file Vector2h.cs.

00287         {
00288             return (this.X.Equals(other.X) && this.Y.Equals(other.Y));
00289         }

void OpenTK.Vector2h.FromBinaryStream ( BinaryReader  bin  ) 

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

Parameters:
bin A BinaryReader instance associated with an open Stream.

Definition at line 265 of file Vector2h.cs.

00266         {
00267             X.FromBinaryStream(bin);
00268             Y.FromBinaryStream(bin);
00269         }

static Vector2h OpenTK.Vector2h.FromBytes ( byte[]  value,
int  startIndex 
) [static]

Converts an array of bytes into Half2.

Parameters:
value A Half2 in it's byte[] representation.
startIndex The starting position within value.
Returns:
A new Half2 instance.

Definition at line 326 of file Vector2h.cs.

00327         {
00328             Vector2h h2 = new Vector2h();
00329             h2.X = Half.FromBytes(value, startIndex);
00330             h2.Y = Half.FromBytes(value, startIndex + 2);
00331             return h2;
00332         }

static byte [] OpenTK.Vector2h.GetBytes ( Vector2h  h  )  [static]

Returns the Half2 as an array of bytes.

Parameters:
h The Half2 to convert.
Returns:
The input as byte array.

Definition at line 308 of file Vector2h.cs.

00309         {
00310             byte[] result = new byte[SizeInBytes];
00311 
00312             byte[] temp = Half.GetBytes(h.X);
00313             result[0] = temp[0];
00314             result[1] = temp[1];
00315             temp = Half.GetBytes(h.Y);
00316             result[2] = temp[0];
00317             result[3] = temp[1];
00318 
00319             return result;
00320         }

void OpenTK.Vector2h.GetObjectData ( SerializationInfo  info,
StreamingContext  context 
)

Used by ISerialize to serialize the object.

Parameters:
info 
context 

Definition at line 253 of file Vector2h.cs.

00254         {
00255             info.AddValue("X", this.X);
00256             info.AddValue("Y", this.Y);
00257         }

static OpenTK.Vector2h.operator Vector2 ( Vector2h  h  )  [explicit, static]

Converts OpenTK.Half2 to OpenTK.Vector2.

Parameters:
h The Half2 to convert.
Returns:
The resulting Vector2.

Definition at line 217 of file Vector2h.cs.

00218         {
00219             return new Vector2(h.X, h.Y);
00220         }

static OpenTK.Vector2h.operator Vector2d ( Vector2h  h  )  [explicit, static]

Converts OpenTK.Half2 to OpenTK.Vector2d.

Parameters:
h The Half2 to convert.
Returns:
The resulting Vector2d.

Definition at line 225 of file Vector2h.cs.

00226         {
00227             return new Vector2d(h.X, h.Y);
00228         }

static OpenTK.Vector2h.operator Vector2h ( Vector2d  v  )  [explicit, static]

Converts OpenTK.Vector2d to OpenTK.Half2.

Parameters:
v The Vector2d to convert.
Returns:
The resulting Half vector.

Definition at line 209 of file Vector2h.cs.

00210         {
00211             return new Vector2h(v);
00212         }

static OpenTK.Vector2h.operator Vector2h ( Vector2  v  )  [explicit, static]

Converts OpenTK.Vector2 to OpenTK.Half2.

Parameters:
v The Vector2 to convert.
Returns:
The resulting Half vector.

Definition at line 201 of file Vector2h.cs.

00202         {
00203             return new Vector2h(v);
00204         }

void OpenTK.Vector2h.ToBinaryStream ( BinaryWriter  bin  ) 

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

Parameters:
bin A BinaryWriter instance associated with an open Stream.

Definition at line 273 of file Vector2h.cs.

00274         {
00275             X.ToBinaryStream(bin);
00276             Y.ToBinaryStream(bin);
00277         }

override string OpenTK.Vector2h.ToString (  ) 

Returns a string that contains this Half2's numbers in human-legible form.

Definition at line 296 of file Vector2h.cs.

00297         {
00298             return String.Format("({0}, {1})", X.ToString(), Y.ToString());
00299         }

Vector2 OpenTK.Vector2h.ToVector2 (  ) 

Returns this Half2 instance's contents as Vector2.

Returns:
OpenTK.Vector2

Definition at line 181 of file Vector2h.cs.

00182         {
00183             return new Vector2(X, Y);
00184         }

Vector2d OpenTK.Vector2h.ToVector2d (  ) 

Returns this Half2 instance's contents as Vector2d.

Definition at line 189 of file Vector2h.cs.

00190         {
00191             return new Vector2d(X, Y);
00192         }


Member Data Documentation

readonly int OpenTK.Vector2h.SizeInBytes = 4 [static]

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

Definition at line 235 of file Vector2h.cs.

The X component of the Half2.

Definition at line 40 of file Vector2h.cs.

The Y component of the Half2.

Definition at line 43 of file Vector2h.cs.

 All Classes Functions Variables Enumerations Properties Events

Generated on Tue Mar 9 14:59:16 2010 for The Open Toolkit library by  doxygen 1.6.1