Exemplo n.º 1
0
        public Vector3 InterpolateNormalByLen(float tl)
        {
            float localF;
            SplineControlPoint splineControlPoint = this.LenToSegment(tl, out localF);

            return(splineControlPoint.InterpolateNormal(localF));
        }
Exemplo n.º 2
0
        public SplineControlPoint LenToSegment(float t, out float localF)
        {
            SplineControlPoint splineControlPoint = null;

            t = Mathf.Clamp01(t);
            float num = t * this.mSegments[this.mSegments.Count - 1].Dist;
            int   i;

            for (i = 0; i < this.mSegments.Count; i++)
            {
                if (this.mSegments[i].Dist >= num)
                {
                    splineControlPoint = this.mSegments[i];
                    break;
                }
            }
            if (i == 0)
            {
                localF = 0f;
                return(splineControlPoint);
            }
            int index = splineControlPoint.SegmentIndex - 1;
            SplineControlPoint splineControlPoint2 = this.mSegments[index];
            float num2 = splineControlPoint.Dist - splineControlPoint2.Dist;

            localF = (num - splineControlPoint2.Dist) / num2;
            return(splineControlPoint2);
        }
Exemplo n.º 3
0
        public SplineControlPoint LenToSegment(float t, out float localF)
        {
            SplineControlPoint seg = null;

            t = Mathf.Clamp01(t);

            float len = t * mSegments[mSegments.Count - 1].Dist;


            int index = 0;

            for (index = 0; index < mSegments.Count; index++)
            {
                if (mSegments[index].Dist >= len)
                {
                    seg = mSegments[index];
                    break;
                }
            }

            if (index == 0)
            {
                //skip the first frame.
                localF = 0f;
                return(seg);
            }

            float PrevLen = 0f;
            int   prevIdx = seg.SegmentIndex - 1;
            SplineControlPoint prevSeg = mSegments[prevIdx];

            PrevLen = seg.Dist - prevSeg.Dist;
            localF  = (len - prevSeg.Dist) / PrevLen;
            return(prevSeg);
        }
Exemplo n.º 4
0
        public Vector3 InterpolateByLen(float tl)
        {
            float localF;
            SplineControlPoint seg = LenToSegment(tl, out localF);

            return(seg.Interpolate(localF));
        }
Exemplo n.º 5
0
        public SplineControlPoint LenToSegment(float t, out float localF)
        {
            SplineControlPoint splineControlPoint = null;

            t = Mathf.Clamp01(t);
            float num  = t * mSegments[mSegments.Count - 1].Dist;
            int   num2 = 0;

            for (num2 = 0; num2 < mSegments.Count; num2++)
            {
                if (mSegments[num2].Dist >= num)
                {
                    splineControlPoint = mSegments[num2];
                    break;
                }
            }
            if (num2 == 0)
            {
                localF = 0f;
                return(splineControlPoint);
            }
            float num3  = 0f;
            int   index = splineControlPoint.SegmentIndex - 1;
            SplineControlPoint splineControlPoint2 = mSegments[index];

            num3   = splineControlPoint.Dist - splineControlPoint2.Dist;
            localF = (num - splineControlPoint2.Dist) / num3;
            return(splineControlPoint2);
        }
Exemplo n.º 6
0
        public SplineControlPoint LenToSegment(float t, out float localF)
        {
            SplineControlPoint point = null;

            t = Mathf.Clamp01(t);
            float num  = t * this.mSegments[this.mSegments.Count - 1].Dist;
            int   num2 = 0;

            num2 = 0;
            while (num2 < this.mSegments.Count)
            {
                if (this.mSegments[num2].Dist >= num)
                {
                    point = this.mSegments[num2];
                    break;
                }
                num2++;
            }
            if (num2 == 0)
            {
                localF = 0f;
                return(point);
            }
            float num3 = 0f;
            int   num4 = point.SegmentIndex - 1;
            SplineControlPoint point2 = this.mSegments[num4];

            num3   = point.Dist - point2.Dist;
            localF = (num - point2.Dist) / num3;
            return(point2);
        }
Exemplo n.º 7
0
 public Vector3 PreviousPosition(SplineControlPoint controlpoint)
 {
     SplineControlPoint seg = PreviousControlPoint(controlpoint);
     if (seg != null)
         return seg.Position;
     else
         return controlpoint.Position;
 }
Exemplo n.º 8
0
 public Vector3 NextPosition(SplineControlPoint controlpoint)
 {
     SplineControlPoint seg = NextControlPoint(controlpoint);
     if (seg != null)
         return seg.Position;
     else
         return controlpoint.Position;
 }
