示例#1
0
        public Curve2D(CurveLoopType curveLoopType)
        {
            this.curveLookType = curveLoopType;

            this.xCurve = new Curve1D(curveLoopType);
            this.yCurve = new Curve1D(curveLoopType);
        }
示例#2
0
        public Curve2D(CurveLoopType curveLoopType)
        {
            this.curveLookType = curveLoopType;

            this.xCurve = new Curve1D(curveLoopType);
            this.yCurve = new Curve1D(curveLoopType);
        }
示例#3
0
        public Curve2D(CurveLoopType curveLoopType)
        {
            curveLookType = curveLoopType;

            xCurve = new Curve1D(curveLoopType);
            yCurve = new Curve1D(curveLoopType);
        }
示例#4
0
        //See CurveLoopType - https://msdn.microsoft.com/en-us/library/microsoft.xna.framework.curvelooptype.aspx
        public Curve1D(CurveLoopType curveLookType)
        {
            this.curveLookType = curveLookType;

            this.curve          = new Curve();
            this.curve.PreLoop  = curveLookType;
            this.curve.PostLoop = curveLookType;
        }
示例#5
0
        //See CurveLoopType - https://msdn.microsoft.com/en-us/library/microsoft.xna.framework.curvelooptype.aspx
        public Curve1D(CurveLoopType curveLookType)
        {
            this.curveLookType = curveLookType;

            this.curve = new Curve();
            this.curve.PreLoop = curveLookType;
            this.curve.PostLoop = curveLookType;
        }
示例#6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Curve3D"/> class.
        /// </summary>
        /// <param name="CurveLoopType">Type of the curve loop.</param>
        public Curve3D(CurveLoopType CurveLoopType)
        {
            curveX.PostLoop = CurveLoopType;
            curveY.PostLoop = CurveLoopType;
            curveZ.PostLoop = CurveLoopType;

            curveX.PreLoop = CurveLoopType;
            curveY.PreLoop = CurveLoopType;
            curveZ.PreLoop = CurveLoopType;
        }
示例#7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Curve3D"/> class.
        /// </summary>
        /// <param name="CurveLoopType">Type of the curve loop.</param>
        public Curve3D(CurveLoopType CurveLoopType)
        {
            curveX.PostLoop = CurveLoopType;
            curveY.PostLoop = CurveLoopType;
            curveZ.PostLoop = CurveLoopType;

            curveX.PreLoop = CurveLoopType;
            curveY.PreLoop = CurveLoopType;
            curveZ.PreLoop = CurveLoopType;
        }
示例#8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Curve"/> class.
        /// </summary>
        /// <param name="preLoop">A <see cref="CurveLoopType"/> value indicating how the curve's values are determined
        /// for points before the beginning of the curve.</param>
        /// <param name="postLoop">A <see cref="CurveLoopType"/> value indicating how the curve's values are determined
        /// for points after the end of the curve.</param>
        /// <param name="keys">A collection of <see cref="CurveKey"/> objects from which to construct the curve.</param>
        public Curve(CurveLoopType preLoop, CurveLoopType postLoop, IEnumerable <CurveKey> keys)
        {
            this.preLoop  = preLoop;
            this.postLoop = postLoop;

            this.keys     = new CurveKeyCollection(keys);
            this.keyFirst = (keys == null) ? null : this.keys[0];
            this.keyLast  = (keys == null) ? null : this.keys[this.keys.Count - 1];
            this.length   = (keys == null) ? 0f : keyLast.Position - keyFirst.Position;

            this.easingFunction = Evaluate;
        }
