Пример #1
0
        /// @brief Returns the biggest frame range this event can have
        public FrameRange GetMaxFrameRange()
        {
            FrameRange range = new FrameRange(0, 0);

            if (id == 0)
            {
                range.Start = 0;
            }
            else
            {
                range.Start = root.GetEvents()[id - 1].End;
            }

            if (id == root.GetEvents().Count - 1) // last one?
            {
                range.End = root.Length;
            }
            else
            {
                range.End = root.GetEvents()[id + 1].Start;
            }

            return(range);
        }
Пример #2
0
        /// @brief Returns what kind of overlap it has with \e range.
        /// @note Assumes They are both valid
        public FrameRangeOverlap GetOverlap(FrameRange range)
        {
            if (range.Start >= Start)
            {
                // contains, left or none
                if (range.End <= End)
                {
                    return(FrameRangeOverlap.ContainsFull);
                }
                else
                {
                    if (range.Start > End)
                    {
                        return(FrameRangeOverlap.MissOnRight);
                    }
                    return(FrameRangeOverlap.ContainsStart);
                }
            }
            else
            {
                // contained, right or none
                if (range.End < Start)
                {
                    return(FrameRangeOverlap.MissOnLeft);
                }
                else
                {
                    if (range.End > End)
                    {
                        return(FrameRangeOverlap.IsContained);
                    }

                    return(FrameRangeOverlap.ContainsEnd);
                }
            }
        }
Пример #3
0
 /// @brief Returns if the ranges intersect, i.e. touching returns false
 /// @note Assumes They are both valid
 public bool Collides(FrameRange range)
 {
     return(Start < range.End && End > range.Start);
     //			return (range.start > start && range.start < end) || (range.end > start && range.end < end );
 }
Пример #4
0
 /// @brief Returns if the ranges overlap, i.e. touching return true
 /// @note Assumes They are both valid
 public bool Overlaps(FrameRange range)
 {
     return(range.End >= Start && range.Start <= End);
 }
Пример #5
0
 public static FrameRange Resize(FrameRange cur, FrameRange clampV)
 {
     cur.Start = Mathf.Clamp(cur.Start, clampV.Start, clampV.End);
     cur.End = Mathf.Clamp(cur.End, cur.Start, clampV.End);
     return cur;
 }