OpenTK.Vector4d Struct Reference

Represents a 4D vector using four double-precision floating-point numbers. More...

List of all members.

Public Member Functions

 Vector4d (double x, double y, double z, double w)
 Constructs a new Vector4d.
 Vector4d (Vector2d v)
 Constructs a new Vector4d from the given Vector2d.
 Vector4d (Vector3d v)
 Constructs a new Vector4d from the given Vector3d.
 Vector4d (Vector3 v, double w)
 Constructs a new Vector4d from the specified Vector3d and w component.
 Vector4d (Vector4d v)
 Constructs a new Vector4d from the given Vector4d.
void Add (Vector4d right)
 Add the Vector passed as parameter to this instance.
void Add (ref Vector4d right)
 Add the Vector passed as parameter to this instance.
void Sub (Vector4d right)
 Subtract the Vector passed as parameter from this instance.
void Sub (ref Vector4d right)
 Subtract the Vector passed as parameter from this instance.
void Mult (double f)
 Multiply this instance by a scalar.
void Div (double f)
 Divide this instance by a scalar.
void Normalize ()
 Scales the Vector4d to unit length.
void NormalizeFast ()
 Scales the Vector4d to approximately unit length.
void Scale (double sx, double sy, double sz, double sw)
 Scales the current Vector4d by the given amounts.
void Scale (Vector4d scale)
 Scales this instance by the given parameter.
void Scale (ref Vector4d scale)
 Scales this instance by the given parameter.
override string ToString ()
 Returns a System.String that represents the current Vector4d.
override int GetHashCode ()
 Returns the hashcode for this instance.
override bool Equals (object obj)
 Indicates whether this instance and a specified object are equal.
bool Equals (Vector4d other)
 Indicates whether the current vector is equal to another vector.

Static Public Member Functions

static Vector4d Sub (Vector4d a, Vector4d b)
 Subtract one Vector from another.
static void Sub (ref Vector4d a, ref Vector4d b, out Vector4d result)
 Subtract one Vector from another.
static Vector4d Mult (Vector4d a, double f)
 Multiply a vector and a scalar.
static void Mult (ref Vector4d a, double f, out Vector4d result)
 Multiply a vector and a scalar.
static Vector4d Div (Vector4d a, double f)
 Divide a vector by a scalar.
static void Div (ref Vector4d a, double f, out Vector4d result)
 Divide a vector by a scalar.
static Vector4d Add (Vector4d a, Vector4d b)
 Adds two vectors.
static void Add (ref Vector4d a, ref Vector4d b, out Vector4d result)
 Adds two vectors.
static Vector4d Subtract (Vector4d a, Vector4d b)
 Subtract one Vector from another.
static void Subtract (ref Vector4d a, ref Vector4d b, out Vector4d result)
 Subtract one Vector from another.
static Vector4d Multiply (Vector4d vector, double scale)
 Multiplies a vector by a scalar.
static void Multiply (ref Vector4d vector, double scale, out Vector4d result)
 Multiplies a vector by a scalar.
static Vector4d Multiply (Vector4d vector, Vector4d scale)
 Multiplies a vector by the components a vector (scale).
static void Multiply (ref Vector4d vector, ref Vector4d scale, out Vector4d result)
 Multiplies a vector by the components of a vector (scale).
static Vector4d Divide (Vector4d vector, double scale)
 Divides a vector by a scalar.
static void Divide (ref Vector4d vector, double scale, out Vector4d result)
 Divides a vector by a scalar.
static Vector4d Divide (Vector4d vector, Vector4d scale)
 Divides a vector by the components of a vector (scale).
static void Divide (ref Vector4d vector, ref Vector4d scale, out Vector4d result)
 Divide a vector by the components of a vector (scale).
static Vector4d Min (Vector4d a, Vector4d b)
 Calculate the component-wise minimum of two vectors.
static void Min (ref Vector4d a, ref Vector4d b, out Vector4d result)
 Calculate the component-wise minimum of two vectors.
static Vector4d Max (Vector4d a, Vector4d b)
 Calculate the component-wise maximum of two vectors.
static void Max (ref Vector4d a, ref Vector4d b, out Vector4d result)
 Calculate the component-wise maximum of two vectors.
static Vector4d Clamp (Vector4d vec, Vector4d min, Vector4d max)
 Clamp a vector to the given minimum and maximum vectors.
static void Clamp (ref Vector4d vec, ref Vector4d min, ref Vector4d max, out Vector4d result)
 Clamp a vector to the given minimum and maximum vectors.
static Vector4d Normalize (Vector4d vec)
 Scale a vector to unit length.
static void Normalize (ref Vector4d vec, out Vector4d result)
 Scale a vector to unit length.
static Vector4d NormalizeFast (Vector4d vec)
 Scale a vector to approximately unit length.
static void NormalizeFast (ref Vector4d vec, out Vector4d result)
 Scale a vector to approximately unit length.
static double Dot (Vector4d left, Vector4d right)
 Calculate the dot product of two vectors.
static void Dot (ref Vector4d left, ref Vector4d right, out double result)
 Calculate the dot product of two vectors.
static Vector4d Lerp (Vector4d a, Vector4d b, double blend)
 Returns a new Vector that is the linear blend of the 2 given Vectors.
static void Lerp (ref Vector4d a, ref Vector4d b, double blend, out Vector4d result)
 Returns a new Vector that is the linear blend of the 2 given Vectors.
static Vector4d BaryCentric (Vector4d a, Vector4d b, Vector4d c, double u, double v)
 Interpolate 3 Vectors using Barycentric coordinates.
static void BaryCentric (ref Vector4d a, ref Vector4d b, ref Vector4d c, double u, double v, out Vector4d result)
 Interpolate 3 Vectors using Barycentric coordinates.
