/// <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(zMath.Remap(t, from.A, from.B, to.A, to.B)); }
/// <summary> /// Expands this interval to include another /// </summary> /// <param name="other"></param> public void Include(Intervalf other) { Include(other.A); Include(other.B); }
/// <summary> /// /// </summary> /// <param name="other"></param> /// <param name="tolerance"></param> /// <returns></returns> public bool ApproxEquals(Intervalf other, float tolerance = zMath.ZeroTolerancef) { return (zMath.ApproxEquals(A, other.A, tolerance) && zMath.ApproxEquals(B, other.B, tolerance)); }
/// <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); }