Пример #1
0
 /// <summary>
 /// Creates a new <see cref="Vector2f"/> that contains linear interpolation of the specified vectors.
 /// </summary>
 /// <param name="value1">The first vector.</param>
 /// <param name="value2">The second vector.</param>
 /// <param name="amount">Weighting value(between 0.0 and 1.0).</param>
 /// <param name="result">The result of linear interpolation of the specified vectors as an output parameter.</param>
 public static void Lerp(ref Vector2f value1, ref Vector2f value2, float amount, out Vector2f result)
 {
     result.X = Maths.Lerp(value1.X, value2.X, amount);
     result.Y = Maths.Lerp(value1.Y, value2.Y, amount);
 }
Пример #2
0
 /// <summary>
 /// Creates a new <see cref="Vector2f"/> that contains hermite spline interpolation.
 /// </summary>
 /// <param name="value1">The first position vector.</param>
 /// <param name="tangent1">The first tangent vector.</param>
 /// <param name="value2">The second position vector.</param>
 /// <param name="tangent2">The second tangent vector.</param>
 /// <param name="amount">Weighting factor.</param>
 /// <param name="result">The hermite spline interpolation vector as an output parameter.</param>
 public static void Hermite(ref Vector2f value1, ref Vector2f tangent1, ref Vector2f value2, ref Vector2f tangent2, float amount, out Vector2f result)
 {
     result.X = Maths.Hermite(value1.X, tangent1.X, value2.X, tangent2.X, amount);
     result.Y = Maths.Hermite(value1.Y, tangent1.Y, value2.Y, tangent2.Y, amount);
 }
Пример #3
0
 /// <summary>
 /// Creates a new <see cref="Vector2f"/> that contains linear interpolation of the specified vectors.
 /// </summary>
 /// <param name="value1">The first vector.</param>
 /// <param name="value2">The second vector.</param>
 /// <param name="amount">Weighting value(between 0.0 and 1.0).</param>
 /// <returns>The result of linear interpolation of the specified vectors.</returns>
 public static Vector2f Lerp(Vector2f value1, Vector2f value2, float amount)
 {
     return(new Vector2f(
                Maths.Lerp(value1.X, value2.X, amount),
                Maths.Lerp(value1.Y, value2.Y, amount)));
 }
Пример #4
0
 /// <summary>
 /// Clamps the specified value within a range.
 /// </summary>
 /// <param name="value1">The value to clamp.</param>
 /// <param name="min">The min value.</param>
 /// <param name="max">The max value.</param>
 /// <param name="result">The clamped value as an output parameter.</param>
 public static void Clamp(ref Vector2f value1, ref Vector2f min, ref Vector2f max, out Vector2f result)
 {
     result.X = Maths.Clamp(value1.X, min.X, max.X);
     result.Y = Maths.Clamp(value1.Y, min.Y, max.Y);
 }
Пример #5
0
 /// <summary>
 /// Creates a new <see cref="Vector2f"/> that contains hermite spline interpolation.
 /// </summary>
 /// <param name="value1">The first position vector.</param>
 /// <param name="tangent1">The first tangent vector.</param>
 /// <param name="value2">The second position vector.</param>
 /// <param name="tangent2">The second tangent vector.</param>
 /// <param name="amount">Weighting factor.</param>
 /// <returns>The hermite spline interpolation vector.</returns>
 public static Vector2f Hermite(Vector2f value1, Vector2f tangent1, Vector2f value2, Vector2f tangent2, float amount)
 {
     return(new Vector2f(Maths.Hermite(value1.X, tangent1.X, value2.X, tangent2.X, amount), Maths.Hermite(value1.Y, tangent1.Y, value2.Y, tangent2.Y, amount)));
 }
Пример #6
0
 /// <summary>
 /// Clamps the specified value within a range.
 /// </summary>
 /// <param name="value1">The value to clamp.</param>
 /// <param name="min">The min value.</param>
 /// <param name="max">The max value.</param>
 /// <returns>The clamped value.</returns>
 public static Vector2f Clamp(Vector2f value1, Vector2f min, Vector2f max)
 {
     return(new Vector2f(
                Maths.Clamp(value1.X, min.X, max.X),
                Maths.Clamp(value1.Y, min.Y, max.Y)));
 }