static Vector4d Transform (Vector4d vec, Matrix4d mat)
 Transform a Vector by the given Matrix.
static void Transform (ref Vector4d vec, ref Matrix4d mat, out Vector4d result)
 Transform a Vector by the given Matrix.
static Vector4d Transform (Vector4d vec, Quaterniond quat)
 Transforms a vector by a quaternion rotation.
static void Transform (ref Vector4d vec, ref Quaterniond quat, out Vector4d result)
 Transforms a vector by a quaternion rotation.
static Vector4d operator+ (Vector4d left, Vector4d right)
 Adds two instances.
static Vector4d operator- (Vector4d left, Vector4d right)
 Subtracts two instances.
static Vector4d operator- (Vector4d vec)
 Negates an instance.
static Vector4d operator* (Vector4d vec, double scale)
 Multiplies an instance by a scalar.
static Vector4d operator* (double scale, Vector4d vec)
 Multiplies an instance by a scalar.
static Vector4d operator/ (Vector4d vec, double scale)
 Divides an instance by a scalar.
static bool operator== (Vector4d left, Vector4d right)
 Compares two instances for equality.
static bool operator!= (Vector4d left, Vector4d right)
 Compares two instances for inequality.
unsafe static operator double * (Vector4d v)
 Returns a pointer to the first element of the specified instance.
static operator IntPtr (Vector4d v)
 Returns a pointer to the first element of the specified instance.
static operator Vector4d (Vector4 v4)
 Converts OpenTK.Vector4 to OpenTK.Vector4d.
static operator Vector4 (Vector4d v4d)
 Converts OpenTK.Vector4d to OpenTK.Vector4.

Public Attributes

double X
 The X component of the Vector4d.
double Y
 The Y component of the Vector4d.
double Z
 The Z component of the Vector4d.
double W
 The W component of the Vector4d.

Static Public Attributes

static Vector4d UnitX = new Vector4d(1, 0, 0, 0)
 Defines a unit-length Vector4d that points towards the X-axis.
static Vector4d UnitY = new Vector4d(0, 1, 0, 0)
 Defines a unit-length Vector4d that points towards the Y-axis.
static Vector4d UnitZ = new Vector4d(0, 0, 1, 0)
 Defines a unit-length Vector4d that points towards the Z-axis.
static Vector4d UnitW = new Vector4d(0, 0, 0, 1)
 Defines a unit-length Vector4d that points towards the W-axis.
static Vector4d Zero = new Vector4d(0, 0, 0, 0)
 Defines a zero-length Vector4d.
static readonly Vector4d One = new Vector4d(1, 1, 1, 1)
 Defines an instance with all components set to 1.
static readonly int SizeInBytes = Marshal.SizeOf(new Vector4d())
 Defines the size of the Vector4d struct in bytes.

Properties

double Length [get]
 Gets the length (magnitude) of the vector.
double LengthFast [get]
 Gets an approximation of the vector length (magnitude).
double LengthSquared [get]
 Gets the square of the vector length (magnitude).
Vector2d Xy [get, set]
 Gets or sets an OpenTK.Vector2d with the X and Y components of this instance.
Vector3d Xyz [get, set]
 Gets or sets an OpenTK.Vector3d with the X, Y and Z components of this instance.

Detailed Description

Represents a 4D vector using four double-precision floating-point numbers.

Definition at line 34 of file Vector4d.cs.


Constructor & Destructor Documentation

OpenTK.Vector4d.Vector4d ( double  x,
double  y,
double  z,
double  w 
)

Constructs a new Vector4d.

Parameters:
x The x component of the Vector4d.
y The y component of the Vector4d.
z The z component of the Vector4d.
w The w component of the Vector4d.

Definition at line 104 of file Vector4d.cs.

00105         {
00106             X = x;
00107             Y = y;
00108             Z = z;
00109             W = w;
00110         }

OpenTK.Vector4d.Vector4d ( Vector2d  v  ) 

Constructs a new Vector4d from the given Vector2d.

Parameters:
v The Vector2d to copy components from.

Definition at line 116 of file Vector4d.cs.

00117         {
00118             X = v.X;
00119             Y = v.Y;
00120             Z = 0.0f;
00121             W = 0.0f;
00122         }

OpenTK.Vector4d.Vector4d ( Vector3d  v  ) 

Constructs a new Vector4d from the given Vector3d.

Parameters:
v The Vector3d to copy components from.

Definition at line 128 of file Vector4d.cs.

00129         {
00130             X = v.X;
00131             Y = v.Y;
00132             Z = v.Z;
00133             W = 0.0f;
00134         }

OpenTK.Vector4d.Vector4d ( Vector3  v,
double  w 
)

Constructs a new Vector4d from the specified Vector3d and w component.

Parameters:
v The Vector3d to copy components from.
w The w component of the new Vector4.

Definition at line 141 of file Vector4d.cs.

00142         {
00143             X = v.X;
00144             Y = v.Y;
00145             Z = v.Z;
00146             W = w;
00147         }

OpenTK.Vector4d.Vector4d ( Vector4d  v  ) 

Constructs a new Vector4d from the given Vector4d.

Parameters:
v The Vector4d to copy components from.

Definition at line 153 of file Vector4d.cs.

00154         {
00155             X = v.X;
00156             Y = v.Y;
00157             Z = v.Z;
00158             W = v.W;
00159         }


Member Function Documentation

static void OpenTK.Vector4d.Add ( ref Vector4d  a,
ref Vector4d  b,
out Vector4d  result 
) [static]

Adds two vectors.

Parameters:
a Left operand.
b Right operand.
result Result of operation.

Definition at line 520 of file Vector4d.cs.

