コード例 #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;
        }