TrueSync
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Properties | List of all members
TrueSync.TSVector Struct Reference

A vector structure. More...

Public Member Functions

 TSVector (int x, int y, int z)
 Constructor initializing a new instance of the structure More...
 
 TSVector (FP x, FP y, FP z)
 
void Scale (TSVector other)
 Multiplies each component of the vector by the same components of the provided vector. More...
 
void Set (FP x, FP y, FP z)
 Sets all vector component to specific values. More...
 
 TSVector (FP xyz)
 Constructor initializing a new instance of the structure More...
 
override string ToString ()
 Builds a string from the JVector. More...
 
override bool Equals (object obj)
 Tests if an object is equal to this vector. More...
 
void MakeZero ()
 Sets the length of the vector to zero. More...
 
bool IsZero ()
 Checks if the length of the vector is zero. More...
 
bool IsNearlyZero ()
 Checks if the length of the vector is nearly zero. More...
 
override int GetHashCode ()
 Gets the hashcode of the vector. More...
 
void Negate ()
 Inverses the direction of the vector. More...
 
void Normalize ()
 Normalizes this vector. More...
 

Static Public Member Functions

static TSVector Abs (TSVector other)
 
static TSVector Lerp (TSVector from, TSVector to, FP percent)
 
static TSVector Scale (TSVector vecA, TSVector vecB)
 Multiplies each component of the vector by the same components of the provided vector. More...
 
static bool operator== (TSVector value1, TSVector value2)
 Tests if two JVector are equal. More...
 
static bool operator!= (TSVector value1, TSVector value2)
 Tests if two JVector are not equal. More...
 
static TSVector Min (TSVector value1, TSVector value2)
 Gets a vector with the minimum x,y and z values of both vectors. More...
 
static void Min (ref TSVector value1, ref TSVector value2, out TSVector result)
 Gets a vector with the minimum x,y and z values of both vectors. More...
 
static TSVector Max (TSVector value1, TSVector value2)
 Gets a vector with the maximum x,y and z values of both vectors. More...
 
static FP Distance (TSVector v1, TSVector v2)
 
static void Max (ref TSVector value1, ref TSVector value2, out TSVector result)
 Gets a vector with the maximum x,y and z values of both vectors. More...
 
static TSVector Transform (TSVector position, TSMatrix matrix)
 Transforms a vector by the given matrix. More...
 
static void Transform (ref TSVector position, ref TSMatrix matrix, out TSVector result)
 Transforms a vector by the given matrix. More...
 
static void TransposedTransform (ref TSVector position, ref TSMatrix matrix, out TSVector result)
 Transforms a vector by the transposed of the given Matrix. More...
 
static FP Dot (TSVector vector1, TSVector vector2)
 Calculates the dot product of two vectors. More...
 
static FP Dot (ref TSVector vector1, ref TSVector vector2)
 Calculates the dot product of both vectors. More...
 
static TSVector Add (TSVector value1, TSVector value2)
 Adds two vectors. More...
 
static void Add (ref TSVector value1, ref TSVector value2, out TSVector result)
 Adds to vectors. More...
 
static TSVector Divide (TSVector value1, FP scaleFactor)
 Divides a vector by a factor. More...
 
static void Divide (ref TSVector value1, FP scaleFactor, out TSVector result)
 Divides a vector by a factor. More...
 
static TSVector Subtract (TSVector value1, TSVector value2)
 Subtracts two vectors. More...
 
static void Subtract (ref TSVector value1, ref TSVector value2, out TSVector result)
 Subtracts to vectors. More...
 
static TSVector Cross (TSVector vector1, TSVector vector2)
 The cross product of two vectors. More...
 
static void Cross (ref TSVector vector1, ref TSVector vector2, out TSVector result)
 The cross product of two vectors. More...
 
static TSVector Negate (TSVector value)
 Inverses the direction of a vector. More...
 
static void Negate (ref TSVector value, out TSVector result)
 Inverses the direction of a vector. More...
 
static TSVector Normalize (TSVector value)
 Normalizes the given vector. More...
 
static void Normalize (ref TSVector value, out TSVector result)
 Normalizes the given vector. More...
 
static void Swap (ref TSVector vector1, ref TSVector vector2)
 Swaps the components of both vectors. More...
 
