Esempio n. 1
0
    public bool Intersect(ClipRange other)
    {
        bool b1 = (start - other.start) * (end - other.start) < 0;
        bool b2 = (start - other.end) * (end - other.end) < 0;

        if (b1 & b2)
        {
            return(false);
        }
        return(b1 | b2);
    }
Esempio n. 2
0
        public static List <ClipRange> HirTrackClipRange(this XTrack track)
        {
            var ranges = track.TrackClipRange();

            if (track.childs != null)
            {
                foreach (var it in track.childs)
                {
                    var r2 = it.TrackClipRange();
                    ClipRange.MergeClipRange(ranges, r2);
                }
            }
            return(ranges);
        }
Esempio n. 3
0
 public bool Merge(ClipRange other)
 {
     if (Intersect(other))
     {
         start = Mathf.Min(start, other.start);
         end   = Mathf.Max(end, other.end);
         return(true);
     }
     if (IsIn(other) || IsOuter(other))
     {
         start = Mathf.Min(start, other.start);
         end   = Mathf.Max(end, other.end);
         return(true);
     }
     return(false);
 }
Esempio n. 4
0
        public static List <ClipRange> TrackClipRange(this XTrack track)
        {
            List <ClipRange> ranges = new List <ClipRange>();

            if (track.clips != null)
            {
                var clips = track.clips.ToList();
                clips.Sort((x, y) => x.start.CompareTo(y.start));
                float last = -1;
                foreach (var it in clips)
                {
                    ClipRange range = new ClipRange();
                    if (it.start > last)
                    {
                        range.start = it.start;
                        range.end   = it.end;
                        ranges.Add(range);
                        last = it.end;
                    }
                }
            }
            return(ranges);
        }
Esempio n. 5
0
 public bool IsSeprate(ClipRange other)
 {
     return(other.end <start | other.start> end);
 }
Esempio n. 6
0
 public bool IsOuter(ClipRange other)
 {
     return(other.start > start & other.end < end);
 }
Esempio n. 7
0
 public bool IsIn(ClipRange other)
 {
     return(other.start < start && other.end > end);
 }