00521         {
00522             result = new Vector4d(a.X + b.X, a.Y + b.Y, a.Z + b.Z, a.W + b.W);
00523         }

static Vector4d OpenTK.Vector4d.Add ( Vector4d  a,
Vector4d  b 
) [static]

Adds two vectors.

Parameters:
a Left operand.
b Right operand.
Returns:
Result of operation.

Definition at line 508 of file Vector4d.cs.

00509         {
00510             Add(ref a, ref b, out a);
00511             return a;
00512         }

void OpenTK.Vector4d.Add ( ref Vector4d  right  ) 

Add the Vector passed as parameter to this instance.

Parameters:
right Right operand. This parameter is only read from.

Definition at line 184 of file Vector4d.cs.

00185         {
00186             this.X += right.X;
00187             this.Y += right.Y;
00188             this.Z += right.Z;
00189             this.W += right.W;
00190         }

void OpenTK.Vector4d.Add ( Vector4d  right  ) 

Add the Vector passed as parameter to this instance.

Parameters:
right Right operand. This parameter is only read from.

Definition at line 172 of file Vector4d.cs.

00173         {
00174             this.X += right.X;
00175             this.Y += right.Y;
00176             this.Z += right.Z;
00177             this.W += right.W;
00178         }

static void OpenTK.Vector4d.BaryCentric ( ref Vector4d  a,
ref Vector4d  b,
ref Vector4d  c,
double  u,
double  v,
out Vector4d  result 
) [static]

Interpolate 3 Vectors using Barycentric coordinates.

Parameters:
a First input Vector.
b Second input Vector.
c Third input Vector.
u First Barycentric Coordinate.
v Second Barycentric Coordinate.
result Output Vector. a when u=v=0, b when u=1,v=0, c when u=0,v=1, and a linear combination of a,b,c otherwise

Definition at line 905 of file Vector4d.cs.

00906         {
00907             result = a; // copy
00908 
00909             Vector4d temp = b; // copy
00910             Subtract(ref temp, ref a, out temp);
00911             Multiply(ref temp, u, out temp);
00912             Add(ref result, ref temp, out result);
00913 
00914             temp = c; // copy
00915             Subtract(ref temp, ref a, out temp);
00916             Multiply(ref temp, v, out temp);
00917             Add(ref result, ref temp, out result);
00918         }

static Vector4d OpenTK.Vector4d.BaryCentric ( Vector4d  a,
Vector4d  b,
Vector4d  c,
double  u,
double  v 
) [static]

Interpolate 3 Vectors using Barycentric coordinates.

Parameters:
a First input Vector
b Second input Vector
c Third input Vector
u First Barycentric Coordinate
v Second Barycentric Coordinate
Returns:
a when u=v=0, b when u=1,v=0, c when u=0,v=1, and a linear combination of a,b,c otherwise

Definition at line 893 of file Vector4d.cs.

00894         {
00895             return a + u * (b - a) + v * (c - a);
00896         }

static void OpenTK.Vector4d.Clamp ( ref Vector4d  vec,
ref Vector4d  min,
ref Vector4d  max,
out Vector4d  result 
) [static]

Clamp a vector to the given minimum and maximum vectors.

Parameters:
vec Input vector
min Minimum vector
max Maximum vector
result The clamped vector

Definition at line 745 of file Vector4d.cs.

00746         {
00747             result.X = vec.X < min.X ? min.X : vec.X > max.X ? max.X : vec.X;
00748             result.Y = vec.Y < min.Y ? min.Y : vec.Y > max.Y ? max.Y : vec.Y;
00749             result.Z = vec.X < min.Z ? min.Z : vec.Z > max.Z ? max.Z : vec.Z;
00750             result.W = vec.Y < min.W ? min.W : vec.W > max.W ? max.W : vec.W;
00751         }

static Vector4d OpenTK.Vector4d.Clamp ( Vector4d  vec,
Vector4d  min,
Vector4d  max 
) [static]

Clamp a vector to the given minimum and maximum vectors.

Parameters:
vec Input vector
min Minimum vector
max Maximum vector
Returns:
The clamped vector

Definition at line 729 of file Vector4d.cs.

00730         {
00731             vec.X = vec.X < min.X ? min.X : vec.X > max.X ? max.X : vec.X;
00732             vec.Y = vec.Y < min.Y ? min.Y : vec.Y > max.Y ? max.Y : vec.Y;
00733             vec.Z = vec.X < min.Z ? min.Z : vec.Z > max.Z ? max.Z : vec.Z;
00734             vec.W = vec.Y < min.W ? min.W : vec.W > max.W ? max.W : vec.W;
00735             return vec;
00736         }

static void OpenTK.Vector4d.Div ( ref Vector4d  a,
double  f,
out Vector4d  result 
) [static]

Divide a vector by a scalar.

Parameters:
a Vector operand
f Scalar operand
result Result of the division

Definition at line 487 of file Vector4d.cs.

00488         {
00489             double mult = 1.0 / f;
00490             result.X = a.X * mult;
00491             result.Y = a.Y * mult;
00492             result.Z = a.Z * mult;
00493             result.W = a.W * mult;
00494         }

static Vector4d OpenTK.Vector4d.Div ( Vector4d  a,
double  f 
) [static]

Divide a vector by a scalar.

Parameters:
a Vector operand
f Scalar operand
Returns:
Result of the division

Definition at line 470 of file Vector4d.cs.

00471         {
00472             double mult = 1.0 / f;
00473             a.X *= mult;
00474             a.Y *= mult;
00475             a.Z *= mult;
00476             a.W *= mult;
00477             return a;
00478         }

void OpenTK.Vector4d.Div ( double  f  ) 

Divide this instance by a scalar.

Parameters:
f Scalar operand.