static TSVector Multiply (TSVector value1, FP scaleFactor)
 Multiply a vector with a factor. More...
 
static void Multiply (ref TSVector value1, FP scaleFactor, out TSVector result)
 Multiply a vector with a factor. More...
 
static TSVector operator% (TSVector value1, TSVector value2)
 Calculates the cross product of two vectors. More...
 
static FP operator* (TSVector value1, TSVector value2)
 Calculates the dot product of two vectors. More...
 
static TSVector operator* (TSVector value1, FP value2)
 Multiplies a vector by a scale factor. More...
 
static TSVector operator* (FP value1, TSVector value2)
 Multiplies a vector by a scale factor. More...
 
static TSVector operator- (TSVector value1, TSVector value2)
 Subtracts two vectors. More...
 
static TSVector operator+ (TSVector value1, TSVector value2)
 Adds two vectors. More...
 
static TSVector operator/ (TSVector value1, FP value2)
 Divides a vector by a factor. More...
 
static FP Angle (TSVector a, TSVector b)
 

Public Attributes

FP x
 The X component of the vector. More...
 
FP y
 The Y component of the vector. More...
 
FP z
 The Z component of the vector. More...
 

Static Public Attributes

static readonly TSVector zero
 A vector with components (0,0,0); More...
 
static readonly TSVector left
 A vector with components (-1,0,0); More...
 
static readonly TSVector right
 A vector with components (1,0,0); More...
 
static readonly TSVector up
 A vector with components (0,1,0); More...
 
static readonly TSVector down
 A vector with components (0,-1,0); More...
 
static readonly TSVector back
 A vector with components (0,0,-1); More...
 
static readonly TSVector forward
 A vector with components (0,0,1); More...
 
static readonly TSVector one
 A vector with components (1,1,1); More...
 
static readonly TSVector MinValue
 A vector with components (FP.MinValue,FP.MinValue,FP.MinValue); More...
 
static readonly TSVector MaxValue
 A vector with components (FP.MaxValue,FP.MaxValue,FP.MaxValue); More...
 

Properties

FP sqrMagnitude [get]
 Gets the squared length of the vector. More...
 
FP magnitude [get]
 Gets the length of the vector. More...
 
TSVector normalized [get]
 Gets a normalized version of the vector. More...
 

Detailed Description

A vector structure.

Definition at line 29 of file TSVector.cs.

Constructor & Destructor Documentation

TrueSync.TSVector.TSVector ( int  x,
int  y,
int  z 
)

Constructor initializing a new instance of the structure

Parameters
xThe X component of the vector.
yThe Y component of the vector.
zThe Z component of the vector.

Definition at line 151 of file TSVector.cs.

TrueSync.TSVector.TSVector ( FP  xyz)

Constructor initializing a new instance of the structure

Parameters
xyzAll components of the vector are set to xyz

Definition at line 191 of file TSVector.cs.

Member Function Documentation

static TSVector TrueSync.TSVector.Add ( TSVector  value1,
TSVector  value2 
)
static

Adds two vectors.

Parameters
value1The first vector.
value2The second vector.
Returns
The sum of both vectors.

Definition at line 443 of file TSVector.cs.

static void TrueSync.TSVector.Add ( ref TSVector  value1,
ref TSVector  value2,
out TSVector  result 
)
static

Adds to vectors.

Parameters
value1The first vector.
value2The second vector.
resultThe sum of both vectors.

Definition at line 456 of file TSVector.cs.

static TSVector TrueSync.TSVector.Cross ( TSVector  vector1,
TSVector  vector2 
)
static

The cross product of two vectors.

Parameters
vector1The first vector.
vector2The second vector.
Returns
The cross product of both vectors.

Definition at line 531 of file TSVector.cs.

static void TrueSync.TSVector.Cross ( ref TSVector  vector1,
ref TSVector  vector2,
out TSVector  result 
)
static

The cross product of two vectors.

Parameters
vector1The first vector.
vector2The second vector.
resultThe cross product of both vectors.

Definition at line 544 of file TSVector.cs.

static TSVector TrueSync.TSVector.Divide ( TSVector  value1,
FP  scaleFactor 
)
static

Divides a vector by a factor.

Parameters
value1The vector to divide.
scaleFactorThe scale factor.
Returns
Returns the scaled vector.

