Пример #1
0
        public static void DrawCurveSegments(CurveSegment curve,
                                             Color color, int segments = 50)
        {
            float   interval = 1.0f / segments;
            Vector3 lastPos  = curve.Evaluate(0);

            for (int i = 1; i <= segments; i++)
            {
                float   u   = interval * (float)i;
                Vector3 pos = curve.Evaluate(u);

                UnityEngine.Debug.DrawLine(lastPos, pos, color);
                lastPos = pos;
            }
        }
Пример #2
0
        public static void DrawCurveCurvatures(CurveSegment curve,
                                               Color color, int segments = 50, float scale = 0.1f)
        {
            float interval = 1.0f / segments;

            for (int i = 0; i <= segments; i++)
            {
                float   u         = interval * (float)i;
                Vector3 pos       = curve.Evaluate(u);
                Vector3 curvature = curve.EvaluateDv2(u);

                UnityEngine.Debug.DrawLine(pos, pos + curvature * scale, color);
            }
        }