Definition at line 241 of file Vector4d.cs.

00242         {
00243             double mult = 1.0 / f;
00244             this.X *= mult;
00245             this.Y *= mult;
00246             this.Z *= mult;
00247             this.W *= mult;
00248         }

static void OpenTK.Vector4d.Divide ( ref Vector4d  vector,
ref Vector4d  scale,
out Vector4d  result 
) [static]

Divide a vector by the components of a vector (scale).

Parameters:
vector Left operand.
scale Right operand.
result Result of the operation.

Definition at line 647 of file Vector4d.cs.

00648         {
00649             result = new Vector4d(vector.X / scale.X, vector.Y / scale.Y, vector.Z / scale.Z, vector.W / scale.W);
00650         }

static Vector4d OpenTK.Vector4d.Divide ( Vector4d  vector,
Vector4d  scale 
) [static]

Divides a vector by the components of a vector (scale).

Parameters:
vector Left operand.
scale Right operand.
Returns:
Result of the operation.

Definition at line 635 of file Vector4d.cs.

00636         {
00637             Divide(ref vector, ref scale, out vector);
00638             return vector;
00639         }

static void OpenTK.Vector4d.Divide ( ref Vector4d  vector,
double  scale,
out Vector4d  result 
) [static]

Divides a vector by a scalar.

Parameters:
vector Left operand.
scale Right operand.
result Result of the operation.

Definition at line 624 of file Vector4d.cs.

00625         {
00626             Multiply(ref vector, 1 / scale, out result);
00627         }

static Vector4d OpenTK.Vector4d.Divide ( Vector4d  vector,
double  scale 
) [static]

Divides a vector by a scalar.

Parameters:
vector Left operand.
scale Right operand.
Returns:
Result of the operation.

Definition at line 612 of file Vector4d.cs.

00613         {
00614             Divide(ref vector, scale, out vector);
00615             return vector;
00616         }

static void OpenTK.Vector4d.Dot ( ref Vector4d  left,
ref Vector4d  right,
out double  result 
) [static]

Calculate the dot product of two vectors.

Parameters:
left First operand
right Second operand
result The dot product of the two inputs

Definition at line 840 of file Vector4d.cs.

00841         {
00842             result = left.X * right.X + left.Y * right.Y + left.Z * right.Z + left.W * right.W;
00843         }

static double OpenTK.Vector4d.Dot ( Vector4d  left,
Vector4d  right 
) [static]

Calculate the dot product of two vectors.

Parameters:
left First operand
right Second operand
Returns:
The dot product of the two inputs

Definition at line 829 of file Vector4d.cs.

00830         {
00831             return left.X * right.X + left.Y * right.Y + left.Z * right.Z + left.W * right.W;
00832         }

bool OpenTK.Vector4d.Equals ( Vector4d  other  ) 

Indicates whether the current vector is equal to another vector.

Parameters:
other A vector to compare with this vector.
Returns:
true if the current vector is equal to the vector parameter; otherwise, false.

Definition at line 1207 of file Vector4d.cs.

01208         {
01209             return
01210                 X == other.X &&
01211                 Y == other.Y &&
01212                 Z == other.Z &&
01213                 W == other.W;
01214         }

override bool OpenTK.Vector4d.Equals ( object  obj  ) 

Indicates whether this instance and a specified object are equal.

Parameters:
obj The object to compare to.
Returns:
True if the instances are equal; false otherwise.

Definition at line 1188 of file Vector4d.cs.

01189         {
01190             if (!(obj is Vector4d))
01191                 return false;
01192 
01193             return this.Equals((Vector4d)obj);
01194         }

override int OpenTK.Vector4d.GetHashCode (  ) 

Returns the hashcode for this instance.

Returns:
A System.Int32 containing the unique hashcode for this instance.

Definition at line 1174 of file Vector4d.cs.

01175         {
01176             return X.GetHashCode() ^ Y.GetHashCode() ^ Z.GetHashCode() ^ W.GetHashCode();
01177         }

static void OpenTK.Vector4d.Lerp ( ref Vector4d  a,
ref Vector4d  b,
double  blend,
out Vector4d  result 
) [static]

Returns a new Vector that is the linear blend of the 2 given Vectors.

Parameters:
a First input vector
b Second input vector
blend The blend factor. a when blend=0, b when blend=1.
result a when blend=0, b when blend=1, and a linear combination otherwise

Definition at line 872 of file Vector4d.cs.

00873         {
00874             result.X = blend * (b.X - a.X) + a.X;
00875             result.Y = blend * (b.Y - a.Y) + a.Y;
00876             result.Z = blend * (b.Z - a.Z) + a.Z;
00877             result.W = blend * (b.W - a.W) + a.W;
00878         }

static Vector4d OpenTK.Vector4d.Lerp ( Vector4d  a,
Vector4d  b,
double  blend 
) [static]

Returns a new Vector that is the linear blend of the 2 given Vectors.

Parameters:
a First input vector
b Second input vector
blend The blend factor. a when blend=0, b when blend=1.
Returns:
a when blend=0, b when blend=1, and a linear combination otherwise

Definition at line 856 of file Vector4d.cs.

00857         {
00858             a.X = blend * (b.X - a.X) + a.X;
00859             a.Y = blend * (b.Y - a.Y) + a.Y;
00860             a.Z = blend * (b.Z - a.Z) + a.Z;
00861             a.W = blend * (b.W - a.W) + a.W;
00862             return a;
00863         }

static void OpenTK.Vector4d.Max ( ref Vector4d  a,
ref Vector4d  b,
out Vector4d  result 
) [static]

Calculate the component-wise maximum of two vectors.

Parameters:
a First operand
b Second operand
result The component-wise maximum