示例#9
0
        public Curve(CurveLoopType preLoop, CurveLoopType postLoop, IEnumerable<CurveKey> keys)
        {
            this.preLoop = preLoop;
            this.postLoop = postLoop;

            this.keys     = new CurveKeyCollection(keys);
            this.keyFirst = (keys == null) ? null : this.keys[0];
            this.keyLast  = (keys == null) ? null : this.keys[this.keys.Count - 1];
            this.length   = (keys == null) ? 0f : keyLast.Position - keyFirst.Position;

            this.easingFunction = Evaluate;
        }
 public MyPredictionRecord(int MaxRecords, CurveLoopType PreLoopType = CurveLoopType.Linear, CurveLoopType PostLoopType = CurveLoopType.Linear)
 {
     m_curveX = new Curve();
     m_curveX.PreLoop = PreLoopType;
     m_curveX.PostLoop = PostLoopType;
     m_curveY = new Curve();
     m_curveY.PreLoop = PreLoopType;
     m_curveY.PostLoop = PostLoopType;
     m_curveZ = new Curve();
     m_curveZ.PreLoop = PreLoopType;
     m_curveZ.PostLoop = PostLoopType;
     m_maxRecords = MaxRecords;
 }
 public MyPredictionRecord(int MaxRecords, CurveLoopType PreLoopType = CurveLoopType.Linear, CurveLoopType PostLoopType = CurveLoopType.Linear)
 {
     m_curveX          = new Curve();
     m_curveX.PreLoop  = PreLoopType;
     m_curveX.PostLoop = PostLoopType;
     m_curveY          = new Curve();
     m_curveY.PreLoop  = PreLoopType;
     m_curveY.PostLoop = PostLoopType;
     m_curveZ          = new Curve();
     m_curveZ.PreLoop  = PreLoopType;
     m_curveZ.PostLoop = PostLoopType;
     m_maxRecords      = MaxRecords;
 }
示例#12
0
        public Curve3D(List<PointInTime>points,CurveLoopType type)
        {
            curveX.PostLoop = type  ;
            curveY.PostLoop = type;
            curveZ.PostLoop = type ;

            curveX.PreLoop = type ;
            curveY.PreLoop = type;
            curveZ.PreLoop = type;
               foreach(PointInTime point in points)
               {
               AddPoint(point);
               }
            this.SetTangents();
        }
示例#13
0
        /// <summary>
        /// Evaluates a position outside of the curve.
        /// </summary>
        private Single EvaluateOutside(CurveLoopType loop, CurveKey loopKey, Single loopKeyTangent, Single position)
        {
            var offset = 0f;

            switch (loop)
            {
            case CurveLoopType.Constant:
            {
                return(loopKey.Value);
            }

            case CurveLoopType.Linear:
            {
                return(loopKey.Value - loopKeyTangent * (loopKey.Position - position));
            }

            case CurveLoopType.Cycle:
            {
                var cycle = GetCycleIndex(position);
                position = position - (cycle * length);
            }
            break;

            case CurveLoopType.CycleOffset:
            {
                var cycle = GetCycleIndex(position);
                position = position - (cycle * length);
                offset   = (keyLast.Value - keyFirst.Value) * cycle;
            }
            break;

            case CurveLoopType.Oscillate:
            {
                var cycle = GetCycleIndex(position);
                position = position - (cycle * length);
                if (cycle % 2 != 0)
                {
                    position = keyFirst.Position + (length - (position - keyFirst.Position));
                }
            }
            break;
            }
            return(offset + EvaluateInside(position));
        }
示例#14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Curve{TValue, TKey}"/> class.
        /// </summary>
        /// <param name="preLoop">A <see cref="CurveLoopType"/> value indicating how the curve's values are determined
        /// for points before the beginning of the curve.</param>
        /// <param name="postLoop">A <see cref="CurveLoopType"/> value indicating how the curve's values are determined
        /// for points after the end of the curve.</param>
        /// <param name="sampler">The <see cref="ICurveSampler{TValue, TKey}"/> to use when sampling this curve's values.</param>
        /// <param name="keys">A collection of <typeparamref name="TKey"/> objects from which to construct the curve.</param>
        public Curve(CurveLoopType preLoop, CurveLoopType postLoop, ICurveSampler <TValue, TKey> sampler, IEnumerable <TKey> keys)
            : base(preLoop, postLoop)
        {
            Contract.Require(sampler, nameof(sampler));

            this.Sampler  = sampler;
            this.Keys     = new CurveKeyCollection <TValue, TKey>(keys);
            this.keyFirst = null;
            this.keyLast  = null;

            if (this.Keys.Count > 0)
            {
                this.keyFirst      = this.Keys[0].Key;
                this.StartPosition = this.keyFirst.Position;
                this.keyLast       = this.Keys[this.Keys.Count - 1].Key;
                this.EndPosition   = this.keyLast.Position;
                this.Length        = this.EndPosition - this.StartPosition;
            }
        }
        private void curveLoopToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem item = (ToolStripMenuItem)sender;

            // Set curve loopType of curves.
            // It assumes sender menuItem has a string like
            // "[Pre|Post], CurveLoopType".
            string[]      texts    = item.Tag.ToString().Split(new char[] { ',' });
            bool          preLoop  = String.Compare("pre", texts[0], true) == 0;
            CurveLoopType loopType = (CurveLoopType)Enum.Parse(
                typeof(CurveLoopType), texts[1]);

            UpdateCurves(delegate(EditCurve curve)
            {
                if (preLoop)
                {
                    curve.PreLoop = loopType;
                }
                else
                {
                    curve.PostLoop = loopType;
                }
            });
        }
