예제 #1
0
파일: Interval.cs 프로젝트: ezamagni/xebab
        public bool Intersects(Interval other)
        {
            float a = Math.Max(this.start, other.start);
            float b = Math.Min(this.end, other.end);

            return (b > a);
        }
예제 #2
0
파일: Interval.cs 프로젝트: ezamagni/xebab
        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;
        }