Definition at line 710 of file Vector4d.cs.

00711         {
00712             result.X = a.X > b.X ? a.X : b.X;
00713             result.Y = a.Y > b.Y ? a.Y : b.Y;
00714             result.Z = a.Z > b.Z ? a.Z : b.Z;
00715             result.W = a.W > b.W ? a.W : b.W;
00716         }

static Vector4d OpenTK.Vector4d.Max ( Vector4d  a,
Vector4d  b 
) [static]

Calculate the component-wise maximum of two vectors.

Parameters:
a First operand
b Second operand
Returns:
The component-wise maximum

Definition at line 695 of file Vector4d.cs.

00696         {
00697             a.X = a.X > b.X ? a.X : b.X;
00698             a.Y = a.Y > b.Y ? a.Y : b.Y;
00699             a.Z = a.Z > b.Z ? a.Z : b.Z;
00700             a.W = a.W > b.W ? a.W : b.W;
00701             return a;
00702         }

static void OpenTK.Vector4d.Min ( ref Vector4d  a,
ref Vector4d  b,
out Vector4d  result 
) [static]

Calculate the component-wise minimum of two vectors.

Parameters:
a First operand
b Second operand
result The component-wise minimum

Definition at line 677 of file Vector4d.cs.

00678         {
00679             result.X = a.X < b.X ? a.X : b.X;
00680             result.Y = a.Y < b.Y ? a.Y : b.Y;
00681             result.Z = a.Z < b.Z ? a.Z : b.Z;
00682             result.W = a.W < b.W ? a.W : b.W;
00683         }

static Vector4d OpenTK.Vector4d.Min ( Vector4d  a,
Vector4d  b 
) [static]

Calculate the component-wise minimum of two vectors.

Parameters:
a First operand
b Second operand
Returns:
The component-wise minimum

Definition at line 662 of file Vector4d.cs.

00663         {
00664             a.X = a.X < b.X ? a.X : b.X;
00665             a.Y = a.Y < b.Y ? a.Y : b.Y;
00666             a.Z = a.Z < b.Z ? a.Z : b.Z;
00667             a.W = a.W < b.W ? a.W : b.W;
00668             return a;
00669         }

static void OpenTK.Vector4d.Mult ( ref Vector4d  a,
double  f,
out Vector4d  result 
) [static]

Multiply a vector and a scalar.

Parameters:
a Vector operand
f Scalar operand
result Result of the multiplication

Definition at line 451 of file Vector4d.cs.

00452         {
00453             result.X = a.X * f;
00454             result.Y = a.Y * f;
00455             result.Z = a.Z * f;
00456             result.W = a.W * f;
00457         }

static Vector4d OpenTK.Vector4d.Mult ( Vector4d  a,
double  f 
) [static]

Multiply a vector and a scalar.

Parameters:
a Vector operand
f Scalar operand
Returns:
Result of the multiplication

Definition at line 435 of file Vector4d.cs.

00436         {
00437             a.X *= f;
00438             a.Y *= f;
00439             a.Z *= f;
00440             a.W *= f;
00441             return a;
00442         }

void OpenTK.Vector4d.Mult ( double  f  ) 

Multiply this instance by a scalar.

Parameters:
f Scalar operand.

Definition at line 226 of file Vector4d.cs.

00227         {
00228             this.X *= f;
00229             this.Y *= f;
00230             this.Z *= f;
00231             this.W *= f;
00232         }

static void OpenTK.Vector4d.Multiply ( ref Vector4d  vector,
ref Vector4d  scale,
out Vector4d  result 
) [static]

Multiplies a vector by the components of a vector (scale).

Parameters:
vector Left operand.
scale Right operand.
result Result of the operation.

Definition at line 597 of file Vector4d.cs.

00598         {
00599             result = new Vector4d(vector.X * scale.X, vector.Y * scale.Y, vector.Z * scale.Z, vector.W * scale.W);
00600         }

static Vector4d OpenTK.Vector4d.Multiply ( Vector4d  vector,
Vector4d  scale 
) [static]

Multiplies a vector by the components a vector (scale).

Parameters:
vector Left operand.
scale Right operand.
Returns:
Result of the operation.

Definition at line 585 of file Vector4d.cs.

00586         {
00587             Multiply(ref vector, ref scale, out vector);
00588             return vector;
00589         }

static void OpenTK.Vector4d.Multiply ( ref Vector4d  vector,
double  scale,
out Vector4d  result 
) [static]

Multiplies a vector by a scalar.

Parameters:
vector Left operand.
scale Right operand.
result Result of the operation.

Definition at line 574 of file Vector4d.cs.

00575         {
00576             result = new Vector4d(vector.X * scale, vector.Y * scale, vector.Z * scale, vector.W * scale);
00577         }

static Vector4d OpenTK.Vector4d.Multiply ( Vector4d  vector,
double  scale 
) [static]

Multiplies a vector by a scalar.

Parameters:
vector Left operand.
scale Right operand.
Returns:
Result of the operation.

Definition at line 562 of file Vector4d.cs.

00563         {
00564             Multiply(ref vector, scale, out vector);
00565             return vector;
00566         }

static void OpenTK.Vector4d.Normalize ( ref Vector4d  vec,
out Vector4d  result 
) [static]

Scale a vector to unit length.

Parameters:
vec The input vector
result The normalized vector

Definition at line 777 of file Vector4d.cs.

00778         {
00779             double scale = 1.0 / vec.Length;
00780             result.X = vec.X * scale;
00781             result.Y = vec.Y * scale;
00782             result.Z = vec.Z * scale;
00783             result.W = vec.W * scale;
00784         }

static Vector4d OpenTK.Vector4d.Normalize ( Vector4d  vec  )  [static]