示例#16
0
 public Transform2DCurve(CurveLoopType curveLoopType)
 {
     this.translationCurve = new Curve2D(curveLoopType);
     this.scaleCurve       = new Curve2D(curveLoopType);
     this.rotationCurve    = new Curve1D(curveLoopType);
 }
 public CameraPathData(CurveLoopType CurveLoopType)
 {
     heads   = new Curve3D(CurveLoopType);
     targets = new Curve3D(CurveLoopType);
     ups     = new Curve3D(CurveLoopType);
 }
示例#18
0
 /// <summary>
 /// Creates a new curve with cubic spline sampling.
 /// </summary>
 /// <param name="preLoop">A <see cref="CurveLoopType"/> value indicating how the curve's values are determined
 /// for points before the beginning of the curve.</param>
 /// <param name="postLoop">A <see cref="CurveLoopType"/> value indicating how the curve's values are determined
 /// for points after the end of the curve.</param>
 /// <param name="keys">A collection of <see cref="CubicSplineCurveKey{Single}"/> objects from which to construct the curve.</param>
 public static Curve <Single, CubicSplineCurveKey <Single> > CubicSpline(CurveLoopType preLoop, CurveLoopType postLoop, IEnumerable <CubicSplineCurveKey <Single> > keys) =>
 new Curve <Single, CubicSplineCurveKey <Single> >(preLoop, postLoop, SingleCurveCubicSplineSampler.Instance, keys);
示例#19
0
 /// <summary>
 /// Creates a new curve with step sampling.
 /// </summary>
 /// <param name="preLoop">A <see cref="CurveLoopType"/> value indicating how the curve's values are determined
 /// for points before the beginning of the curve.</param>
 /// <param name="postLoop">A <see cref="CurveLoopType"/> value indicating how the curve's values are determined
 /// for points after the end of the curve.</param>
 /// <param name="keys">A collection of <see cref="CurveKey{Single}"/> objects from which to construct the curve.</param>
 public static Curve <Single, CurveKey <Single> > Step(CurveLoopType preLoop, CurveLoopType postLoop, IEnumerable <CurveKey <Single> > keys) =>
 new Curve <Single, CurveKey <Single> >(preLoop, postLoop, SingleCurveStepSampler.Instance, keys);
示例#20
0
 /// <summary>
 /// Creates a new curve with step sampling.
 /// </summary>
 /// <param name="preLoop">A <see cref="CurveLoopType"/> value indicating how the curve's values are determined
 /// for points before the beginning of the curve.</param>
 /// <param name="postLoop">A <see cref="CurveLoopType"/> value indicating how the curve's values are determined
 /// for points after the end of the curve.</param>
 /// <param name="keys">A collection of <see cref="CurveKey{Single}"/> objects from which to construct the curve.</param>
 public static Curve <Quaternion, CurveKey <Quaternion> > Step(CurveLoopType preLoop, CurveLoopType postLoop, IEnumerable <CurveKey <Quaternion> > keys) =>
 new Curve <Quaternion, CurveKey <Quaternion> >(preLoop, postLoop, QuaternionCurveStepSampler.Instance, keys);
