PositionExtensions Class

Provides extension methods of the Position class.

C#
public static class PositionExtensions
Inheritance
PositionExtensions

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.

SquareLength(Position)

Gets the squared length.

Length(Position)

Gets the length.

CrossProduct(Position, Position)

Gets the cross product of two vectors.

CrossProduct(Position, (float X, float Y, float Z))

Gets the cross product of two vectors.

Normalize(Position)

Gets the normalized vector.

DotProduct(Position, Position)

Gets the dot product of two vectors.

DotProduct(Position, (float X, float Y, float Z))

Gets the dot product of two vectors.

GetLerp(Position, Position, float)

Gets the linear interpolation (Lerp) of two vectors.

GetLerp(Position, (float X, float Y, float Z), float)

Gets the linear interpolation (Lerp) of two vectors.

InverseX(Position)

Gets the vector with the X component inversed.

InverseY(Position)

Gets the vector with the Y component inversed.

InverseZ(Position)

Gets the vector with the Z component inversed.

ToTuple(Position)

Gets the new XYZ tuple representing this position.

Methods Detail

Opposite(Position)

Gets the opposite vector.

C#
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.

C#
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.

C#
public static Position Add(this Position p, in (float X, float Y, float Z) q)

Parameters

p
Position

A vector.

q
(float X, float Y, float Z)

Another vector.

Returns

The sum of p and q.

Sub(Position, Position)

Gets the difference between two vectors.

C#
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.

C#
public static Position Sub(this Position p, in (float X, float Y, float Z) q)

Parameters

p
Position

A vector.

q
(float X, float Y, float Z)

Another vector.

Returns

The difference between the two vectors, which represents subtracting q from p.

Mul(Position, float)

Gets the scalar multiplication.

C#
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.

C#
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.

C#
public static float SquareLength(this Position p)

Parameters

p
Position

A vector.

Returns

The squared length.

Length(Position)

Gets the length.

C#
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.

C#
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.

C#
public static Position CrossProduct(this Position p, in (float X, float Y, float Z) q)

Parameters

p
Position

A vector.

q
(float X, float Y, float Z)

Another vector.

Returns

The cross product of two vectors, which represents p × q.

Normalize(Position)

Gets the normalized vector.

C#
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.

C#
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.

C#
public static float DotProduct(this Position p, in (float X, float Y, float Z) q)

Parameters

p
Position

A vector.

q
(float X, float Y, float Z)

Another vector.

Returns

The dot product of p and q.

GetLerp(Position, Position, float)

Gets the linear interpolation (Lerp) of two vectors.

C#
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.

C#
public static Position GetLerp(this Position p, in (float X, float Y, float Z) q, float t)

Parameters

p
Position

A vector.

q
(float X, float Y, float Z)

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.

C#
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.

C#
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.

C#
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.

C#
public static (float X, float Y, float Z) ToTuple(this Position p)

Parameters

p
Position

The position.

Returns

The new XYZ tuple.