Skip to content

VectorUtility

Namespace: SideXP.Core

public static class VectorUtility

Miscellaneous functions for working with vectors.

Methods

Barycentre(IList<Vector3>)

public static Vector3 Barycentre(IList<Vector3> points)

Computes the barycentre of the given points. Barycentre formula:

.               ->                ->
->    weightA * OA + weightN... * ON...
OG = ___________________________________
.            weightA + weightN...

Parameters

  • points: The points from which you want to compute the barycentre.

Returns

Returns the computed barycentre.

Barycentre(IList<Vector2>)

public static Vector2 Barycentre(IList<Vector2> points)

Computes the barycentre of the given points. Barycentre formula:

.               ->                ->
->    weightA * OA + weightN... * ON...
OG = ___________________________________
.            weightA + weightN...

Parameters

  • points: The points from which you want to compute the barycentre.

Returns

Returns the computed barycentre.

Barycentre(IList<(Vector3, float)>)

public static Vector3 Barycentre(IList<(Vector3, float)> weightedPoints)

Computes the barycentre of the given points. Barycentre formula:

.               ->                ->
->    weightA * OA + weightN... * ON...
OG = ___________________________________
.            weightA + weightN...

Parameters

  • weightedPoints: The points from which you want to compute the barycentre, and their associated weight. The more the weight value, the closer the barycentre to this point.

Returns

Returns the computed barycentre.

Barycentre(IList<(Vector2, float)>)

public static Vector2 Barycentre(IList<(Vector2, float)> weightedPoints)

Parameters

  • weightedPoints: The points from which you want to compute the barycentre, and their associated weight. The more the weight value, the closer the barycentre to this point.