Exemplo n.º 9
0
        public Vector3 PreviousNormal(SplineControlPoint controlpoint)
        {
            SplineControlPoint splineControlPoint = this.PreviousControlPoint(controlpoint);

            if (splineControlPoint != null)
            {
                return(splineControlPoint.Normal);
            }
            return(controlpoint.Normal);
        }
Exemplo n.º 10
0
        private Vector3 GetNext2Position()
        {
            SplineControlPoint nextControlPoint = this.NextControlPoint;

            if (nextControlPoint != null)
            {
                return(nextControlPoint.NextPosition);
            }
            return(this.NextPosition);
        }
Exemplo n.º 11
0
        private Vector3 GetNext2Normal()
        {
            SplineControlPoint nextControlPoint = this.NextControlPoint;

            if (nextControlPoint != null)
            {
                return(nextControlPoint.NextNormal);
            }
            return(this.Normal);
        }
Exemplo n.º 12
0
        public Vector3 NextNormal(SplineControlPoint controlpoint)
        {
            SplineControlPoint splineControlPoint = this.NextControlPoint(controlpoint);

            if (splineControlPoint != null)
            {
                return(splineControlPoint.Normal);
            }
            return(controlpoint.Normal);
        }
Exemplo n.º 13
0
        Vector3 GetNext2Position()
        {
            SplineControlPoint cp = NextControlPoint;

            if (cp != null)
            {
                return(cp.NextPosition);
            }
            return(NextPosition);
        }
Exemplo n.º 14
0
        public Vector3 PreviousPosition(SplineControlPoint controlpoint)
        {
            SplineControlPoint splineControlPoint = this.PreviousControlPoint(controlpoint);

            if (splineControlPoint != null)
            {
                return(splineControlPoint.Position);
            }
            return(controlpoint.Position);
        }
Exemplo n.º 15
0
        public Vector3 NextPosition(SplineControlPoint controlpoint)
        {
            SplineControlPoint splineControlPoint = this.NextControlPoint(controlpoint);

            if (splineControlPoint != null)
            {
                return(splineControlPoint.Position);
            }
            return(controlpoint.Position);
        }
Exemplo n.º 16
0
        public SplineControlPoint PreviousControlPoint(SplineControlPoint controlpoint)
        {
            if (mControlPoints.Count == 0) return null;

            int i = controlpoint.ControlPointIndex - 1;
            if (i < 0)
                return null;
            else
                return mControlPoints[i];
        }
Exemplo n.º 17
0
        public SplineControlPoint NextControlPoint(SplineControlPoint controlpoint)
        {
            if (mControlPoints.Count == 0) return null;

            int i = controlpoint.ControlPointIndex + 1;
            if (i >= mControlPoints.Count)
                return null;
            else
                return mControlPoints[i];
        }
Exemplo n.º 18
0
        public Vector3 NextPosition(SplineControlPoint controlpoint)
        {
            var point = NextControlPoint(controlpoint);

            if (point != null)
            {
                return(point.Position);
            }

            return(controlpoint.Position);
        }
Exemplo n.º 19
0
        public Vector3 PreviousNormal(SplineControlPoint controlpoint)
        {
            var point = PreviousControlPoint(controlpoint);

            if (point != null)
            {
                return(point.Normal);
            }

            return(controlpoint.Normal);
        }
Exemplo n.º 20
0
        public Vector3 PreviousPosition(SplineControlPoint controlpoint)
        {
            var point = PreviousControlPoint(controlpoint);

            if (point != null)
            {
                return(point.Position);
            }

            return(controlpoint.Position);
        }
Exemplo n.º 21
0
        public Vector3 NextNormal(SplineControlPoint controlpoint)
        {
            var point = NextControlPoint(controlpoint);

            if (point != null)
            {
                return(point.Normal);
            }

            return(controlpoint.Normal);
        }
Exemplo n.º 22
0
        public SplineControlPoint AddControlPoint(Vector3 pos, Vector3 up)
        {
            SplineControlPoint item = new SplineControlPoint();

            item.Init(this);
            item.Position = pos;
            item.Normal   = up;
            this.mControlPoints.Add(item);
            item.ControlPointIndex = this.mControlPoints.Count - 1;
            return(item);
        }
Exemplo n.º 23
0
        public SplineControlPoint AddControlPoint(Vector3 pos, Vector3 up)
        {
            SplineControlPoint splineControlPoint = new SplineControlPoint();

            splineControlPoint.Init(this);
            splineControlPoint.Position = pos;
            splineControlPoint.Normal   = up;
            this.mControlPoints.Add(splineControlPoint);
            splineControlPoint.ControlPointIndex = this.mControlPoints.Count - 1;
            return(splineControlPoint);
        }
