/// <summary>
 /// Computes Tangent for a curve segment
 /// </summary>
 public static void AutoCalcTangent(FVector2D prevP, FVector2D p, FVector2D nextP, float tension, out FVector2D outTan)
 {
     outTan = (1.0f - tension) * ((p - prevP) + (nextP - p));
 }
Exemple #2
0
 /// <summary>
 /// Transform the given Value relative to the input range to the Output Range.
 /// </summary>
 public static float GetMappedRangeValueUnclamped(FVector2D inputRange, FVector2D outputRange, float value)
 {
     return(GetRangeValue(outputRange, GetRangePct(inputRange, value)));
 }
Exemple #3
0
        /// <summary>
        /// For the given Value clamped to the [Input:Range] inclusive, returns the corresponding percentage in [Output:Range] Inclusive.
        /// </summary>
        public static float GetMappedRangeValueClamped(FVector2D inputRange, FVector2D outputRange, float value)
        {
            float clampedPct = Clamp(GetRangePct(inputRange, value), 0.0f, 1.0f);

            return(GetRangeValue(outputRange, clampedPct));
        }
Exemple #4
0
 /// <summary>
 /// Basically a Vector2d version of Lerp.
 /// </summary>
 public static float GetRangeValue(FVector2D range, float pct)
 {
     return(Lerp(range.X, range.Y, pct));
 }
Exemple #5
0
 /// <summary>
 /// Calculates the percentage along a line from MinValue to MaxValue that Value is.
 /// </summary>
 /// <returns></returns>
 public static float GetRangePct(FVector2D range, float value)
 {
     return(GetRangePct(range.X, range.Y, value));
 }
Exemple #6
0
 /// <summary>
 /// Performs a linear interpolation between two values, Alpha ranges from 0-1
 /// </summary>
 public static FVector2D LerpStable(FVector2D a, FVector2D b, float alpha)
 {
     return(new FVector2D(
                FMath.LerpStable(a.X, b.X, alpha),
                FMath.LerpStable(a.Y, b.Y, alpha)));
 }