Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="t"></param>
        /// <param name="from"></param>
        /// <param name="to"></param>
        /// <returns></returns>
        public static float Remap(float t, Intervalf from, Intervalf to)
        {
            if (!from.IsValid)
            {
                throw new InvalidOperationException("Can't remap from an invalid interval");
            }

            return(SlurMath.Remap(t, from.A, from.B, to.A, to.B));
        }
Example #2
0
 /// <summary>
 /// Expands this interval to include another
 /// </summary>
 /// <param name="other"></param>
 public void Include(Intervalf other)
 {
     Include(other.A);
     Include(other.B);
 }
Example #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="other"></param>
 /// <param name="tolerance"></param>
 /// <returns></returns>
 public bool ApproxEquals(Intervalf other, float tolerance = SlurMath.ZeroTolerancef)
 {
     return
         (SlurMath.ApproxEquals(A, other.A, tolerance) &&
          SlurMath.ApproxEquals(B, other.B, tolerance));
 }
Example #4
0
 /// <summary>
 /// Returns the region of a that is not in b.
 /// </summary>
 /// <param name="a"></param>
 /// <param name="b"></param>
 /// <returns></returns>
 public static Intervalf Difference(Intervalf a, Intervalf b)
 {
     throw new NotImplementedException();
 }
Example #5
0
 /// <summary>
 /// Returns the region of a that is also in b.
 /// </summary>
 /// <param name="a"></param>
 /// <param name="b"></param>
 /// <returns></returns>
 public static Intervalf Intersect(Intervalf a, Intervalf b)
 {
     throw new NotImplementedException();
 }
Example #6
0
 /// <summary>
 /// Returns the union of a and b.
 /// </summary>
 /// <param name="a"></param>
 /// <param name="b"></param>
 /// <returns></returns>
 public static Intervalf Union(Intervalf a, Intervalf b)
 {
     a.Include(b.A);
     a.Include(b.B);
     return(a);
 }