Scale a vector to unit length.

Parameters:
vec The input vector
Returns:
The normalized vector

Definition at line 762 of file Vector4d.cs.

00763         {
00764             double scale = 1.0 / vec.Length;
00765             vec.X *= scale;
00766             vec.Y *= scale;
00767             vec.Z *= scale;
00768             vec.W *= scale;
00769             return vec;
00770         }

void OpenTK.Vector4d.Normalize (  ) 

Scales the Vector4d to unit length.

Definition at line 315 of file Vector4d.cs.

00316         {
00317             double scale = 1.0 / this.Length;
00318             X *= scale;
00319             Y *= scale;
00320             Z *= scale;
00321             W *= scale;
00322         }

static void OpenTK.Vector4d.NormalizeFast ( ref Vector4d  vec,
out Vector4d  result 
) [static]

Scale a vector to approximately unit length.

Parameters:
vec The input vector
result The normalized vector

Definition at line 810 of file Vector4d.cs.

00811         {
00812             double scale = MathHelper.InverseSqrtFast(vec.X * vec.X + vec.Y * vec.Y + vec.Z * vec.Z + vec.W * vec.W);
00813             result.X = vec.X * scale;
00814             result.Y = vec.Y * scale;
00815             result.Z = vec.Z * scale;
00816             result.W = vec.W * scale;
00817         }

static Vector4d OpenTK.Vector4d.NormalizeFast ( Vector4d  vec  )  [static]

Scale a vector to approximately unit length.

Parameters:
vec The input vector
Returns:
The normalized vector

Definition at line 795 of file Vector4d.cs.

00796         {
00797             double scale = MathHelper.InverseSqrtFast(vec.X * vec.X + vec.Y * vec.Y + vec.Z * vec.Z + vec.W * vec.W);
00798             vec.X *= scale;
00799             vec.Y *= scale;
00800             vec.Z *= scale;
00801             vec.W *= scale;
00802             return vec;
00803         }

void OpenTK.Vector4d.NormalizeFast (  ) 

Scales the Vector4d to approximately unit length.

Definition at line 331 of file Vector4d.cs.

00332         {
00333             double scale = MathHelper.InverseSqrtFast(X * X + Y * Y + Z * Z + W * W);
00334             X *= scale;
00335             Y *= scale;
00336             Z *= scale;
00337             W *= scale;
00338         }

unsafe static OpenTK.Vector4d.operator double * ( Vector4d  v  )  [explicit, static]

Returns a pointer to the first element of the specified instance.

Parameters:
v The instance.
Returns:
A pointer to the first element of v.

Definition at line 1117 of file Vector4d.cs.

01118         {
01119             return &v.X;
01120         }

static OpenTK.Vector4d.operator IntPtr ( Vector4d  v  )  [explicit, static]

Returns a pointer to the first element of the specified instance.

Parameters:
v The instance.
Returns:
A pointer to the first element of v.

Definition at line 1127 of file Vector4d.cs.

01128         {
01129             unsafe
01130             {
01131                 return (IntPtr)(&v.X);
01132             }
01133         }

static OpenTK.Vector4d.operator Vector4 ( Vector4d  v4d  )  [explicit, static]

Converts OpenTK.Vector4d to OpenTK.Vector4.

Parameters:
v4d The Vector4d to convert.
Returns:
The resulting Vector4.

Definition at line 1146 of file Vector4d.cs.

01147         {
01148             return new Vector4((float)v4d.X, (float)v4d.Y, (float)v4d.Z, (float)v4d.W);
01149         }

static OpenTK.Vector4d.operator Vector4d ( Vector4  v4  )  [explicit, static]

Converts OpenTK.Vector4 to OpenTK.Vector4d.

Parameters:
v4 The Vector4 to convert.
Returns:
The resulting Vector4d.

Definition at line 1138 of file Vector4d.cs.

01139         {
01140             return new Vector4d(v4.X, v4.Y, v4.Z, v4.W);
01141         }

static bool OpenTK.Vector4d.operator!= ( Vector4d  left,
Vector4d  right 
) [static]

Compares two instances for inequality.

Parameters:
left The first instance.
right The second instance.
Returns:
True, if left does not equa lright; false otherwise.

Definition at line 1106 of file Vector4d.cs.

01107         {
01108             return !left.Equals(right);
01109         }

static Vector4d OpenTK.Vector4d.operator* ( double  scale,
Vector4d  vec 
) [static]

Multiplies an instance by a scalar.

Parameters:
scale The scalar.
vec The instance.
Returns:
The result of the calculation.

Definition at line 1064 of file Vector4d.cs.

01065         {
01066             vec.X *= scale;
01067             vec.Y *= scale;
01068             vec.Z *= scale;
01069             vec.W *= scale;
01070             return vec;
01071         }

static Vector4d OpenTK.Vector4d.operator* ( Vector4d  vec,
double  scale 
) [static]

Multiplies an instance by a scalar.

Parameters:
vec The instance.
scale The scalar.
Returns:
The result of the calculation.

Definition at line 1049 of file Vector4d.cs.

01050         {
01051             vec.X *= scale;
01052             vec.Y *= scale;
01053             vec.Z *= scale;
01054             vec.W *= scale;
01055             return vec;
01056         }

static Vector4d OpenTK.Vector4d.operator+ ( Vector4d  left,
Vector4d  right 
) [static]

Adds two instances.

Parameters:
left The first instance.
right The second instance.
Returns:
The result of the calculation.

Definition at line 1005 of file Vector4d.cs.

01006         {
01007             left.X += right.X;
01008             left.Y += right.Y;
01009             left.Z += right.Z;
01010             left.W += right.W;
01011             return left;
01012         }

static Vector4d OpenTK.Vector4d.operator- ( Vector4d  vec  )  [static]

