/// <summary> /// Expands this interval to include another /// </summary> /// <param name="other"></param> public void Include(Intervalf other) { if (IsDecreasing) { IncludeNeg(other.A); IncludeNeg(other.B); } else { IncludePos(other.A); IncludePos(other.B); } }
/// <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) { return(SlurMath.Remap(t, from.A, from.B, to.A, to.B)); }
/// <summary> /// /// </summary> /// <param name="other"></param> /// <param name="epsilon"></param> /// <returns></returns> public bool ApproxEquals(Intervalf other, float epsilon = F.ZeroTolerance) { return (SlurMath.ApproxEquals(A, other.A, epsilon) && SlurMath.ApproxEquals(B, other.B, epsilon)); }
/// <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(); }
/// <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(); }
/// <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); }