Пример #7
0
 /// <summary>
 /// Creates a new <see cref="Vector2f"/> that contains CatmullRom interpolation of the specified vectors.
 /// </summary>
 /// <param name="value1">The first vector in interpolation.</param>
 /// <param name="value2">The second vector in interpolation.</param>
 /// <param name="value3">The third vector in interpolation.</param>
 /// <param name="value4">The fourth vector in interpolation.</param>
 /// <param name="amount">Weighting factor.</param>
 /// <param name="result">The result of CatmullRom interpolation as an output parameter.</param>
 public static void CatmullRom(ref Vector2f value1, ref Vector2f value2, ref Vector2f value3, ref Vector2f value4, float amount, out Vector2f result)
 {
     result.X = Maths.CatmullRom(value1.X, value2.X, value3.X, value4.X, amount);
     result.Y = Maths.CatmullRom(value1.Y, value2.Y, value3.Y, value4.Y, amount);
 }
Пример #8
0
 /// <summary>
 /// Creates a new <see cref="Vector2f"/> that contains CatmullRom interpolation of the specified vectors.
 /// </summary>
 /// <param name="value1">The first vector in interpolation.</param>
 /// <param name="value2">The second vector in interpolation.</param>
 /// <param name="value3">The third vector in interpolation.</param>
 /// <param name="value4">The fourth vector in interpolation.</param>
 /// <param name="amount">Weighting factor.</param>
 /// <returns>The result of CatmullRom interpolation.</returns>
 public static Vector2f CatmullRom(Vector2f value1, Vector2f value2, Vector2f value3, Vector2f value4, float amount)
 {
     return(new Vector2f(
                Maths.CatmullRom(value1.X, value2.X, value3.X, value4.X, amount),
                Maths.CatmullRom(value1.Y, value2.Y, value3.Y, value4.Y, amount)));
 }
Пример #9
0
 /// <summary>
 /// Creates a new <see cref="Vector2f"/> that contains the cartesian coordinates of a vector specified in barycentric coordinates and relative to 2d-triangle.
 /// </summary>
 /// <param name="value1">The first vector of 2d-triangle.</param>
 /// <param name="value2">The second vector of 2d-triangle.</param>
 /// <param name="value3">The third vector of 2d-triangle.</param>
 /// <param name="amount1">Barycentric scalar <c>b2</c> which represents a weighting factor towards second vector of 2d-triangle.</param>
 /// <param name="amount2">Barycentric scalar <c>b3</c> which represents a weighting factor towards third vector of 2d-triangle.</param>
 /// <param name="result">The cartesian translation of barycentric coordinates as an output parameter.</param>
 public static void Barycentric(ref Vector2f value1, ref Vector2f value2, ref Vector2f value3, float amount1, float amount2, out Vector2f result)
 {
     result.X = Maths.Barycentric(value1.X, value2.X, value3.X, amount1, amount2);
     result.Y = Maths.Barycentric(value1.Y, value2.Y, value3.Y, amount1, amount2);
 }
Пример #10
0
 /// <summary>
 /// Creates a new <see cref="Vector2f"/> that contains the cartesian coordinates of a vector specified in barycentric coordinates and relative to 2d-triangle.
 /// </summary>
 /// <param name="value1">The first vector of 2d-triangle.</param>
 /// <param name="value2">The second vector of 2d-triangle.</param>
 /// <param name="value3">The third vector of 2d-triangle.</param>
 /// <param name="amount1">Barycentric scalar <c>b2</c> which represents a weighting factor towards second vector of 2d-triangle.</param>
 /// <param name="amount2">Barycentric scalar <c>b3</c> which represents a weighting factor towards third vector of 2d-triangle.</param>
 /// <returns>The cartesian translation of barycentric coordinates.</returns>
 public static Vector2f Barycentric(Vector2f value1, Vector2f value2, Vector2f value3, float amount1, float amount2)
 {
     return(new Vector2f(
                Maths.Barycentric(value1.X, value2.X, value3.X, amount1, amount2),
                Maths.Barycentric(value1.Y, value2.Y, value3.Y, amount1, amount2)));
 }