Negates an instance.

Parameters:
vec The instance.
Returns:
The result of the calculation.

Definition at line 1034 of file Vector4d.cs.

01035         {
01036             vec.X = -vec.X;
01037             vec.Y = -vec.Y;
01038             vec.Z = -vec.Z;
01039             vec.W = -vec.W;
01040             return vec;
01041         }

static Vector4d OpenTK.Vector4d.operator- ( Vector4d  left,
Vector4d  right 
) [static]

Subtracts two instances.

Parameters:
left The first instance.
right The second instance.
Returns:
The result of the calculation.

Definition at line 1020 of file Vector4d.cs.

01021         {
01022             left.X -= right.X;
01023             left.Y -= right.Y;
01024             left.Z -= right.Z;
01025             left.W -= right.W;
01026             return left;
01027         }

static Vector4d OpenTK.Vector4d.operator/ ( Vector4d  vec,
double  scale 
) [static]

Divides an instance by a scalar.

Parameters:
vec The instance.
scale The scalar.
Returns:
The result of the calculation.

Definition at line 1079 of file Vector4d.cs.

01080         {
01081             double mult = 1 / scale;
01082             vec.X *= mult;
01083             vec.Y *= mult;
01084             vec.Z *= mult;
01085             vec.W *= mult;
01086             return vec;
01087         }

static bool OpenTK.Vector4d.operator== ( Vector4d  left,
Vector4d  right 
) [static]

Compares two instances for equality.

Parameters:
left The first instance.
right The second instance.
Returns:
True, if left equals right; false otherwise.

Definition at line 1095 of file Vector4d.cs.

01096         {
01097             return left.Equals(right);
01098         }

void OpenTK.Vector4d.Scale ( ref Vector4d  scale  ) 

Scales this instance by the given parameter.

Parameters:
scale The scaling of the individual components.

Definition at line 375 of file Vector4d.cs.

00376         {
00377             this.X *= scale.X;
00378             this.Y *= scale.Y;
00379             this.Z *= scale.Z;
00380             this.W *= scale.W;
00381         }

void OpenTK.Vector4d.Scale ( Vector4d  scale  ) 

Scales this instance by the given parameter.

Parameters:
scale The scaling of the individual components.

Definition at line 363 of file Vector4d.cs.

00364         {
00365             this.X *= scale.X;
00366             this.Y *= scale.Y;
00367             this.Z *= scale.Z;
00368             this.W *= scale.W;
00369         }

void OpenTK.Vector4d.Scale ( double  sx,
double  sy,
double  sz,
double  sw 
)

Scales the current Vector4d by the given amounts.

Parameters:
sx The scale of the X component.
sy The scale of the Y component.
sz The scale of the Z component.
sw The scale of the Z component.

Definition at line 352 of file Vector4d.cs.

00353         {
00354             this.X = X * sx;
00355             this.Y = Y * sy;
00356             this.Z = Z * sz;
00357             this.W = W * sw;
00358         }

static void OpenTK.Vector4d.Sub ( ref Vector4d  a,
ref Vector4d  b,
out Vector4d  result 
) [static]

Subtract one Vector from another.

Parameters:
a First operand
b Second operand
result Result of subtraction

Definition at line 416 of file Vector4d.cs.

00417         {
00418             result.X = a.X - b.X;
00419             result.Y = a.Y - b.Y;
00420             result.Z = a.Z - b.Z;
00421             result.W = a.W - b.W;
00422         }

static Vector4d OpenTK.Vector4d.Sub ( Vector4d  a,
Vector4d  b 
) [static]

Subtract one Vector from another.

Parameters:
a First operand
b Second operand
Returns:
Result of subtraction

Definition at line 400 of file Vector4d.cs.

00401         {
00402             a.X -= b.X;
00403             a.Y -= b.Y;
00404             a.Z -= b.Z;
00405             a.W -= b.W;
00406             return a;
00407         }

void OpenTK.Vector4d.Sub ( ref Vector4d  right  ) 

Subtract the Vector passed as parameter from this instance.

Parameters:
right Right operand. This parameter is only read from.

Definition at line 211 of file Vector4d.cs.

00212         {
00213             this.X -= right.X;
00214             this.Y -= right.Y;
00215             this.Z -= right.Z;
00216             this.W -= right.W;
00217         }

void OpenTK.Vector4d.Sub ( Vector4d  right  ) 

Subtract the Vector passed as parameter from this instance.

Parameters:
right Right operand. This parameter is only read from.

Definition at line 199 of file Vector4d.cs.

00200         {
00201             this.X -= right.X;
00202             this.Y -= right.Y;
00203             this.Z -= right.Z;
00204             this.W -= right.W;
00205         }

static void OpenTK.Vector4d.Subtract ( ref Vector4d  a,
ref Vector4d  b,
out Vector4d  result 
) [static]

Subtract one Vector from another.

Parameters:
a First operand
b Second operand
result Result of subtraction

Definition at line 547 of file Vector4d.cs.

00548         {
00549             result = new Vector4d(a.X - b.X, a.Y - b.Y, a.Z - b.Z, a.W - b.W);
00550         }

static Vector4d OpenTK.Vector4d.Subtract ( Vector4d  a,
Vector4d  b 
) [static]

Subtract one Vector from another.

Parameters:
a First operand
b Second operand
Returns:
Result of subtraction

Definition at line 535 of file Vector4d.cs.

00536         {
00537             Subtract(ref a, ref b, out a);
00538             return a;
00539         }

override string OpenTK.Vector4d.ToString (  ) 

Returns a System.String that represents the current Vector4d.

Returns:

Definition at line 1161 of file Vector4d.cs.