Definition at line 474 of file TSVector.cs.

static void TrueSync.TSVector.Divide ( ref TSVector  value1,
FP  scaleFactor,
out TSVector  result 
)
static

Divides a vector by a factor.

Parameters
value1The vector to divide.
scaleFactorThe scale factor.
resultReturns the scaled vector.

Definition at line 486 of file TSVector.cs.

static FP TrueSync.TSVector.Dot ( TSVector  vector1,
TSVector  vector2 
)
static

Calculates the dot product of two vectors.

Parameters
vector1The first vector.
vector2The second vector.
Returns
Returns the dot product of both vectors.

Definition at line 418 of file TSVector.cs.

static FP TrueSync.TSVector.Dot ( ref TSVector  vector1,
ref TSVector  vector2 
)
static

Calculates the dot product of both vectors.

Parameters
vector1The first vector.
vector2The second vector.
Returns
Returns the dot product of both vectors.

Definition at line 430 of file TSVector.cs.

override bool TrueSync.TSVector.Equals ( object  obj)

Tests if an object is equal to this vector.

Parameters
objThe object to test.
Returns
Returns true if they are euqal, otherwise false.

Definition at line 218 of file TSVector.cs.

override int TrueSync.TSVector.GetHashCode ( )

Gets the hashcode of the vector.

Returns
Returns the hashcode of the vector.

Definition at line 560 of file TSVector.cs.

bool TrueSync.TSVector.IsNearlyZero ( )

Checks if the length of the vector is nearly zero.

Returns
Returns true if the vector is nearly zero, otherwise false.

Definition at line 356 of file TSVector.cs.

bool TrueSync.TSVector.IsZero ( )

Checks if the length of the vector is zero.

Returns
Returns true if the vector is zero, otherwise false.

Definition at line 347 of file TSVector.cs.

void TrueSync.TSVector.MakeZero ( )

Sets the length of the vector to zero.

Definition at line 334 of file TSVector.cs.

static TSVector TrueSync.TSVector.Max ( TSVector  value1,
TSVector  value2 
)
static

Gets a vector with the maximum x,y and z values of both vectors.

Parameters
value1The first value.
value2The second value.
Returns
A vector with the maximum x,y and z values of both vectors.

Definition at line 305 of file TSVector.cs.

static void TrueSync.TSVector.Max ( ref TSVector  value1,
ref TSVector  value2,
out TSVector  result 
)
static

Gets a vector with the maximum x,y and z values of both vectors.

Parameters
value1The first value.
value2The second value.
resultA vector with the maximum x,y and z values of both vectors.

Definition at line 322 of file TSVector.cs.

static TSVector TrueSync.TSVector.Min ( TSVector  value1,
TSVector  value2 
)
static

Gets a vector with the minimum x,y and z values of both vectors.

Parameters
value1The first value.
value2The second value.
Returns
A vector with the minimum x,y and z values of both vectors.

Definition at line 277 of file TSVector.cs.

static void TrueSync.TSVector.Min ( ref TSVector  value1,
ref TSVector  value2,
out TSVector  result 
)
static

Gets a vector with the minimum x,y and z values of both vectors.

Parameters
value1The first value.
value2The second value.
resultA vector with the minimum x,y and z values of both vectors.

Definition at line 290 of file TSVector.cs.

static TSVector TrueSync.TSVector.Multiply ( TSVector  value1,
FP  scaleFactor 
)
static

Multiply a vector with a factor.

Parameters
value1The vector to multiply.
scaleFactorThe scale factor.
Returns
Returns the multiplied vector.

Definition at line 678 of file TSVector.cs.

static void TrueSync.TSVector.Multiply ( ref TSVector  value1,
FP  scaleFactor,
out TSVector  result 
)
static

Multiply a vector with a factor.

Parameters
value1The vector to multiply.
scaleFactorThe scale factor.
resultReturns the multiplied vector.

Definition at line 691 of file TSVector.cs.

void TrueSync.TSVector.Negate ( )

Inverses the direction of the vector.

Definition at line 570 of file TSVector.cs.

static TSVector TrueSync.TSVector.Negate ( TSVector  value)
static

Inverses the direction of a vector.

Parameters
valueThe vector to inverse.
Returns
The negated vector.

