Use in over ref modifier in Math functions input parameters
This commit is contained in:
@@ -291,7 +291,7 @@ namespace FlaxEngine
|
||||
/// <param name="left">The first vector to add.</param>
|
||||
/// <param name="right">The second vector to add.</param>
|
||||
/// <param name="result">When the method completes, contains the sum of the two vectors.</param>
|
||||
public static void Add(ref Double2 left, ref Double2 right, out Double2 result)
|
||||
public static void Add(in Double2 left, in Double2 right, out Double2 result)
|
||||
{
|
||||
result = new Double2(left.X + right.X, left.Y + right.Y);
|
||||
}
|
||||
@@ -313,7 +313,7 @@ namespace FlaxEngine
|
||||
/// <param name="left">The input vector</param>
|
||||
/// <param name="right">The scalar value to be added to elements</param>
|
||||
/// <param name="result">The vector with added scalar for each element.</param>
|
||||
public static void Add(ref Double2 left, ref double right, out Double2 result)
|
||||
public static void Add(in Double2 left, double right, out Double2 result)
|
||||
{
|
||||
result = new Double2(left.X + right, left.Y + right);
|
||||
}
|
||||
@@ -335,7 +335,7 @@ namespace FlaxEngine
|
||||
/// <param name="left">The first vector to subtract.</param>
|
||||
/// <param name="right">The second vector to subtract.</param>
|
||||
/// <param name="result">When the method completes, contains the difference of the two vectors.</param>
|
||||
public static void Subtract(ref Double2 left, ref Double2 right, out Double2 result)
|
||||
public static void Subtract(in Double2 left, in Double2 right, out Double2 result)
|
||||
{
|
||||
result = new Double2(left.X - right.X, left.Y - right.Y);
|
||||
}
|
||||
@@ -357,7 +357,7 @@ namespace FlaxEngine
|
||||
/// <param name="left">The input vector</param>
|
||||
/// <param name="right">The scalar value to be subtracted from elements</param>
|
||||
/// <param name="result">The vector with subtracted scalar for each element.</param>
|
||||
public static void Subtract(ref Double2 left, ref double right, out Double2 result)
|
||||
public static void Subtract(in Double2 left, double right, out Double2 result)
|
||||
{
|
||||
result = new Double2(left.X - right, left.Y - right);
|
||||
}
|
||||
@@ -379,7 +379,7 @@ namespace FlaxEngine
|
||||
/// <param name="left">The scalar value to be subtracted from elements</param>
|
||||
/// <param name="right">The input vector</param>
|
||||
/// <param name="result">The vector with subtracted scalar for each element.</param>
|
||||
public static void Subtract(ref double left, ref Double2 right, out Double2 result)
|
||||
public static void Subtract(double left, in Double2 right, out Double2 result)
|
||||
{
|
||||
result = new Double2(left - right.X, left - right.Y);
|
||||
}
|
||||
@@ -401,7 +401,7 @@ namespace FlaxEngine
|
||||
/// <param name="value">The vector to scale.</param>
|
||||
/// <param name="scale">The amount by which to scale the vector.</param>
|
||||
/// <param name="result">When the method completes, contains the scaled vector.</param>
|
||||
public static void Multiply(ref Double2 value, double scale, out Double2 result)
|
||||
public static void Multiply(in Double2 value, double scale, out Double2 result)
|
||||
{
|
||||
result = new Double2(value.X * scale, value.Y * scale);
|
||||
}
|
||||
@@ -423,7 +423,7 @@ namespace FlaxEngine
|
||||
/// <param name="left">The first vector to multiply.</param>
|
||||
/// <param name="right">The second vector to multiply.</param>
|
||||
/// <param name="result">When the method completes, contains the multiplied vector.</param>
|
||||
public static void Multiply(ref Double2 left, ref Double2 right, out Double2 result)
|
||||
public static void Multiply(in Double2 left, in Double2 right, out Double2 result)
|
||||
{
|
||||
result = new Double2(left.X * right.X, left.Y * right.Y);
|
||||
}
|
||||
@@ -445,7 +445,7 @@ namespace FlaxEngine
|
||||
/// <param name="value">The vector to scale.</param>
|
||||
/// <param name="scale">The amount by which to scale the vector.</param>
|
||||
/// <param name="result">When the method completes, contains the scaled vector.</param>
|
||||
public static void Divide(ref Double2 value, double scale, out Double2 result)
|
||||
public static void Divide(in Double2 value, double scale, out Double2 result)
|
||||
{
|
||||
result = new Double2(value.X / scale, value.Y / scale);
|
||||
}
|
||||
@@ -467,7 +467,7 @@ namespace FlaxEngine
|
||||
/// <param name="scale">The amount by which to scale the vector.</param>
|
||||
/// <param name="value">The vector to scale.</param>
|
||||
/// <param name="result">When the method completes, contains the scaled vector.</param>
|
||||
public static void Divide(double scale, ref Double2 value, out Double2 result)
|
||||
public static void Divide(double scale, in Double2 value, out Double2 result)
|
||||
{
|
||||
result = new Double2(scale / value.X, scale / value.Y);
|
||||
}
|
||||
@@ -488,7 +488,7 @@ namespace FlaxEngine
|
||||
/// </summary>
|
||||
/// <param name="value">The vector to negate.</param>
|
||||
/// <param name="result">When the method completes, contains a vector facing in the opposite direction.</param>
|
||||
public static void Negate(ref Double2 value, out Double2 result)
|
||||
public static void Negate(in Double2 value, out Double2 result)
|
||||
{
|
||||
result = new Double2(-value.X, -value.Y);
|
||||
}
|
||||
@@ -513,7 +513,7 @@ namespace FlaxEngine
|
||||
/// <param name="amount1">Barycentric coordinate b2, which expresses the weighting factor toward vertex 2 (specified in <paramref name="value2" />).</param>
|
||||
/// <param name="amount2">Barycentric coordinate b3, which expresses the weighting factor toward vertex 3 (specified in <paramref name="value3" />).</param>
|
||||
/// <param name="result">When the method completes, contains the 2D Cartesian coordinates of the specified point.</param>
|
||||
public static void Barycentric(ref Double2 value1, ref Double2 value2, ref Double2 value3, double amount1, double amount2, out Double2 result)
|
||||
public static void Barycentric(in Double2 value1, in Double2 value2, in Double2 value3, double amount1, double amount2, out Double2 result)
|
||||
{
|
||||
result = new Double2(value1.X + amount1 * (value2.X - value1.X) + amount2 * (value3.X - value1.X),
|
||||
value1.Y + amount1 * (value2.Y - value1.Y) + amount2 * (value3.Y - value1.Y));
|
||||
@@ -531,7 +531,7 @@ namespace FlaxEngine
|
||||
/// <returns>A new <see cref="Double2" /> containing the 2D Cartesian coordinates of the specified point.</returns>
|
||||
public static Double2 Barycentric(Double2 value1, Double2 value2, Double2 value3, double amount1, double amount2)
|
||||
{
|
||||
Barycentric(ref value1, ref value2, ref value3, amount1, amount2, out Double2 result);
|
||||
Barycentric(in value1, in value2, in value3, amount1, amount2, out Double2 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -542,7 +542,7 @@ namespace FlaxEngine
|
||||
/// <param name="min">The minimum value.</param>
|
||||
/// <param name="max">The maximum value.</param>
|
||||
/// <param name="result">When the method completes, contains the clamped value.</param>
|
||||
public static void Clamp(ref Double2 value, ref Double2 min, ref Double2 max, out Double2 result)
|
||||
public static void Clamp(in Double2 value, in Double2 min, in Double2 max, out Double2 result)
|
||||
{
|
||||
double x = value.X;
|
||||
x = x > max.X ? max.X : x;
|
||||
@@ -562,7 +562,7 @@ namespace FlaxEngine
|
||||
/// <returns>The clamped value.</returns>
|
||||
public static Double2 Clamp(Double2 value, Double2 min, Double2 max)
|
||||
{
|
||||
Clamp(ref value, ref min, ref max, out Double2 result);
|
||||
Clamp(in value, in min, in max, out Double2 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -582,7 +582,7 @@ namespace FlaxEngine
|
||||
/// <param name="v1">The second triangle vertex.</param>
|
||||
/// <param name="v2">The third triangle vertex.</param>
|
||||
/// <returns>The triangle area.</returns>
|
||||
public static double TriangleArea(ref Double2 v0, ref Double2 v1, ref Double2 v2)
|
||||
public static double TriangleArea(in Double2 v0, in Double2 v1, in Double2 v2)
|
||||
{
|
||||
return Math.Abs((v0.X * (v1.Y - v2.Y) + v1.X * (v2.Y - v0.Y) + v2.X * (v0.Y - v1.Y)) / 2);
|
||||
}
|
||||
@@ -593,8 +593,8 @@ namespace FlaxEngine
|
||||
/// <param name="value1">The first vector.</param>
|
||||
/// <param name="value2">The second vector.</param>
|
||||
/// <param name="result">When the method completes, contains the distance between the two vectors.</param>
|
||||
/// <remarks><see cref="Double2.DistanceSquared(ref Double2, ref Double2, out double)" /> may be preferred when only the relative distance is needed and speed is of the essence.</remarks>
|
||||
public static void Distance(ref Double2 value1, ref Double2 value2, out double result)
|
||||
/// <remarks><see cref="Double2.DistanceSquared(in Double2, in Double2, out double)" /> may be preferred when only the relative distance is needed and speed is of the essence.</remarks>
|
||||
public static void Distance(in Double2 value1, in Double2 value2, out double result)
|
||||
{
|
||||
double x = value1.X - value2.X;
|
||||
double y = value1.Y - value2.Y;
|
||||
@@ -621,8 +621,8 @@ namespace FlaxEngine
|
||||
/// <param name="value1">The first vector.</param>
|
||||
/// <param name="value2">The second vector.</param>
|
||||
/// <returns>The distance between the two vectors.</returns>
|
||||
/// <remarks><see cref="Double2.DistanceSquared(ref Double2, ref Double2, out double)" /> may be preferred when only the relative distance is needed and speed is of the essence.</remarks>
|
||||
public static double Distance(ref Double2 value1, ref Double2 value2)
|
||||
/// <remarks><see cref="Double2.DistanceSquared(in Double2, in Double2, out double)" /> may be preferred when only the relative distance is needed and speed is of the essence.</remarks>
|
||||
public static double Distance(in Double2 value1, in Double2 value2)
|
||||
{
|
||||
double x = value1.X - value2.X;
|
||||
double y = value1.Y - value2.Y;
|
||||
@@ -635,7 +635,7 @@ namespace FlaxEngine
|
||||
/// <param name="value1">The first vector.</param>
|
||||
/// <param name="value2">The second vector</param>
|
||||
/// <param name="result">When the method completes, contains the squared distance between the two vectors.</param>
|
||||
public static void DistanceSquared(ref Double2 value1, ref Double2 value2, out double result)
|
||||
public static void DistanceSquared(in Double2 value1, in Double2 value2, out double result)
|
||||
{
|
||||
double x = value1.X - value2.X;
|
||||
double y = value1.Y - value2.Y;
|
||||
@@ -648,7 +648,7 @@ namespace FlaxEngine
|
||||
/// <param name="value1">The first vector.</param>
|
||||
/// <param name="value2">The second vector</param>
|
||||
/// <returns>The squared distance between the two vectors.</returns>
|
||||
public static double DistanceSquared(ref Double2 value1, ref Double2 value2)
|
||||
public static double DistanceSquared(in Double2 value1, in Double2 value2)
|
||||
{
|
||||
double x = value1.X - value2.X;
|
||||
double y = value1.Y - value2.Y;
|
||||
@@ -677,7 +677,7 @@ namespace FlaxEngine
|
||||
/// <returns><c>true</c> if left and right are near, <c>false</c> otherwise</returns>
|
||||
public static bool NearEqual(Double2 left, Double2 right, double epsilon = Mathd.Epsilon)
|
||||
{
|
||||
return NearEqual(ref left, ref right, epsilon);
|
||||
return NearEqual(in left, in right, epsilon);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -687,7 +687,7 @@ namespace FlaxEngine
|
||||
/// <param name="right">The right vector.</param>
|
||||
/// <param name="epsilon">The epsilon.</param>
|
||||
/// <returns><c>true</c> if left and right are near another, <c>false</c> otherwise</returns>
|
||||
public static bool NearEqual(ref Double2 left, ref Double2 right, double epsilon = Mathd.Epsilon)
|
||||
public static bool NearEqual(in Double2 left, in Double2 right, double epsilon = Mathd.Epsilon)
|
||||
{
|
||||
return Mathd.WithinEpsilon(left.X, right.X, epsilon) && Mathd.WithinEpsilon(left.Y, right.Y, epsilon);
|
||||
}
|
||||
@@ -698,7 +698,7 @@ namespace FlaxEngine
|
||||
/// <param name="left">First source vector.</param>
|
||||
/// <param name="right">Second source vector.</param>
|
||||
/// <param name="result">When the method completes, contains the dot product of the two vectors.</param>
|
||||
public static void Dot(ref Double2 left, ref Double2 right, out double result)
|
||||
public static void Dot(in Double2 left, in Double2 right, out double result)
|
||||
{
|
||||
result = left.X * right.X + left.Y * right.Y;
|
||||
}
|
||||
@@ -709,7 +709,7 @@ namespace FlaxEngine
|
||||
/// <param name="left">First source vector.</param>
|
||||
/// <param name="right">Second source vector.</param>
|
||||
/// <returns>The dot product of the two vectors.</returns>
|
||||
public static double Dot(ref Double2 left, ref Double2 right)
|
||||
public static double Dot(in Double2 left, in Double2 right)
|
||||
{
|
||||
return left.X * right.X + left.Y * right.Y;
|
||||
}
|
||||
@@ -731,7 +731,7 @@ namespace FlaxEngine
|
||||
/// <param name="left">First source vector.</param>
|
||||
/// <param name="right">Second source vector.</param>
|
||||
/// <param name="result">When the method completes, contains the cross product of the two vectors.</param>
|
||||
public static void Cross(ref Double2 left, ref Double2 right, out double result)
|
||||
public static void Cross(in Double2 left, in Double2 right, out double result)
|
||||
{
|
||||
result = left.X * right.Y - left.Y * right.X;
|
||||
}
|
||||
@@ -742,7 +742,7 @@ namespace FlaxEngine
|
||||
/// <param name="left">First source vector.</param>
|
||||
/// <param name="right">Second source vector.</param>
|
||||
/// <returns>The cross product of the two vectors.</returns>
|
||||
public static double Cross(ref Double2 left, ref Double2 right)
|
||||
public static double Cross(in Double2 left, in Double2 right)
|
||||
{
|
||||
return left.X * right.Y - left.Y * right.X;
|
||||
}
|
||||
@@ -763,7 +763,7 @@ namespace FlaxEngine
|
||||
/// </summary>
|
||||
/// <param name="value">The vector to normalize.</param>
|
||||
/// <param name="result">When the method completes, contains the normalized vector.</param>
|
||||
public static void Normalize(ref Double2 value, out Double2 result)
|
||||
public static void Normalize(in Double2 value, out Double2 result)
|
||||
{
|
||||
result = value;
|
||||
result.Normalize();
|
||||
@@ -865,7 +865,7 @@ namespace FlaxEngine
|
||||
/// <param name="amount">Value between 0 and 1 indicating the weight of <paramref name="end" />.</param>
|
||||
/// <param name="result">When the method completes, contains the linear interpolation of the two vectors.</param>
|
||||
/// <remarks>Passing <paramref name="amount" /> a value of 0 will cause <paramref name="start" /> to be returned; a value of 1 will cause <paramref name="end" /> to be returned.</remarks>
|
||||
public static void Lerp(ref Double2 start, ref Double2 end, double amount, out Double2 result)
|
||||
public static void Lerp(in Double2 start, in Double2 end, double amount, out Double2 result)
|
||||
{
|
||||
result.X = Mathd.Lerp(start.X, end.X, amount);
|
||||
result.Y = Mathd.Lerp(start.Y, end.Y, amount);
|
||||
@@ -881,7 +881,7 @@ namespace FlaxEngine
|
||||
/// <remarks>Passing <paramref name="amount" /> a value of 0 will cause <paramref name="start" /> to be returned; a value of 1 will cause <paramref name="end" /> to be returned.</remarks>
|
||||
public static Double2 Lerp(Double2 start, Double2 end, double amount)
|
||||
{
|
||||
Lerp(ref start, ref end, amount, out Double2 result);
|
||||
Lerp(in start, in end, amount, out Double2 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -893,7 +893,7 @@ namespace FlaxEngine
|
||||
/// <param name="amount">Value between 0 and 1 indicating the weight of <paramref name="end" />.</param>
|
||||
/// <param name="result">When the method completes, contains the linear interpolation of the two vectors.</param>
|
||||
/// <remarks>Passing <paramref name="amount" /> a value of 0 will cause <paramref name="start" /> to be returned; a value of 1 will cause <paramref name="end" /> to be returned.</remarks>
|
||||
public static void Lerp(ref Double2 start, ref Double2 end, ref Double2 amount, out Double2 result)
|
||||
public static void Lerp(in Double2 start, in Double2 end, in Double2 amount, out Double2 result)
|
||||
{
|
||||
result.X = Mathd.Lerp(start.X, end.X, amount.X);
|
||||
result.Y = Mathd.Lerp(start.Y, end.Y, amount.Y);
|
||||
@@ -909,7 +909,7 @@ namespace FlaxEngine
|
||||
/// <remarks>Passing <paramref name="amount" /> a value of 0 will cause <paramref name="start" /> to be returned; a value of 1 will cause <paramref name="end" /> to be returned.</remarks>
|
||||
public static Double2 Lerp(Double2 start, Double2 end, Double2 amount)
|
||||
{
|
||||
Lerp(ref start, ref end, ref amount, out Double2 result);
|
||||
Lerp(in start, in end, in amount, out Double2 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -920,10 +920,10 @@ namespace FlaxEngine
|
||||
/// <param name="end">End vector.</param>
|
||||
/// <param name="amount">Value between 0 and 1 indicating the weight of <paramref name="end" />.</param>
|
||||
/// <param name="result">When the method completes, contains the cubic interpolation of the two vectors.</param>
|
||||
public static void SmoothStep(ref Double2 start, ref Double2 end, double amount, out Double2 result)
|
||||
public static void SmoothStep(in Double2 start, in Double2 end, double amount, out Double2 result)
|
||||
{
|
||||
amount = Mathd.SmoothStep(amount);
|
||||
Lerp(ref start, ref end, amount, out result);
|
||||
Lerp(in start, in end, amount, out result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -935,7 +935,7 @@ namespace FlaxEngine
|
||||
/// <returns>The cubic interpolation of the two vectors.</returns>
|
||||
public static Double2 SmoothStep(Double2 start, Double2 end, double amount)
|
||||
{
|
||||
SmoothStep(ref start, ref end, amount, out Double2 result);
|
||||
SmoothStep(in start, in end, amount, out Double2 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -948,7 +948,7 @@ namespace FlaxEngine
|
||||
/// <param name="tangent2">Second source tangent vector.</param>
|
||||
/// <param name="amount">Weighting factor.</param>
|
||||
/// <param name="result">When the method completes, contains the result of the Hermite spline interpolation.</param>
|
||||
public static void Hermite(ref Double2 value1, ref Double2 tangent1, ref Double2 value2, ref Double2 tangent2, double amount, out Double2 result)
|
||||
public static void Hermite(in Double2 value1, in Double2 tangent1, in Double2 value2, in Double2 tangent2, double amount, out Double2 result)
|
||||
{
|
||||
double squared = amount * amount;
|
||||
double cubed = amount * squared;
|
||||
@@ -971,7 +971,7 @@ namespace FlaxEngine
|
||||
/// <returns>The result of the Hermite spline interpolation.</returns>
|
||||
public static Double2 Hermite(Double2 value1, Double2 tangent1, Double2 value2, Double2 tangent2, double amount)
|
||||
{
|
||||
Hermite(ref value1, ref tangent1, ref value2, ref tangent2, amount, out Double2 result);
|
||||
Hermite(in value1, in tangent1, in value2, in tangent2, amount, out Double2 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -990,7 +990,7 @@ namespace FlaxEngine
|
||||
/// </summary>
|
||||
/// <param name="inDirection">The in direction.</param>
|
||||
/// <param name="result">When the method completes, contains the result of the calculation.</param>
|
||||
public static void Perpendicular(ref Double2 inDirection, out Double2 result)
|
||||
public static void Perpendicular(in Double2 inDirection, out Double2 result)
|
||||
{
|
||||
result = new Double2(-inDirection.Y, inDirection.X);
|
||||
}
|
||||
@@ -1004,7 +1004,7 @@ namespace FlaxEngine
|
||||
/// <param name="value4">The fourth position in the interpolation.</param>
|
||||
/// <param name="amount">Weighting factor.</param>
|
||||
/// <param name="result">When the method completes, contains the result of the Catmull-Rom interpolation.</param>
|
||||
public static void CatmullRom(ref Double2 value1, ref Double2 value2, ref Double2 value3, ref Double2 value4, double amount, out Double2 result)
|
||||
public static void CatmullRom(in Double2 value1, in Double2 value2, in Double2 value3, in Double2 value4, double amount, out Double2 result)
|
||||
{
|
||||
double squared = amount * amount;
|
||||
double cubed = amount * squared;
|
||||
@@ -1027,7 +1027,7 @@ namespace FlaxEngine
|
||||
/// <returns>A vector that is the result of the Catmull-Rom interpolation.</returns>
|
||||
public static Double2 CatmullRom(Double2 value1, Double2 value2, Double2 value3, Double2 value4, double amount)
|
||||
{
|
||||
CatmullRom(ref value1, ref value2, ref value3, ref value4, amount, out Double2 result);
|
||||
CatmullRom(in value1, in value2, in value3, in value4, amount, out Double2 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1037,7 +1037,7 @@ namespace FlaxEngine
|
||||
/// <param name="left">The first source vector.</param>
|
||||
/// <param name="right">The second source vector.</param>
|
||||
/// <param name="result">When the method completes, contains an new vector composed of the largest components of the source vectors.</param>
|
||||
public static void Max(ref Double2 left, ref Double2 right, out Double2 result)
|
||||
public static void Max(in Double2 left, in Double2 right, out Double2 result)
|
||||
{
|
||||
result.X = left.X > right.X ? left.X : right.X;
|
||||
result.Y = left.Y > right.Y ? left.Y : right.Y;
|
||||
@@ -1051,7 +1051,7 @@ namespace FlaxEngine
|
||||
/// <returns>A vector containing the largest components of the source vectors.</returns>
|
||||
public static Double2 Max(Double2 left, Double2 right)
|
||||
{
|
||||
Max(ref left, ref right, out Double2 result);
|
||||
Max(in left, in right, out Double2 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1061,7 +1061,7 @@ namespace FlaxEngine
|
||||
/// <param name="left">The first source vector.</param>
|
||||
/// <param name="right">The second source vector.</param>
|
||||
/// <param name="result">When the method completes, contains an new vector composed of the smallest components of the source vectors.</param>
|
||||
public static void Min(ref Double2 left, ref Double2 right, out Double2 result)
|
||||
public static void Min(in Double2 left, in Double2 right, out Double2 result)
|
||||
{
|
||||
result.X = left.X < right.X ? left.X : right.X;
|
||||
result.Y = left.Y < right.Y ? left.Y : right.Y;
|
||||
@@ -1075,7 +1075,7 @@ namespace FlaxEngine
|
||||
/// <returns>A vector containing the smallest components of the source vectors.</returns>
|
||||
public static Double2 Min(Double2 left, Double2 right)
|
||||
{
|
||||
Min(ref left, ref right, out Double2 result);
|
||||
Min(in left, in right, out Double2 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1096,7 +1096,7 @@ namespace FlaxEngine
|
||||
/// <param name="normal">Normal of the surface.</param>
|
||||
/// <param name="result">When the method completes, contains the reflected vector.</param>
|
||||
/// <remarks>Reflect only gives the direction of a reflection off a surface, it does not determine whether the original vector was close enough to the surface to hit it.</remarks>
|
||||
public static void Reflect(ref Double2 vector, ref Double2 normal, out Double2 result)
|
||||
public static void Reflect(in Double2 vector, in Double2 normal, out Double2 result)
|
||||
{
|
||||
double dot = vector.X * normal.X + vector.Y * normal.Y;
|
||||
result.X = vector.X - 2.0 * dot * normal.X;
|
||||
@@ -1112,7 +1112,7 @@ namespace FlaxEngine
|
||||
/// <remarks>Reflect only gives the direction of a reflection off a surface, it does not determine whether the original vector was close enough to the surface to hit it.</remarks>
|
||||
public static Double2 Reflect(Double2 vector, Double2 normal)
|
||||
{
|
||||
Reflect(ref vector, ref normal, out Double2 result);
|
||||
Reflect(in vector, in normal, out Double2 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1122,7 +1122,7 @@ namespace FlaxEngine
|
||||
/// <param name="vector">The vector to rotate.</param>
|
||||
/// <param name="rotation">The <see cref="Quaternion" /> rotation to apply.</param>
|
||||
/// <param name="result">When the method completes, contains the transformed <see cref="Double4" />.</param>
|
||||
public static void Transform(ref Double2 vector, ref Quaternion rotation, out Double2 result)
|
||||
public static void Transform(in Double2 vector, in Quaternion rotation, out Double2 result)
|
||||
{
|
||||
double x = rotation.X + rotation.X;
|
||||
double y = rotation.Y + rotation.Y;
|
||||
@@ -1143,7 +1143,7 @@ namespace FlaxEngine
|
||||
/// <returns>The transformed <see cref="Double4" />.</returns>
|
||||
public static Double2 Transform(Double2 vector, Quaternion rotation)
|
||||
{
|
||||
Transform(ref vector, ref rotation, out Double2 result);
|
||||
Transform(in vector, in rotation, out Double2 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1153,7 +1153,7 @@ namespace FlaxEngine
|
||||
/// <param name="vector">The source vector.</param>
|
||||
/// <param name="transform">The transformation <see cref="Matrix" />.</param>
|
||||
/// <param name="result">When the method completes, contains the transformed <see cref="Double4" />.</param>
|
||||
public static void Transform(ref Double2 vector, ref Matrix transform, out Double4 result)
|
||||
public static void Transform(in Double2 vector, in Matrix transform, out Double4 result)
|
||||
{
|
||||
result = new Double4(vector.X * transform.M11 + vector.Y * transform.M21 + transform.M41,
|
||||
vector.X * transform.M12 + vector.Y * transform.M22 + transform.M42,
|
||||
@@ -1169,7 +1169,7 @@ namespace FlaxEngine
|
||||
/// <returns>The transformed <see cref="Double4" />.</returns>
|
||||
public static Double4 Transform(Double2 vector, Matrix transform)
|
||||
{
|
||||
Transform(ref vector, ref transform, out Double4 result);
|
||||
Transform(in vector, in transform, out Double4 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1186,7 +1186,7 @@ namespace FlaxEngine
|
||||
/// therefore makes the vector homogeneous. The homogeneous vector is often preferred when working
|
||||
/// with coordinates as the w component can safely be ignored.
|
||||
/// </remarks>
|
||||
public static void TransformCoordinate(ref Double2 coordinate, ref Matrix transform, out Double2 result)
|
||||
public static void TransformCoordinate(in Double2 coordinate, in Matrix transform, out Double2 result)
|
||||
{
|
||||
var vector = new Double4
|
||||
{
|
||||
@@ -1213,7 +1213,7 @@ namespace FlaxEngine
|
||||
/// </remarks>
|
||||
public static Double2 TransformCoordinate(Double2 coordinate, Matrix transform)
|
||||
{
|
||||
TransformCoordinate(ref coordinate, ref transform, out Double2 result);
|
||||
TransformCoordinate(in coordinate, in transform, out Double2 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1230,7 +1230,7 @@ namespace FlaxEngine
|
||||
/// apply. This is often preferred for normal vectors as normals purely represent direction
|
||||
/// rather than location because normal vectors should not be translated.
|
||||
/// </remarks>
|
||||
public static void TransformNormal(ref Double2 normal, ref Matrix transform, out Double2 result)
|
||||
public static void TransformNormal(in Double2 normal, in Matrix transform, out Double2 result)
|
||||
{
|
||||
result = new Double2(normal.X * transform.M11 + normal.Y * transform.M21,
|
||||
normal.X * transform.M12 + normal.Y * transform.M22);
|
||||
@@ -1251,7 +1251,7 @@ namespace FlaxEngine
|
||||
/// </remarks>
|
||||
public static Double2 TransformNormal(Double2 normal, Matrix transform)
|
||||
{
|
||||
TransformNormal(ref normal, ref transform, out Double2 result);
|
||||
TransformNormal(in normal, in transform, out Double2 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1282,7 +1282,7 @@ namespace FlaxEngine
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Multiplies a vector with another by performing component-wise multiplication equivalent to <see cref="Multiply(ref Double2,ref Double2,out Double2)" />.
|
||||
/// Multiplies a vector with another by performing component-wise multiplication equivalent to <see cref="Multiply(in Double2,in Double2,out Double2)" />.
|
||||
/// </summary>
|
||||
/// <param name="left">The first vector to multiply.</param>
|
||||
/// <param name="right">The second vector to multiply.</param>
|
||||
@@ -1464,7 +1464,7 @@ namespace FlaxEngine
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool operator ==(Double2 left, Double2 right)
|
||||
{
|
||||
return left.Equals(ref right);
|
||||
return left.Equals(in right);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1476,7 +1476,7 @@ namespace FlaxEngine
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool operator !=(Double2 left, Double2 right)
|
||||
{
|
||||
return !left.Equals(ref right);
|
||||
return !left.Equals(in right);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1580,7 +1580,7 @@ namespace FlaxEngine
|
||||
/// <param name="other">The <see cref="Double2" /> to compare with this instance.</param>
|
||||
/// <returns><c>true</c> if the specified <see cref="Double2" /> is equal to this instance; otherwise, <c>false</c>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool Equals(ref Double2 other)
|
||||
public bool Equals(in Double2 other)
|
||||
{
|
||||
return X == other.X && Y == other.Y;
|
||||
}
|
||||
@@ -1588,9 +1588,9 @@ namespace FlaxEngine
|
||||
/// <summary>
|
||||
/// Determines whether the specified <see cref="Double2"/> are equal.
|
||||
/// </summary>
|
||||
public static bool Equals(ref Double2 a, ref Double2 b)
|
||||
public static bool Equals(in Double2 a, in Double2 b)
|
||||
{
|
||||
return a.Equals(ref b);
|
||||
return a.Equals(in b);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1601,7 +1601,7 @@ namespace FlaxEngine
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool Equals(Double2 other)
|
||||
{
|
||||
return Equals(ref other);
|
||||
return Equals(in other);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1611,7 +1611,7 @@ namespace FlaxEngine
|
||||
/// <returns><c>true</c> if the specified <see cref="System.Object" /> is equal to this instance; otherwise, <c>false</c>.</returns>
|
||||
public override bool Equals(object value)
|
||||
{
|
||||
return value is Double2 other && Equals(ref other);
|
||||
return value is Double2 other && Equals(in other);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user