Пример #1
0
        /// <summary>
        /// Removes the control point from the curve.
        /// </summary>
        /// <param name="index">Index to remove at.</param>
        public void RemoveAt(int index)
        {
            CurveControlPoint <TValue> removed = list[index];

            list.RemoveAt(index);
            Curve.ControlPointRemoved(removed, index);
        }
Пример #2
0
        /// <summary>
        /// Adds a new control point to the curve.
        /// </summary>
        /// <param name="time">Time of the new control point.</param>
        /// <param name="value">Value of the new control point.</param>
        /// <returns>Newly created control point.</returns>
        public CurveControlPoint <TValue> Add(float time, TValue value)
        {
            var toAdd = new CurveControlPoint <TValue>(time, value, Curve);

            Add(toAdd);
            return(toAdd);
        }
Пример #3
0
        /// <summary>
        /// Adds a control point to the curve.
        /// </summary>
        /// <param name="point">New control point to add to the curve.</param>
        public void Add(CurveControlPoint <TValue> point)
        {
            int index = Curve.GetPreviousIndex(point.Time) + 1;

            //TODO: Test for time-wise duplicate?
            //IndexA would be the one that's possibly duplicated.
            //Even with duplicate, this is still technically sorted.
            list.Insert(index, point);
            Curve.ControlPointAdded(point, index);
        }
Пример #4
0
        internal void InternalControlPointTimeChanged(CurveControlPoint <TValue> controlPoint)
        {
            int oldIndex = ControlPoints.list.IndexOf(controlPoint);

            ControlPoints.list.RemoveAt(oldIndex);
            int index = GetPreviousIndex(controlPoint.Time) + 1;

            ControlPoints.list.Insert(index, controlPoint);
            ControlPointTimeChanged(controlPoint, oldIndex, index);
        }
Пример #5
0
 /// <summary>
 /// Compares the two control points based on their time.
 /// </summary>
 /// <param name="other">Control point to compare.</param>
 /// <returns>-1 if the current instance has a smaller time, 0 if equal, and 1 if the current instance has a larger time.</returns>
 public int CompareTo(CurveControlPoint <TValue> other)
 {
     if (other.Time < Time)
     {
         return(1);
     }
     if (other.Time > Time)
     {
         return(-1);
     }
     return(0);
 }
 /// <summary>
 /// Called when a control point belonging to the curve has its value changed.
 /// </summary>
 /// <param name="curveControlPoint">Changed control point.</param>
 protected internal override void ControlPointValueChanged(CurveControlPoint <Vector3> curveControlPoint)
 {
 }
Пример #7
0
 /// <summary>
 /// Called when a control point belonging to the curve has its time changed.
 /// </summary>
 /// <param name="curveControlPoint">Changed control point.</param>
 /// <param name="oldIndex">Old index of the control point.</param>
 /// <param name="newIndex">New index of the control point.</param>
 protected internal override void ControlPointTimeChanged(CurveControlPoint <Vector3> curveControlPoint, int oldIndex, int newIndex)
 {
     tangents.Clear();
     ComputeTangents();
 }
 /// <summary>
 /// Called when a control point is removed.
 /// </summary>
 /// <param name="curveControlPoint">Removed control point.</param>
 /// <param name="oldIndex">Index of the control point before it was removed.</param>
 protected internal override void ControlPointRemoved(CurveControlPoint <Vector3> curveControlPoint, int oldIndex)
 {
 }
 /// <summary>
 /// Called when a control point belonging to the curve has its time changed.
 /// </summary>
 /// <param name="curveControlPoint">Changed control point.</param>
 /// <param name="oldIndex">Old index of the control point.</param>
 /// <param name="newIndex">New index of the control point.</param>
 protected internal override void ControlPointTimeChanged(CurveControlPoint <Vector3> curveControlPoint, int oldIndex, int newIndex)
 {
 }
Пример #10
0
 /// <summary>
 /// Called when a control point belonging to the curve has its value changed.
 /// </summary>
 /// <param name="curveControlPoint">Changed control point.</param>
 protected internal override void ControlPointValueChanged(CurveControlPoint <Quaternion> curveControlPoint)
 {
 }
 /// <summary>
 /// Called when a control point is added.
 /// </summary>
 /// <param name="curveControlPoint">New control point.</param>
 /// <param name="index">Index of the control point.</param>
 protected internal override void ControlPointAdded(CurveControlPoint <Vector3> curveControlPoint, int index)
 {
 }
Пример #12
0
 /// <summary>
 /// Called when a control point is added.
 /// </summary>
 /// <param name="curveControlPoint">New control point.</param>
 /// <param name="index">Index of the control point.</param>
 protected internal override void ControlPointAdded(CurveControlPoint <Quaternion> curveControlPoint, int index)
 {
 }
Пример #13
0
 /// <summary>
 /// Called when a control point is removed.
 /// </summary>
 /// <param name="curveControlPoint">Removed control point.</param>
 /// <param name="oldIndex">Index of the control point before it was removed.</param>
 protected internal override void ControlPointRemoved(CurveControlPoint <Quaternion> curveControlPoint, int oldIndex)
 {
 }
Пример #14
0
 /// <summary>
 /// Called when a control point is added.
 /// </summary>
 /// <param name="curveControlPoint">New control point.</param>
 /// <param name="index">Index of the control point.</param>
 protected internal abstract void ControlPointAdded(CurveControlPoint <TValue> curveControlPoint, int index);
Пример #15
0
 /// <summary>
 /// Called when a control point belonging to the curve has its value changed.
 /// </summary>
 /// <param name="curveControlPoint">Changed control point.</param>
 protected internal override void ControlPointValueChanged(CurveControlPoint <Vector3> curveControlPoint)
 {
     tangents.Clear();
     ComputeTangents();
 }
Пример #16
0
 /// <summary>
 /// Called when a control point is added.
 /// </summary>
 /// <param name="curveControlPoint">New control point.</param>
 /// <param name="index">Index of the control point.</param>
 protected internal override void ControlPointAdded(CurveControlPoint <Vector3> curveControlPoint, int index)
 {
     tangents.Clear();
     ComputeTangents();
 }
Пример #17
0
 /// <summary>
 /// Removes the control point from the curve.
 /// </summary>
 /// <param name="controlPoint">Control point to remove.</param>
 public void Remove(CurveControlPoint <TValue> controlPoint)
 {
     RemoveAt(list.IndexOf(controlPoint));
 }
Пример #18
0
 /// <summary>
 /// Called when a control point is removed.
 /// </summary>
 /// <param name="curveControlPoint">Removed control point.</param>
 /// <param name="oldIndex">Index of the control point before it was removed.</param>
 protected internal abstract void ControlPointRemoved(CurveControlPoint <TValue> curveControlPoint, int oldIndex);
Пример #19
0
 /// <summary>
 /// Called when a control point belonging to the curve has its time changed.
 /// </summary>
 /// <param name="curveControlPoint">Changed control point.</param>
 /// <param name="oldIndex">Old index of the control point.</param>
 /// <param name="newIndex">New index of the control point.</param>
 protected internal abstract void ControlPointTimeChanged(CurveControlPoint <TValue> curveControlPoint, int oldIndex, int newIndex);
Пример #20
0
 /// <summary>
 /// Called when a control point belonging to the curve has its value changed.
 /// </summary>
 /// <param name="curveControlPoint">Changed control point.</param>
 protected internal abstract void ControlPointValueChanged(CurveControlPoint <TValue> curveControlPoint);