01162         {
01163             return String.Format("({0}, {1}, {2}, {3})", X, Y, Z, W);
01164         }

static void OpenTK.Vector4d.Transform ( ref Vector4d  vec,
ref Quaterniond  quat,
out Vector4d  result 
) [static]

Transforms a vector by a quaternion rotation.

Parameters:
vec The vector to transform.
quat The quaternion to rotate the vector by.
result The result of the operation.

Definition at line 967 of file Vector4d.cs.

00968         {
00969             Quaterniond v = new Quaterniond(vec.X, vec.Y, vec.Z, vec.W), i, t;
00970             Quaterniond.Invert(ref quat, out i);
00971             Quaterniond.Multiply(ref quat, ref v, out t);
00972             Quaterniond.Multiply(ref t, ref i, out v);
00973 
00974             result = new Vector4d(v.X, v.Y, v.Z, v.W);
00975         }

static Vector4d OpenTK.Vector4d.Transform ( Vector4d  vec,
Quaterniond  quat 
) [static]

Transforms a vector by a quaternion rotation.

Parameters:
vec The vector to transform.
quat The quaternion to rotate the vector by.
Returns:
The result of the operation.

Definition at line 954 of file Vector4d.cs.

00955         {
00956             Vector4d result;
00957             Transform(ref vec, ref quat, out result);
00958             return result;
00959         }

static void OpenTK.Vector4d.Transform ( ref Vector4d  vec,
ref Matrix4d  mat,
out Vector4d  result 
) [static]

Transform a Vector by the given Matrix.

Parameters:
vec The vector to transform
mat The desired transformation
result The transformed vector

Definition at line 939 of file Vector4d.cs.

00940         {
00941             result = new Vector4d(
00942                 vec.X * mat.Row0.X + vec.Y * mat.Row1.X + vec.Z * mat.Row2.X + vec.W * mat.Row3.X,
00943                 vec.X * mat.Row0.Y + vec.Y * mat.Row1.Y + vec.Z * mat.Row2.Y + vec.W * mat.Row3.Y,
00944                 vec.X * mat.Row0.Z + vec.Y * mat.Row1.Z + vec.Z * mat.Row2.Z + vec.W * mat.Row3.Z,
00945                 vec.X * mat.Row0.W + vec.Y * mat.Row1.W + vec.Z * mat.Row2.W + vec.W * mat.Row3.W);
00946         }

static Vector4d OpenTK.Vector4d.Transform ( Vector4d  vec,
Matrix4d  mat 
) [static]

Transform a Vector by the given Matrix.

Parameters:
vec The vector to transform
mat The desired transformation
Returns:
The transformed vector

Definition at line 928 of file Vector4d.cs.

00929         {
00930             Vector4d result;
00931             Transform(ref vec, ref mat, out result);
00932             return result;
00933         }


Member Data Documentation

readonly Vector4d OpenTK.Vector4d.One = new Vector4d(1, 1, 1, 1) [static]

Defines an instance with all components set to 1.

Definition at line 86 of file Vector4d.cs.

readonly int OpenTK.Vector4d.SizeInBytes = Marshal.SizeOf(new Vector4d()) [static]

Defines the size of the Vector4d struct in bytes.

Definition at line 91 of file Vector4d.cs.

Vector4d OpenTK.Vector4d.UnitW = new Vector4d(0, 0, 0, 1) [static]

Defines a unit-length Vector4d that points towards the W-axis.

Definition at line 76 of file Vector4d.cs.

Vector4d OpenTK.Vector4d.UnitX = new Vector4d(1, 0, 0, 0) [static]

Defines a unit-length Vector4d that points towards the X-axis.

Definition at line 61 of file Vector4d.cs.

Vector4d OpenTK.Vector4d.UnitY = new Vector4d(0, 1, 0, 0) [static]

Defines a unit-length Vector4d that points towards the Y-axis.

Definition at line 66 of file Vector4d.cs.

Vector4d OpenTK.Vector4d.UnitZ = new Vector4d(0, 0, 1, 0) [static]

Defines a unit-length Vector4d that points towards the Z-axis.

Definition at line 71 of file Vector4d.cs.

The W component of the Vector4d.

Definition at line 56 of file Vector4d.cs.

The X component of the Vector4d.

Definition at line 41 of file Vector4d.cs.

The Y component of the Vector4d.

Definition at line 46 of file Vector4d.cs.

The Z component of the Vector4d.

Definition at line 51 of file Vector4d.cs.

Vector4d OpenTK.Vector4d.Zero = new Vector4d(0, 0, 0, 0) [static]

Defines a zero-length Vector4d.

Definition at line 81 of file Vector4d.cs.


Property Documentation

double OpenTK.Vector4d.Length [get]

Gets the length (magnitude) of the vector.

LengthFast

See also:
LengthSquared

Definition at line 260 of file Vector4d.cs.

double OpenTK.Vector4d.LengthFast [get]

Gets an approximation of the vector length (magnitude).

This property uses an approximation of the square root function to calculate vector magnitude, with an upper error bound of 0.001.

Length

See also:
LengthSquared

Definition at line 281 of file Vector4d.cs.

double OpenTK.Vector4d.LengthSquared [get]

Gets the square of the vector length (magnitude).

This property avoids the costly square root operation required by the Length property. This makes it more suitable for comparisons.

Length

Definition at line 301 of file Vector4d.cs.

Vector2d OpenTK.Vector4d.Xy [get, set]

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

Definition at line 987 of file Vector4d.cs.

Vector3d OpenTK.Vector4d.Xyz [get, set]

Gets or sets an OpenTK.Vector3d with the X, Y and Z components of this instance.

Definition at line 993 of file Vector4d.cs.

 All Classes Functions Variables Enumerations Properties Events

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