示例#21
0
 /// <summary>
 /// Creates a new curve with linear sampling.
 /// </summary>
 /// <param name="preLoop">A <see cref="CurveLoopType"/> value indicating how the curve's values are determined
 /// for points before the beginning of the curve.</param>
 /// <param name="postLoop">A <see cref="CurveLoopType"/> value indicating how the curve's values are determined
 /// for points after the end of the curve.</param>
 /// <param name="keys">A collection of <see cref="CurveKey{Single}"/> objects from which to construct the curve.</param>
 public static Curve <Vector4, CurveKey <Vector4> > Linear(CurveLoopType preLoop, CurveLoopType postLoop, IEnumerable <CurveKey <Vector4> > keys) =>
 new Curve <Vector4, CurveKey <Vector4> >(preLoop, postLoop, Vector4CurveLinearSampler.Instance, keys);
示例#22
0
 public Camera3DTrack(CurveLoopType curveLoopType)
 {
     this.translationCurve = new Curve3D(curveLoopType);
     this.lookCurve        = new Curve3D(curveLoopType);
     this.upCurve          = new Curve3D(curveLoopType);
 }
 public CameraPathData(CurveLoopType CurveLoopType)
 {
     heads = new Curve3D(CurveLoopType);
     targets = new Curve3D(CurveLoopType);
     ups = new Curve3D(CurveLoopType);
 }
 public Transform3DCurve(CurveLoopType curveLoopType)
 {
     translationCurve = new Curve3D(curveLoopType);
     lookCurve        = new Curve3D(curveLoopType);
     upCurve          = new Curve3D(curveLoopType);
 }
 /// <summary>
 /// CameraRecordPath
 /// </summary>
 /// <param name="screen">The screen.</param>
 /// <param name="cam">The cam.</param>
 /// <param name="CurveLoopType">Attenuation in the path curves</param>
 public CameraRecordPath(IScreen screen, ICamera cam, CurveLoopType CurveLoopType)
     : base(screen)
 {
     this.cam = cam;
     data = new CameraPathData(CurveLoopType);
 }
示例#26
0
 public Transform2DCurve(CurveLoopType curveLoopType)
 {
     this.translationCurve = new Curve2D(curveLoopType);
     this.scaleCurve = new Curve2D(curveLoopType);
     this.rotationCurve = new Curve1D(curveLoopType);
 }
示例#27
0
        /// <summary>
        /// Evaluates a position outside of the curve.
        /// </summary>
        private Single EvaluateOutside(CurveLoopType loop, CurveKey loopKey, Single loopKeyTangent, Single position)
        {
            var offset = 0f;
            switch (loop)
            {
                case CurveLoopType.Constant:
                    {
                        return loopKey.Value;
                    }

                case CurveLoopType.Linear:
                    {
                        return loopKey.Value - loopKeyTangent * (loopKey.Position - position);
                    }

                case CurveLoopType.Cycle:
                    {
                        var cycle = GetCycleIndex(position);
                        position = position - (cycle * length);
                    }
                    break;

                case CurveLoopType.CycleOffset:
                    {
                        var cycle = GetCycleIndex(position);
                        position = position - (cycle * length);
                        offset = (keyLast.Value - keyFirst.Value) * cycle;
                    }
                    break;

                case CurveLoopType.Oscillate:
                    {
                        var cycle = GetCycleIndex(position);
                        position = position - (cycle * length);
                        if (cycle % 2 != 0)
                        {
                            position = keyFirst.Position + (length - (position - keyFirst.Position));
                        }
                    }
                    break;
            }
            return offset + EvaluateInside(position);
        }
示例#28
0
 /// <summary>
 /// Creates a new curve with cubic spline sampling.
 /// </summary>
 /// <param name="preLoop">A <see cref="CurveLoopType"/> value indicating how the curve's values are determined
 /// for points before the beginning of the curve.</param>
 /// <param name="postLoop">A <see cref="CurveLoopType"/> value indicating how the curve's values are determined
 /// for points after the end of the curve.</param>
 /// <param name="keys">A collection of <see cref="CubicSplineCurveKey{Single}"/> objects from which to construct the curve.</param>
 public static Curve <Quaternion, CubicSplineCurveKey <Quaternion> > CubicSpline(CurveLoopType preLoop, CurveLoopType postLoop, IEnumerable <CubicSplineCurveKey <Quaternion> > keys) =>
 new Curve <Quaternion, CubicSplineCurveKey <Quaternion> >(preLoop, postLoop, QuaternionCurveCubicSplineSampler.Instance, keys);