Definition at line 582 of file TSVector.cs.

static void TrueSync.TSVector.Negate ( ref TSVector  value,
out TSVector  result 
)
static

Inverses the direction of a vector.

Parameters
valueThe vector to inverse.
resultThe negated vector.

Definition at line 594 of file TSVector.cs.

static TSVector TrueSync.TSVector.Normalize ( TSVector  value)
static

Normalizes the given vector.

Parameters
valueThe vector which should be normalized.
Returns
A normalized vector.

Definition at line 612 of file TSVector.cs.

void TrueSync.TSVector.Normalize ( )

Normalizes this vector.

Definition at line 622 of file TSVector.cs.

static void TrueSync.TSVector.Normalize ( ref TSVector  value,
out TSVector  result 
)
static

Normalizes the given vector.

Parameters
valueThe vector which should be normalized.
resultA normalized vector.

Definition at line 636 of file TSVector.cs.

static bool TrueSync.TSVector.operator!= ( TSVector  value1,
TSVector  value2 
)
static

Tests if two JVector are not equal.

Parameters
value1The first value.
value2The second value.
Returns
Returns false if both values are equal, otherwise true.

Definition at line 259 of file TSVector.cs.

static TSVector TrueSync.TSVector.operator% ( TSVector  value1,
TSVector  value2 
)
static

Calculates the cross product of two vectors.

Parameters
value1The first vector.
value2The second vector.
Returns
Returns the cross product of both.

Definition at line 706 of file TSVector.cs.

static FP TrueSync.TSVector.operator* ( TSVector  value1,
TSVector  value2 
)
static

Calculates the dot product of two vectors.

Parameters
value1The first vector.
value2The second vector.
Returns
Returns the dot product of both.

Definition at line 720 of file TSVector.cs.

static TSVector TrueSync.TSVector.operator* ( TSVector  value1,
FP  value2 
)
static

Multiplies a vector by a scale factor.

Parameters
value1The vector to scale.
value2The scale factor.
Returns
Returns the scaled vector.

Definition at line 733 of file TSVector.cs.

static TSVector TrueSync.TSVector.operator* ( FP  value1,
TSVector  value2 
)
static

Multiplies a vector by a scale factor.

Parameters
value2The vector to scale.
value1The scale factor.
Returns
Returns the scaled vector.

Definition at line 748 of file TSVector.cs.

static TSVector TrueSync.TSVector.operator+ ( TSVector  value1,
TSVector  value2 
)
static

Adds two vectors.

Parameters
value1The first vector.
value2The second vector.
Returns
The sum of both vectors.

Definition at line 777 of file TSVector.cs.

static TSVector TrueSync.TSVector.operator- ( TSVector  value1,
TSVector  value2 
)
static

Subtracts two vectors.

Parameters
value1The first vector.
value2The second vector.
Returns
The difference of both vectors.

Definition at line 763 of file TSVector.cs.

static TSVector TrueSync.TSVector.operator/ ( TSVector  value1,
FP  value2 
)
static

Divides a vector by a factor.

Parameters
value1The vector to divide.
scaleFactorThe scale factor.
Returns
Returns the scaled vector.

Definition at line 790 of file TSVector.cs.

static bool TrueSync.TSVector.operator== ( TSVector  value1,
TSVector  value2 
)
static

Tests if two JVector are equal.

Parameters
value1The first value.
value2The second value.
Returns
Returns true if both values are equal, otherwise false.

Definition at line 246 of file TSVector.cs.

void TrueSync.TSVector.Scale ( TSVector  other)

Multiplies each component of the vector by the same components of the provided vector.

Definition at line 168 of file TSVector.cs.

static TSVector TrueSync.TSVector.Scale ( TSVector  vecA,
TSVector  vecB 
)
static

Multiplies each component of the vector by the same components of the provided vector.

Definition at line 230 of file TSVector.cs.

void TrueSync.TSVector.Set ( FP  x,
FP  y,
FP  z 
)

Sets all vector component to specific values.

Parameters
xThe X component of the vector.
yThe Y component of the vector.
zThe Z component of the vector.

Definition at line 180 of file TSVector.cs.

static TSVector TrueSync.TSVector.Subtract ( TSVector  value1,
TSVector  value2 
)
static

Subtracts two vectors.

