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); }
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); }
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); }
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); }
public bool IsSeprate(ClipRange other) { return(other.end <start | other.start> end); }
public bool IsOuter(ClipRange other) { return(other.start > start & other.end < end); }
public bool IsIn(ClipRange other) { return(other.start < start && other.end > end); }