示例#1
0
文件: Key3.cs 项目: wjk17/WSA
        public Key3 Clone()
        {
            var n = new Key3();

            n.vector     = vector;
            n.inTangent  = inTangent;
            n.outTangent = outTangent;
            n.slope      = slope;
            n.inMode     = inMode;
            n.outMode    = outMode;
            return(n);
        }
示例#2
0
        float LenBetweenKeys(Key3 a, Key3 b)
        {
            var   factor = 1f / accuracy;
            var   prev   = a.vector;
            float len    = 0;

            for (int i = 1; i < accuracy; i++)
            {
                var curr = Evaluate(a, b, i * factor);
                len += Vector3.Distance(prev, curr);
                prev = curr;
            }
            return(len);
        }
示例#3
0
        internal void Subdivide()
        {
            if (Count != 2)
            {
                return;
            }
            var a = keys[0];
            var b = keys[1];
            var v = Evaluate(a, b, 0.5f);
            var i = Evaluate(a, b, 0.25f);
            var o = Evaluate(a, b, 0.75f);
            var k = new Key3(v, i, o);

            a.ScaleOutLen(0.5f);
            b.ScaleInLen(0.5f);
            Insert(1, k);
        }
示例#4
0
文件: Curve3.cs 项目: wjk17/WSA
        Vector3 Evaluate(Key3 a, Key3 b, float t)
        {
            var points = new Vector3[4];

            points[0] = a.vector;
            points[1] = a.outTangent;
            points[2] = b.inTangent;
            points[3] = b.vector;
            var Points3 = new Vector3[3];

            for (int i = 0; i < 3; i++)
            {
                Points3[i] = Vector3.Lerp(points[i], points[i + 1], t);
            }
            var Points2 = new Vector3[2];

            for (int i = 0; i < 2; i++)
            {
                Points2[i] = Vector3.Lerp(Points3[i], Points3[i + 1], t);
            }
            return(Vector3.Lerp(Points2[0], Points2[1], t));
        }
示例#5
0
文件: Curve3.cs 项目: wjk17/WSA
 float Slope(Key3 a, Key3 b, float t)
 {
     return(Mathf.Lerp(a.slope, b.slope, t));
 }
示例#6
0
文件: Key3.cs 项目: wjk17/WSA
 public void SetKey(Key3 k)
 {
     vector     = k.vector;
     inTangent  = k.inTangent;
     outTangent = k.outTangent;
 }