示例#29
0
 /// <summary>
 /// Creates a new curve with step sampling.
 /// </summary>
 /// <param name="preLoop">A <see cref="CurveLoopType"/> value indicating how the curve's values are determined
 /// for points before the beginning of the curve.</param>
 /// <param name="postLoop">A <see cref="CurveLoopType"/> value indicating how the curve's values are determined
 /// for points after the end of the curve.</param>
 /// <param name="keys">A collection of <see cref="CurveKey{Single}"/> objects from which to construct the curve.</param>
 public static Curve <Vector2, CurveKey <Vector2> > Step(CurveLoopType preLoop, CurveLoopType postLoop, IEnumerable <CurveKey <Vector2> > keys) =>
 new Curve <Vector2, CurveKey <Vector2> >(preLoop, postLoop, Vector2CurveStepSampler.Instance, keys);
示例#30
0
 public Camera3DTrack(CurveLoopType curveLoopType)
 {
     this.translationCurve = new Curve3D(curveLoopType);
     this.lookCurve = new Curve3D(curveLoopType);
     this.upCurve = new Curve3D(curveLoopType);
 }
示例#31
0
 /// <summary>
 /// Creates a new curve with linear sampling.
 /// </summary>
 /// <param name="preLoop">A <see cref="CurveLoopType"/> value indicating how the curve's values are determined
 /// for points before the beginning of the curve.</param>
 /// <param name="postLoop">A <see cref="CurveLoopType"/> value indicating how the curve's values are determined
 /// for points after the end of the curve.</param>
 /// <param name="keys">A collection of <see cref="CurveKey{T}"/> objects from which to construct the curve.</param>
 public static Curve <ArraySegment <Single>, CurveKey <ArraySegment <Single> > > Linear(CurveLoopType preLoop, CurveLoopType postLoop, IEnumerable <CurveKey <ArraySegment <Single> > > keys) =>
 new Curve <ArraySegment <Single>, CurveKey <ArraySegment <Single> > >(preLoop, postLoop, SingleArrayCurveLinearSampler.Instance, keys);
 public Transform3DCurve(CurveLoopType curveLoopType)
 {
     this.translationCurve = new Curve3D(curveLoopType);
     this.lookCurve        = new Curve3D(curveLoopType);
     this.upCurve          = new Curve3D(curveLoopType);
 }
示例#33
0
 /// <summary>
 /// CameraRecordPath
 /// </summary>
 /// <param name="screen">The screen.</param>
 /// <param name="cam">The cam.</param>
 /// <param name="CurveLoopType">Attenuation in the path curves</param>
 public CameraRecordPath(IScreen screen, ICamera cam, CurveLoopType CurveLoopType)
     : base(screen)
 {
     this.cam = cam;
     data     = new CameraPathData(CurveLoopType);
 }
示例#34
0
 /// <summary>
 /// Creates a new curve with cubic spline sampling.
 /// </summary>
 /// <param name="preLoop">A <see cref="CurveLoopType"/> value indicating how the curve's values are determined
 /// for points before the beginning of the curve.</param>
 /// <param name="postLoop">A <see cref="CurveLoopType"/> value indicating how the curve's values are determined
 /// for points after the end of the curve.</param>
 /// <param name="keys">A collection of <see cref="CubicSplineCurveKey{Single}"/> objects from which to construct the curve.</param>
 public static Curve <Vector4, CubicSplineCurveKey <Vector4> > CubicSpline(CurveLoopType preLoop, CurveLoopType postLoop, IEnumerable <CubicSplineCurveKey <Vector4> > keys) =>
 new Curve <Vector4, CubicSplineCurveKey <Vector4> >(preLoop, postLoop, Vector4CurveCubicSplineSampler.Instance, keys);
示例#35
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Curve{TValue, TKey}"/> class.
 /// </summary>
 /// <param name="preLoop">A <see cref="CurveLoopType"/> value indicating how the curve's values are determined
 /// for points before the beginning of the curve.</param>
 /// <param name="postLoop">A <see cref="CurveLoopType"/> value indicating how the curve's values are determined
 /// for points after the end of the curve.</param>
 public Curve(CurveLoopType preLoop, CurveLoopType postLoop)
 {
     this.PreLoop  = preLoop;
     this.PostLoop = postLoop;
 }