/// <summary> /// Returns a random vector which has components within the given interval. /// </summary> /// <param name="random"></param> /// <param name="t0"></param> /// <param name="t1"></param> /// <returns></returns> public static Vector3d NextVector3d(this Random random, double t0, double t1) { return(new Vector3d( SlurMath.Lerp(t0, t1, random.NextDouble()), SlurMath.Lerp(t0, t1, random.NextDouble()), SlurMath.Lerp(t0, t1, random.NextDouble()))); }
/// <summary> /// /// </summary> public static double Lerp(this double[] vector, double t) { int last = vector.Length - 1; t = SlurMath.Fract(t * last, out int i); if (i < 0) { return(vector[0]); } else if (i >= last) { return(vector[last]); } return(SlurMath.Lerp(vector[i], vector[i + 1], t)); }
/// <summary> /// /// </summary> /// <param name="t"></param> public double Evaluate(double t) { return(SlurMath.Lerp(A, B, t)); }
/// <summary> /// /// </summary> /// <param name="t"></param> public float Evaluate(float t) { return(SlurMath.Lerp(A, B, t)); }