Parameters
value1The first vector.
value2The second vector.
Returns
The difference of both vectors.

Definition at line 499 of file TSVector.cs.

static void TrueSync.TSVector.Subtract ( ref TSVector  value1,
ref TSVector  value2,
out TSVector  result 
)
static

Subtracts to vectors.

Parameters
value1The first vector.
value2The second vector.
resultThe difference of both vectors.

Definition at line 512 of file TSVector.cs.

static void TrueSync.TSVector.Swap ( ref TSVector  vector1,
ref TSVector  vector2 
)
static

Swaps the components of both vectors.

Parameters
vector1The first vector to swap with the second.
vector2The second vector to swap with the first.

Definition at line 653 of file TSVector.cs.

override string TrueSync.TSVector.ToString ( )

Builds a string from the JVector.

Returns
A string containing all three components.

Definition at line 207 of file TSVector.cs.

static TSVector TrueSync.TSVector.Transform ( TSVector  position,
TSMatrix  matrix 
)
static

Transforms a vector by the given matrix.

Parameters
positionThe vector to transform.
matrixThe transform matrix.
Returns
The transformed vector.

Definition at line 369 of file TSVector.cs.

static void TrueSync.TSVector.Transform ( ref TSVector  position,
ref TSMatrix  matrix,
out TSVector  result 
)
static

Transforms a vector by the given matrix.

Parameters
positionThe vector to transform.
matrixThe transform matrix.
resultThe transformed vector.

Definition at line 382 of file TSVector.cs.

static void TrueSync.TSVector.TransposedTransform ( ref TSVector  position,
ref TSMatrix  matrix,
out TSVector  result 
)
static

Transforms a vector by the transposed of the given Matrix.

Parameters
positionThe vector to transform.
matrixThe transform matrix.
resultThe transformed vector.

Definition at line 399 of file TSVector.cs.

Member Data Documentation

readonly TSVector TrueSync.TSVector.back
static

A vector with components (0,0,-1);

Definition at line 67 of file TSVector.cs.

readonly TSVector TrueSync.TSVector.down
static

A vector with components (0,-1,0);

Definition at line 63 of file TSVector.cs.

readonly TSVector TrueSync.TSVector.forward
static

A vector with components (0,0,1);

Definition at line 71 of file TSVector.cs.

readonly TSVector TrueSync.TSVector.left
static

A vector with components (-1,0,0);

Definition at line 51 of file TSVector.cs.

readonly TSVector TrueSync.TSVector.MaxValue
static

A vector with components (FP.MaxValue,FP.MaxValue,FP.MaxValue);

Definition at line 85 of file TSVector.cs.

readonly TSVector TrueSync.TSVector.MinValue
static

A vector with components (FP.MinValue,FP.MinValue,FP.MinValue);

Definition at line 80 of file TSVector.cs.

readonly TSVector TrueSync.TSVector.one
static

A vector with components (1,1,1);

Definition at line 75 of file TSVector.cs.

readonly TSVector TrueSync.TSVector.right
static

A vector with components (1,0,0);

Definition at line 55 of file TSVector.cs.

readonly TSVector TrueSync.TSVector.up
static

A vector with components (0,1,0);

Definition at line 59 of file TSVector.cs.

FP TrueSync.TSVector.x

The X component of the vector.

Definition at line 37 of file TSVector.cs.

FP TrueSync.TSVector.y

The Y component of the vector.

Definition at line 39 of file TSVector.cs.

FP TrueSync.TSVector.z

The Z component of the vector.

Definition at line 41 of file TSVector.cs.

readonly TSVector TrueSync.TSVector.zero
static

A vector with components (0,0,0);

Definition at line 47 of file TSVector.cs.

Property Documentation

FP TrueSync.TSVector.magnitude
get

Gets the length of the vector.

Returns
Returns the length of the vector.

Definition at line 124 of file TSVector.cs.

TSVector TrueSync.TSVector.normalized
get

Gets a normalized version of the vector.

Returns
Returns a normalized version of the vector.

Definition at line 135 of file TSVector.cs.

FP TrueSync.TSVector.sqrMagnitude
get

Gets the squared length of the vector.

Returns
Returns the squared length of the vector.

Definition at line 114 of file TSVector.cs.


The documentation for this struct was generated from the following file: