TrueSync
|
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... | |
A vector structure.
Definition at line 29 of file TSVector.cs.
TrueSync.TSVector.TSVector | ( | int | x, |
int | y, | ||
int | z | ||
) |
Constructor initializing a new instance of the structure
x | The X component of the vector. |
y | The Y component of the vector. |
z | The 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
xyz | All components of the vector are set to xyz |
Definition at line 191 of file TSVector.cs.
Adds two vectors.
value1 | The first vector. |
value2 | The second vector. |
Definition at line 443 of file TSVector.cs.
|
static |
Adds to vectors.
value1 | The first vector. |
value2 | The second vector. |
result | The sum of both vectors. |
Definition at line 456 of file TSVector.cs.
The cross product of two vectors.
vector1 | The first vector. |
vector2 | The second vector. |
Definition at line 531 of file TSVector.cs.
|
static |
The cross product of two vectors.
vector1 | The first vector. |
vector2 | The second vector. |
result | The cross product of both vectors. |
Definition at line 544 of file TSVector.cs.
Divides a vector by a factor.
value1 | The vector to divide. |
scaleFactor | The scale factor. |
Definition at line 474 of file TSVector.cs.
|
static |
Divides a vector by a factor.
value1 | The vector to divide. |
scaleFactor | The scale factor. |
result | Returns the scaled vector. |
Definition at line 486 of file TSVector.cs.
Calculates the dot product of two vectors.
vector1 | The first vector. |
vector2 | The second vector. |
Definition at line 418 of file TSVector.cs.
Calculates the dot product of both vectors.
vector1 | The first vector. |
vector2 | The second vector. |
Definition at line 430 of file TSVector.cs.
override bool TrueSync.TSVector.Equals | ( | object | obj | ) |
Tests if an object is equal to this vector.
obj | The object to test. |
Definition at line 218 of file TSVector.cs.
override int TrueSync.TSVector.GetHashCode | ( | ) |
Gets 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.
Definition at line 356 of file TSVector.cs.
bool TrueSync.TSVector.IsZero | ( | ) |
Checks if the length of the vector is zero.
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.
Gets a vector with the maximum x,y and z values of both vectors.
value1 | The first value. |
value2 | The second value. |
Definition at line 305 of file TSVector.cs.
|
static |
Gets a vector with the maximum x,y and z values of both vectors.
value1 | The first value. |
value2 | The second value. |
result | A vector with the maximum x,y and z values of both vectors. |
Definition at line 322 of file TSVector.cs.
Gets a vector with the minimum x,y and z values of both vectors.
value1 | The first value. |
value2 | The second value. |
Definition at line 277 of file TSVector.cs.
|
static |
Gets a vector with the minimum x,y and z values of both vectors.
value1 | The first value. |
value2 | The second value. |
result | A vector with the minimum x,y and z values of both vectors. |
Definition at line 290 of file TSVector.cs.
Multiply a vector with a factor.
value1 | The vector to multiply. |
scaleFactor | The scale factor. |
Definition at line 678 of file TSVector.cs.
|
static |
Multiply a vector with a factor.
value1 | The vector to multiply. |
scaleFactor | The scale factor. |
result | Returns 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.
Inverses the direction of a vector.
value | The vector to inverse. |
Definition at line 582 of file TSVector.cs.
Inverses the direction of a vector.
value | The vector to inverse. |
result | The negated vector. |
Definition at line 594 of file TSVector.cs.
Normalizes the given vector.
value | The vector which should be normalized. |
Definition at line 612 of file TSVector.cs.
void TrueSync.TSVector.Normalize | ( | ) |
Normalizes this vector.
Definition at line 622 of file TSVector.cs.
Normalizes the given vector.
value | The vector which should be normalized. |
result | A normalized vector. |
Definition at line 636 of file TSVector.cs.
Tests if two JVector are not equal.
value1 | The first value. |
value2 | The second value. |
Definition at line 259 of file TSVector.cs.
Calculates the cross product of two vectors.
value1 | The first vector. |
value2 | The second vector. |
Definition at line 706 of file TSVector.cs.
Calculates the dot product of two vectors.
value1 | The first vector. |
value2 | The second vector. |
Definition at line 720 of file TSVector.cs.
Multiplies a vector by a scale factor.
value1 | The vector to scale. |
value2 | The scale factor. |
Definition at line 733 of file TSVector.cs.
Multiplies a vector by a scale factor.
value2 | The vector to scale. |
value1 | The scale factor. |
Definition at line 748 of file TSVector.cs.
Adds two vectors.
value1 | The first vector. |
value2 | The second vector. |
Definition at line 777 of file TSVector.cs.
Subtracts two vectors.
value1 | The first vector. |
value2 | The second vector. |
Definition at line 763 of file TSVector.cs.
Divides a vector by a factor.
value1 | The vector to divide. |
scaleFactor | The scale factor. |
Definition at line 790 of file TSVector.cs.
Tests if two JVector are equal.
value1 | The first value. |
value2 | The second value. |
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.
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.
x | The X component of the vector. |
y | The Y component of the vector. |
z | The Z component of the vector. |
Definition at line 180 of file TSVector.cs.
Subtracts two vectors.
value1 | The first vector. |
value2 | The second vector. |
Definition at line 499 of file TSVector.cs.
|
static |
Subtracts to vectors.
value1 | The first vector. |
value2 | The second vector. |
result | The difference of both vectors. |
Definition at line 512 of file TSVector.cs.
Swaps the components of both vectors.
vector1 | The first vector to swap with the second. |
vector2 | The 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.
Definition at line 207 of file TSVector.cs.
Transforms a vector by the given matrix.
position | The vector to transform. |
matrix | The transform matrix. |
Definition at line 369 of file TSVector.cs.
|
static |
Transforms a vector by the given matrix.
position | The vector to transform. |
matrix | The transform matrix. |
result | The transformed vector. |
Definition at line 382 of file TSVector.cs.
|
static |
Transforms a vector by the transposed of the given Matrix.
position | The vector to transform. |
matrix | The transform matrix. |
result | The transformed vector. |
Definition at line 399 of file TSVector.cs.
|
static |
A vector with components (0,0,-1);
Definition at line 67 of file TSVector.cs.
|
static |
A vector with components (0,-1,0);
Definition at line 63 of file TSVector.cs.
|
static |
A vector with components (0,0,1);
Definition at line 71 of file TSVector.cs.
|
static |
A vector with components (-1,0,0);
Definition at line 51 of file TSVector.cs.
|
static |
A vector with components (FP.MaxValue,FP.MaxValue,FP.MaxValue);
Definition at line 85 of file TSVector.cs.
|
static |
A vector with components (FP.MinValue,FP.MinValue,FP.MinValue);
Definition at line 80 of file TSVector.cs.
|
static |
A vector with components (1,1,1);
Definition at line 75 of file TSVector.cs.
|
static |
A vector with components (1,0,0);
Definition at line 55 of file TSVector.cs.
|
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.
|
static |
A vector with components (0,0,0);
Definition at line 47 of file TSVector.cs.
|
get |
Gets the length of the vector.
Definition at line 124 of file TSVector.cs.
|
get |
Gets a normalized version of the vector.
Definition at line 135 of file TSVector.cs.
|
get |
Gets the squared length of the vector.
Definition at line 114 of file TSVector.cs.