Class VectorExtensions
Extension methods for Unity's Vector struct
Inheritance
VectorExtensions
Assembly: cs.temp.dll.dll
public static class VectorExtensions
Methods
Declaration
public static Vector2 Average(this ICollection<Vector2> vectors)
Parameters
Type |
Name |
Description |
ICollection<Vector2> |
vectors |
|
Returns
Declaration
public static Vector2 Average(this ICollection<Vector2> vectors)
Parameters
Type |
Name |
Description |
ICollection<Vector2> |
vectors |
|
Returns
Declaration
public static Vector3 Average(this ICollection<Vector3> vectors)
Parameters
Type |
Name |
Description |
ICollection<Vector3> |
vectors |
|
Returns
Declaration
public static Vector3 Average(this ICollection<Vector3> vectors)
Parameters
Type |
Name |
Description |
ICollection<Vector3> |
vectors |
|
Returns
Declaration
public static Vector2 Average(this IEnumerable<Vector2> vectors)
Parameters
Type |
Name |
Description |
IEnumerable<Vector2> |
vectors |
|
Returns
Declaration
public static Vector2 Average(this IEnumerable<Vector2> vectors)
Parameters
Type |
Name |
Description |
IEnumerable<Vector2> |
vectors |
|
Returns
Declaration
public static Vector3 Average(this IEnumerable<Vector3> vectors)
Parameters
Type |
Name |
Description |
IEnumerable<Vector3> |
vectors |
|
Returns
Declaration
public static Vector3 Average(this IEnumerable<Vector3> vectors)
Parameters
Type |
Name |
Description |
IEnumerable<Vector3> |
vectors |
|
Returns
Determines if the distance between two vectors is within a given tolerance.
Declaration
public static bool CloseEnough(Vector3 v1, Vector3 v2, float distanceTolerance)
Parameters
Type |
Name |
Description |
Vector3 |
v1 |
The first vector.
|
Vector3 |
v2 |
The second vector.
|
Single |
distanceTolerance |
The maximum distance that will cause this to return true.
|
Returns
Type |
Description |
Boolean |
True if the distance between the two vectors is within the tolerance, false otherwise.
|
Get the relative mapping based on a source Vec3 and a radius for cylinder mapping.
Declaration
public static Vector3 CylindricalMapping(Vector3 source, float radius)
Parameters
Type |
Name |
Description |
Vector3 |
source |
The source Vector3 to be mapped to cylinder
|
Single |
radius |
This is a Single for the radius of the cylinder
|
Returns
Get the relative mapping based on a source Vec3 and a radius for cylinder mapping.
Declaration
public static Vector3 CylindricalMapping(Vector3 source, float radius)
Parameters
Type |
Name |
Description |
Vector3 |
source |
The source Vector3 to be mapped to cylinder
|
Single |
radius |
This is a Single for the radius of the cylinder
|
Returns
Declaration
public static Vector2 Div(this Vector2 value, Vector2 scale)
Parameters
Type |
Name |
Description |
Vector2 |
value |
|
Vector2 |
scale |
|
Returns
Declaration
public static Vector2 Div(this Vector2 value, Vector2 scale)
Parameters
Type |
Name |
Description |
Vector2 |
value |
|
Vector2 |
scale |
|
Returns
Declaration
public static Vector3 Div(this Vector3 value, Vector3 scale)
Parameters
Type |
Name |
Description |
Vector3 |
value |
|
Vector3 |
scale |
|
Returns
Declaration
public static Vector3 Div(this Vector3 value, Vector3 scale)
Parameters
Type |
Name |
Description |
Vector3 |
value |
|
Vector3 |
scale |
|
Returns
Declaration
public static Vector3 InverseTransformPoint(this Vector3 point, Vector3 translation, Quaternion rotation, Vector3 lossyScale)
Parameters
Type |
Name |
Description |
Vector3 |
point |
|
Vector3 |
translation |
|
Quaternion |
rotation |
|
Vector3 |
lossyScale |
|
Returns
Declaration
public static Vector3 InverseTransformPoint(this Vector3 point, Vector3 translation, Quaternion rotation, Vector3 lossyScale)
Parameters
Type |
Name |
Description |
Vector3 |
point |
|
Vector3 |
translation |
|
Quaternion |
rotation |
|
Vector3 |
lossyScale |
|
Returns
Declaration
public static bool IsValidVector(this Vector3 vector)
Parameters
Type |
Name |
Description |
Vector3 |
vector |
|
Returns
Declaration
public static bool IsValidVector(this Vector3 vector)
Parameters
Type |
Name |
Description |
Vector3 |
vector |
|
Returns
Declaration
public static Vector2 Median(this ICollection<Vector2> vectors)
Parameters
Type |
Name |
Description |
ICollection<Vector2> |
vectors |
|
Returns
Declaration
public static Vector2 Median(this ICollection<Vector2> vectors)
Parameters
Type |
Name |
Description |
ICollection<Vector2> |
vectors |
|
Returns
Declaration
public static Vector3 Median(this ICollection<Vector3> vectors)
Parameters
Type |
Name |
Description |
ICollection<Vector3> |
vectors |
|
Returns
Declaration
public static Vector3 Median(this ICollection<Vector3> vectors)
Parameters
Type |
Name |
Description |
ICollection<Vector3> |
vectors |
|
Returns
Declaration
public static Vector2 Median(this IEnumerable<Vector2> vectors)
Parameters
Type |
Name |
Description |
IEnumerable<Vector2> |
vectors |
|
Returns
Declaration
public static Vector2 Median(this IEnumerable<Vector2> vectors)
Parameters
Type |
Name |
Description |
IEnumerable<Vector2> |
vectors |
|
Returns
Declaration
public static Vector3 Median(this IEnumerable<Vector3> vectors)
Parameters
Type |
Name |
Description |
IEnumerable<Vector3> |
vectors |
|
Returns
Declaration
public static Vector3 Median(this IEnumerable<Vector3> vectors)
Parameters
Type |
Name |
Description |
IEnumerable<Vector3> |
vectors |
|
Returns
Declaration
public static Vector2 Mul(this Vector2 value, Vector2 scale)
Parameters
Type |
Name |
Description |
Vector2 |
value |
|
Vector2 |
scale |
|
Returns
Declaration
public static Vector2 Mul(this Vector2 value, Vector2 scale)
Parameters
Type |
Name |
Description |
Vector2 |
value |
|
Vector2 |
scale |
|
Returns
Declaration
public static Vector3 Mul(this Vector3 value, Vector3 scale)
Parameters
Type |
Name |
Description |
Vector3 |
value |
|
Vector3 |
scale |
|
Returns
Declaration
public static Vector3 Mul(this Vector3 value, Vector3 scale)
Parameters
Type |
Name |
Description |
Vector3 |
value |
|
Vector3 |
scale |
|
Returns
Get the relative mapping based on a source Vec3 and a radius for radial mapping.
Declaration
public static Vector3 RadialMapping(Vector3 source, float radialRange, float radius, int row, int totalRows, int column, int totalColumns)
Parameters
Type |
Name |
Description |
Vector3 |
source |
The source Vector3 to be mapped to cylinder
|
Single |
radialRange |
The total range of the radial in degrees as a Single
|
Single |
radius |
This is a Single for the radius of the radial
|
Int32 |
row |
The current row as a Int32 for the radial calculation
|
Int32 |
totalRows |
The total rows as a Int32 for the radial calculation
|
Int32 |
column |
The current column as a Int32 for the radial calculation
|
Int32 |
totalColumns |
The total columns as a Int32 for the radial calculation
|
Returns
Get the relative mapping based on a source Vec3 and a radius for radial mapping.
Declaration
public static Vector3 RadialMapping(Vector3 source, float radialRange, float radius, int row, int totalRows, int column, int totalColumns)
Parameters
Type |
Name |
Description |
Vector3 |
source |
The source Vector3 to be mapped to cylinder
|
Single |
radialRange |
The total range of the radial in degrees as a Single
|
Single |
radius |
This is a Single for the radius of the radial
|
Int32 |
row |
The current row as a Int32 for the radial calculation
|
Int32 |
totalRows |
The total rows as a Int32 for the radial calculation
|
Int32 |
column |
The current column as a Int32 for the radial calculation
|
Int32 |
totalColumns |
The total columns as a Int32 for the radial calculation
|
Returns
Declaration
public static Vector3 RotateAround(this Vector3 point, Vector3 pivot, Quaternion rotation)
Parameters
Type |
Name |
Description |
Vector3 |
point |
|
Vector3 |
pivot |
|
Quaternion |
rotation |
|
Returns
Declaration
public static Vector3 RotateAround(this Vector3 point, Vector3 pivot, Quaternion rotation)
Parameters
Type |
Name |
Description |
Vector3 |
point |
|
Vector3 |
pivot |
|
Quaternion |
rotation |
|
Returns
Declaration
public static Vector3 RotateAround(this Vector3 point, Vector3 pivot, Vector3 eulerAngles)
Parameters
Type |
Name |
Description |
Vector3 |
point |
|
Vector3 |
pivot |
|
Vector3 |
eulerAngles |
|
Returns
Declaration
public static Vector3 RotateAround(this Vector3 point, Vector3 pivot, Vector3 eulerAngles)
Parameters
Type |
Name |
Description |
Vector3 |
point |
|
Vector3 |
pivot |
|
Vector3 |
eulerAngles |
|
Returns
Randomized mapping based on a source Vec3 and a radius for randomization distance.
Declaration
public static Vector3 ScatterMapping(Vector3 source, float radius)
Parameters
Type |
Name |
Description |
Vector3 |
source |
The source Vector3 to be mapped to cylinder
|
Single |
radius |
This is a Single for the radius of the cylinder
|
Returns
Randomized mapping based on a source Vec3 and a radius for randomization distance.
Declaration
public static Vector3 ScatterMapping(Vector3 source, float radius)
Parameters
Type |
Name |
Description |
Vector3 |
source |
The source Vector3 to be mapped to cylinder
|
Single |
radius |
This is a Single for the radius of the cylinder
|
Returns
Get the relative mapping based on a source Vec3 and a radius for spherical mapping.
Declaration
public static Vector3 SphericalMapping(Vector3 source, float radius)
Parameters
Type |
Name |
Description |
Vector3 |
source |
The source Vector3 to be mapped to sphere
|
Single |
radius |
This is a Single for the radius of the sphere
|
Returns
Get the relative mapping based on a source Vec3 and a radius for spherical mapping.
Declaration
public static Vector3 SphericalMapping(Vector3 source, float radius)
Parameters
Type |
Name |
Description |
Vector3 |
source |
The source Vector3 to be mapped to sphere
|
Single |
radius |
This is a Single for the radius of the sphere
|
Returns
Declaration
public static Vector3 TransformPoint(this Vector3 point, Vector3 translation, Quaternion rotation, Vector3 lossyScale)
Parameters
Type |
Name |
Description |
Vector3 |
point |
|
Vector3 |
translation |
|
Quaternion |
rotation |
|
Vector3 |
lossyScale |
|
Returns
Declaration
public static Vector3 TransformPoint(this Vector3 point, Vector3 translation, Quaternion rotation, Vector3 lossyScale)
Parameters
Type |
Name |
Description |
Vector3 |
point |
|
Vector3 |
translation |
|
Quaternion |
rotation |
|
Vector3 |
lossyScale |
|
Returns