Exemplo n.º 1
0
        public bool Intersects(Interval other)
        {
            float a = Math.Max(this.start, other.start);
            float b = Math.Min(this.end, other.end);

            return (b > a);
        }
Exemplo n.º 2
0
        public static float Intersection(Interval i1, Interval i2)
        {
            float a = Math.Max(i1.start, i2.start);
            float b = Math.Min(i1.end, i2.end);

            if (b < a)
                return 0;
            else
                return b - a;
        }