PositionExtensions Class
Provides extension methods of the Position class.
public static class PositionExtensions
- Inheritance
-
Position
Extensions
Methods
Opposite(Position) |
Gets the opposite vector. |
Add(Position, Position) |
Gets the sum of two vectors. |
Add(Position, (float X, float Y, float Z)) |
Gets the sum of two vectors. |
Sub(Position, Position) |
Gets the difference between two vectors. |
Sub(Position, (float X, float Y, float Z)) |
Gets the difference between two vectors. |
Mul(Position, float) |
Gets the scalar multiplication. |
Div(Position, float) |
Gets the scalar division. |
Square |
Gets the squared length. |
Length(Position) |
Gets the length. |
Cross |
Gets the cross product of two vectors. |
Cross |
Gets the cross product of two vectors. |
Normalize(Position) |
Gets the normalized vector. |
Dot |
Gets the dot product of two vectors. |
Dot |
Gets the dot product of two vectors. |
Get |
Gets the linear interpolation (Lerp) of two vectors. |
Get |
Gets the linear interpolation (Lerp) of two vectors. |
Inverse |
Gets the vector with the X component inversed. |
Inverse |
Gets the vector with the Y component inversed. |
Inverse |
Gets the vector with the Z component inversed. |
To |
Gets the new XYZ tuple representing |
Methods Detail
Opposite(Position)
Gets the opposite vector.
public static Position Opposite(this Position p)
Parameters
- p
- Position
A vector.
Returns
The opposite vector of p
.
Add(Position, Position)
Gets the sum of two vectors.
public static Position Add(this Position p, Position q)
Parameters
- p
- Position
A vector.
- q
- Position
Another vector.
Returns
The sum of p
and q
.
Add(Position, (float X, float Y, float Z))
Gets the sum of two vectors.
public static Position Add(this Position p, in (float X, float Y, float Z) q)
Parameters
- p
- Position
A vector.
Another vector.
Returns
The sum of p
and q
.
Sub(Position, Position)
Gets the difference between two vectors.
public static Position Sub(this Position p, Position q)
Parameters
- p
- Position
A vector.
- q
- Position
Another vector.
Returns
The difference between the two vectors, which represents
subtracting q
from p
.
Sub(Position, (float X, float Y, float Z))
Gets the difference between two vectors.
public static Position Sub(this Position p, in (float X, float Y, float Z) q)
Parameters
- p
- Position
A vector.
Another vector.
Returns
The difference between the two vectors, which represents
subtracting q
from p
.
Mul(Position, float)
Gets the scalar multiplication.
public static Position Mul(this Position p, float m)
Parameters
- p
- Position
A vector.
- m
- float
A scalar.
Returns
A vector multiplied by m
.
Div(Position, float)
Gets the scalar division.
public static Position Div(this Position p, float m)
Parameters
- p
- Position
A vector.
- m
- float
A scalar.
Returns
A vector divided by m
.
SquareLength(Position)
Gets the squared length.
public static float SquareLength(this Position p)
Parameters
- p
- Position
A vector.
Returns
The squared length.
Length(Position)
Gets the length.
public static float Length(this Position p)
Parameters
- p
- Position
A vector.
Returns
The length.
CrossProduct(Position, Position)
Gets the cross product of two vectors.
public static Position CrossProduct(this Position p, Position q)
Parameters
- p
- Position
A vector.
- q
- Position
Another vector.
Returns
The cross product of two vectors, which represents
p
× q
.
CrossProduct(Position, (float X, float Y, float Z))
Gets the cross product of two vectors.
public static Position CrossProduct(this Position p, in (float X, float Y, float Z) q)
Parameters
- p
- Position
A vector.
Another vector.
Returns
The cross product of two vectors, which represents
p
× q
.
Normalize(Position)
Gets the normalized vector.
public static Position Normalize(this Position p)
Parameters
- p
- Position
A vector.
Returns
A unit vector, which is the specified vector with a length of one.
DotProduct(Position, Position)
Gets the dot product of two vectors.
public static float DotProduct(this Position p, Position q)
Parameters
- p
- Position
A vector.
- q
- Position
Another vector.
Returns
The dot product of p
and q
.
DotProduct(Position, (float X, float Y, float Z))
Gets the dot product of two vectors.
public static float DotProduct(this Position p, in (float X, float Y, float Z) q)
Parameters
- p
- Position
A vector.
Another vector.
Returns
The dot product of p
and q
.
GetLerp(Position, Position, float)
Gets the linear interpolation (Lerp) of two vectors.
public static Position GetLerp(this Position p, Position q, float t)
Parameters
- p
- Position
A vector.
- q
- Position
Another vector.
- t
- float
A parameter between zero and one, inclusively.
Returns
The linear-interpolated vector. This method guarantees that the
return value equals p
when t
equals zero, and equals q
when t
equals one.
GetLerp(Position, (float X, float Y, float Z), float)
Gets the linear interpolation (Lerp) of two vectors.
public static Position GetLerp(this Position p, in (float X, float Y, float Z) q, float t)
Parameters
- p
- Position
A vector.
Another vector.
- t
- float
A parameter between zero and one, inclusively.
Returns
The linear-interpolated vector. This method guarantees that the
return value equals p
when t
equals zero, and equals q
when t
equals one.
InverseX(Position)
Gets the vector with the X component inversed.
public static Position InverseX(this Position p)
Parameters
- p
- Position
A vector.
Returns
The vector with the X component inversed.
InverseY(Position)
Gets the vector with the Y component inversed.
public static Position InverseY(this Position p)
Parameters
- p
- Position
A vector.
Returns
The vector with the Y component inversed.
InverseZ(Position)
Gets the vector with the Z component inversed.
public static Position InverseZ(this Position p)
Parameters
- p
- Position
A vector.
Returns
The vector with the Z component inversed.
ToTuple(Position)
Gets the new XYZ tuple representing this
position.
public static (float X, float Y, float Z) ToTuple(this Position p)
Parameters
- p
- Position
The position.
Returns
The new XYZ tuple.