Beispiel #1
0
        public static List <SplineVertexData> ToEvenSplinePointArray(Spline spline, float spacing)
        {
            float num  = 0f;
            float a    = 0.0001f;
            float num2 = 0f;
            List <SplineVertexData> list = new List <SplineVertexData>
            {
                new SplineVertexData(spline.GetPoint(0f), spline.GetNormal(0f), spline.GetDirection(0))
            };
            Vector3 b      = spline.GetPoint(0f);
            Vector3 vector = Vector3.zero;

            while (num < 1f)
            {
                while (num2 < spacing && num < 1f)
                {
                    num   += Mathf.Min(a, 1f - num);
                    vector = spline.GetPoint(num);
                    num2  += (vector - b).magnitude;
                    b      = vector;
                }
                num2 -= spacing;
                list.Add(new SplineVertexData(spline.GetPoint(num), spline.GetNormal(num), spline.GetDirection(num)));
            }
            return(list);
        }
Beispiel #2
0
        public static List <Vector3> ToEvenPointArray(Spline spline, float spacing, bool includeEdge = false)
        {
            float          num  = 0f;
            float          a    = 0.0001f;
            float          num2 = 0f;
            List <Vector3> list = new List <Vector3>
            {
                spline.GetPoint(0f)
            };
            Vector3 b      = spline.GetPoint(0f);
            Vector3 vector = Vector3.zero;

            while (num < 1f)
            {
                while (num2 < spacing && num < 1f)
                {
                    num   += Mathf.Min(a, 1f - num);
                    vector = spline.GetPoint(num);
                    num2  += (vector - b).magnitude;
                    b      = vector;
                }
                if (num2 >= spacing || includeEdge)
                {
                    list.Add(vector);
                }
                num2 -= spacing;
            }
            return(list);
        }
Beispiel #3
0
 public static List <SplineVertexData> ToEvenSplinePointArray(Spline spline, int count)
 {
     count = Mathf.Max(count, 2);
     if (count == 2)
     {
         return(new List <SplineVertexData>
         {
             new SplineVertexData(spline.GetPoint(0f), spline.GetNormal(0f), spline.GetDirection(0)),
             new SplineVertexData(spline.GetPoint(1f), spline.GetNormal(1f), spline.GetDirection(1))
         });
     }
     return(SplineUtils.ToEvenSplinePointArray(spline, spline.GetLength() / (float)(count - 1)));
 }
Beispiel #4
0
 public static List <Vector3> ToEvenPointArray(Spline spline, int count)
 {
     count = Mathf.Max(count, 2);
     if (count == 2)
     {
         return(new List <Vector3>
         {
             spline.GetPoint(0f),
             spline.GetPoint(1f)
         });
     }
     return(SplineUtils.ToEvenPointArray(spline, spline.GetLength() / (float)(count - 1), false));
 }
Beispiel #5
0
        ///<summary>
        /// Creates points of Interpolation
        ///<summary>
        public Vector3 GetPoint(float t)         // This "T Value" acts as an Interpolator; to oscillate between 0 and 1
        {
            int num;

            if (t >= 1f)
            {
                t   = 1f;
                num = this.points.Length - 4;
            }
            else
            {
                t    = Mathf.Clamp01(t) * (float)this.CurveCount;              // The Curve Count is oscillated between 0 and 1
                num  = (int)t;
                t   -= (float)num;
                num *= 3;
            }
            return(base.transform.TransformPoint(Spline.GetPoint(this.points[num].point, this.points[num + 1].point, this.points[num + 2].point, this.points[num + 3].point, t)));            // The Transform Point of the Interpolated Mesh will return the default Spline Points
        }