Exemplo n.º 24
0
        Vector3 GetNext2Normal()
        {
            SplineControlPoint cp = NextControlPoint;

            if (cp != null)
            {
                return(cp.NextNormal);
            }


            return(Normal);
        }
Exemplo n.º 25
0
        public Vector3 PreviousNormal(SplineControlPoint controlpoint)
        {
            SplineControlPoint seg = PreviousControlPoint(controlpoint);

            if (seg != null)
            {
                return(seg.Normal);
            }
            else
            {
                return(controlpoint.Normal);
            }
        }
Exemplo n.º 26
0
        public Vector3 NextNormal(SplineControlPoint controlpoint)
        {
            SplineControlPoint seg = NextControlPoint(controlpoint);

            if (seg != null)
            {
                return(seg.Normal);
            }
            else
            {
                return(controlpoint.Normal);
            }
        }
Exemplo n.º 27
0
        public Vector3 NextPosition(SplineControlPoint controlpoint)
        {
            SplineControlPoint seg = NextControlPoint(controlpoint);

            if (seg != null)
            {
                return(seg.Position);
            }
            else
            {
                return(controlpoint.Position);
            }
        }
Exemplo n.º 28
0
        public Vector3 PreviousPosition(SplineControlPoint controlpoint)
        {
            SplineControlPoint seg = PreviousControlPoint(controlpoint);

            if (seg != null)
            {
                return(seg.Position);
            }
            else
            {
                return(controlpoint.Position);
            }
        }
Exemplo n.º 29
0
        public SplineControlPoint PreviousControlPoint(SplineControlPoint controlpoint)
        {
            if (this.mControlPoints.Count == 0)
            {
                return(null);
            }
            int num = controlpoint.ControlPointIndex - 1;

            if (num < 0)
            {
                return(null);
            }
            return(this.mControlPoints[num]);
        }
Exemplo n.º 30
0
        public SplineControlPoint NextControlPoint(SplineControlPoint controlpoint)
        {
            if (this.mControlPoints.Count == 0)
            {
                return(null);
            }
            int num = controlpoint.ControlPointIndex + 1;

            if (num >= this.mControlPoints.Count)
            {
                return(null);
            }
            return(this.mControlPoints[num]);
        }
Exemplo n.º 31
0
        public SplineControlPoint AddControlPoint(Vector3 pos, Vector3 up)
        {
            SplineControlPoint cp = new SplineControlPoint();

            cp.Init(this);

            cp.Position = pos;

            cp.Normal = up;

            mControlPoints.Add(cp);

            cp.ControlPointIndex = mControlPoints.Count - 1;


            return(cp);
        }
Exemplo n.º 32
0
        public SplineControlPoint NextControlPoint(SplineControlPoint controlpoint)
        {
            if (mControlPoints.Count == 0)
            {
                return(null);
            }

            int i = controlpoint.ControlPointIndex + 1;

            if (i >= mControlPoints.Count)
            {
                return(null);
            }
            else
            {
                return(mControlPoints[i]);
            }
        }
Exemplo n.º 33
0
        public SplineControlPoint PreviousControlPoint(SplineControlPoint controlpoint)
        {
            if (mControlPoints.Count == 0)
            {
                return(null);
            }

            int i = controlpoint.ControlPointIndex - 1;

            if (i < 0)
            {
                return(null);
            }
            else
            {
                return(mControlPoints[i]);
            }
        }
Exemplo n.º 34
0
        public SplineControlPoint AddControlPoint(Vector3 pos, Vector3 up)
        {
            SplineControlPoint cp = new SplineControlPoint();

            cp.Init(this);

            cp.Position = pos;

            cp.Normal = up;

            mControlPoints.Add(cp);

            cp.ControlPointIndex = mControlPoints.Count - 1;


            return cp;
        }
Exemplo n.º 35
0
 public Vector3 PreviousNormal(SplineControlPoint controlpoint)
 {
     SplineControlPoint seg = PreviousControlPoint(controlpoint);
     if (seg != null)
         return seg.Normal;
     else
         return controlpoint.Normal;
 }
Exemplo n.º 36
0
 public Vector3 NextNormal(SplineControlPoint controlpoint)
 {
     SplineControlPoint seg = NextControlPoint(controlpoint);
     if (seg != null)
         return seg.Normal;
     else
         return controlpoint.Normal;
 }
Exemplo n.º 37
0
 public Vector3 NextNormal(SplineControlPoint controlpoint)
 {
     return(NextControlPoint(controlpoint)?.Normal ?? controlpoint.Normal);
 }