예제 #1
0
    private void BezierCubicTest(MyVector3 posA, MyVector3 posB, MyVector3 handleA, MyVector3 handleB)
    {
        //Store the interpolated values so we later can display them
        List <Vector3> interpolatedValues = new List <Vector3>();

        //Loop between 0 and 1 in steps, where 1 step is minimum
        //So if steps is 5 then the line will be cut in 5 sections
        int steps = 20;

        float t_stepSize = 1f / (float)steps;

        float t = 0f;

        //+1 becuase wa also have to include the first point
        for (int i = 0; i < steps + 1; i++)
        {
            //Debug.Log(t);

            MyVector3 interpolatedPos = BezierCubic.GetPosition(posA, posB, handleA, handleB, t);

            interpolatedValues.Add(interpolatedPos.ToVector3());

            t += t_stepSize;
        }


        //The curve
        DisplayInterpolation.DisplayCurve(interpolatedValues, useRandomColor: true);

        //The start and end values and the handle points
        DisplayInterpolation.DisplayHandle(handleA.ToVector3(), posA.ToVector3());
        DisplayInterpolation.DisplayHandle(handleB.ToVector3(), posB.ToVector3());
    }
    private void BezierCubic(MyVector3 posA, MyVector3 posB, MyVector3 handleA, MyVector3 handleB)
    {
        //Store the interpolated values so we later can display them
        List <Vector3> interpolatedValues = new List <Vector3>();

        //Loop between 0 and 1 in steps, where 1 step is minimum
        //So if steps is 5 then the line will be cut in 5 sections
        int steps = 20;

        float stepSize = 1f / (float)steps;

        float t = 0f;

        //+1 becuase wa also have to include the first point
        for (int i = 0; i < steps + 1; i++)
        {
            //Debug.Log(t);

            MyVector3 interpolatedPos = _Interpolation.BezierCubic(posA, posB, handleA, handleB, t);

            interpolatedValues.Add(interpolatedPos.ToVector3());

            t += stepSize;
        }


        //Display the curve
        DisplayInterpolatedValues(interpolatedValues, useRandomColor: true);

        //Display the start and end values and the handle points
        DisplayHandle(handleA.ToVector3(), posA.ToVector3());
        DisplayHandle(handleB.ToVector3(), posB.ToVector3());


        //Display other related data
        //Get the orientation of the point at t
        BezierCubic bezierCubic = new BezierCubic(posA, posB, handleA, handleB);

        InterpolationTransform trans = bezierCubic.GetTransform(tSliderValue);

        //Multiply the orientation with a direction vector to rotate the direction
        Vector3 forwardDir = trans.Forward.ToVector3();
        //- right vector because in this test files we are looking from above
        //so -right looks like up even though in the actual coordinate system it is -right
        Vector3 upDir = -trans.Right.ToVector3();

        Vector3 slidePos = _Interpolation.BezierCubic(posA, posB, handleA, handleB, tSliderValue).ToVector3();

        TestAlgorithmsHelpMethods.DisplayArrow(slidePos, slidePos + forwardDir * 2f, 0.2f, Color.blue);
        TestAlgorithmsHelpMethods.DisplayArrow(slidePos, slidePos + upDir * 2f, 0.2f, Color.blue);

        Gizmos.color = Color.red;

        Gizmos.DrawWireSphere(slidePos, 0.15f);
    }
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        BezierCubic bezier = (BezierCubic)target;

        GUILayout.Button("Play Tween");
        {
            (target as BezierCubic).PlayTween();
        }
    }
예제 #4
0
    private void Awake()
    {
        // Initializing
        curve = (BezierCubic)target;
        if (curve.ControlPoints == null)
        {
            curve.ResetToTemplate(Vector3.zero);
        }

        // Setting default settings
        SetDefaultDisplayMetrics();
        SetDefaultColors();
    }
예제 #5
0
        public FormMatrices()
        {
            InitializeComponent();
            StartPosition = FormStartPosition.CenterScreen;

            drawableObjects = new List <IDrawable2D>();

            // ----------------------------------------------------------------------------- //
            // Bezier cubic
            // ----------------------------------------------------------------------------- //
            bezierCubic = new BezierCubic(new Vertex(10, 10), new Vertex(90, 10), new Vertex(20, 90), new Vertex(80, 70));

            // ----------------------------------------------------------------------------- //
            // Bezier curve
            // ----------------------------------------------------------------------------- //
            bezierCurve = new BezierCurve(new Vertex(20, 20), new Vertex(80, 20));
            bezierCurve.AddControlVertex(new Vertex(40, 20));
            bezierCurve.AddControlVertex(new Vertex(40, 40));
            bezierCurve.AddControlVertex(new Vertex(20, 40));
            bezierCurve.AddControlVertex(new Vertex(20, 80));
            bezierCurve.AddControlVertex(new Vertex(80, 80));

            // ----------------------------------------------------------------------------- //
            // Aroplane
            // ----------------------------------------------------------------------------- //
            aroplane = new Aroplane();

            // ----------------------------------------------------------------------------- //
            // Point cloud
            // ----------------------------------------------------------------------------- //
            //Random rnd = new Random();

            //for (int i = 0; i < 100; i++)
            //{
            //	drawableObjects.Add(new Point2D(new Vector1x3((float)rnd.NextDouble() * 100, (float)rnd.NextDouble() * 100)));
            //}

            // start stopwatch
            stopWatch.Start();

            // set time interval for timer and enable it
            timer.Interval = 20;
            timer.Enabled  = true;
        }
예제 #6
0
    private void OnSceneGUI()
    {
        curve           = target as BezierCubic;
        handleTransform = curve.transform;
        handleRotation  = Tools.pivotRotation == PivotRotation.Local ?
                          handleTransform.rotation : Quaternion.identity;

        Vector3 p0 = ShowPoint(0);
        Vector3 p1 = ShowPoint(1);
        Vector3 p2 = ShowPoint(2);

        //Added for cubic
        Vector4 p3 = ShowPoint(3);

        //Draws the lines between all of our points.
        Handles.color = Color.gray;
        Handles.DrawLine(p0, p1);
        Handles.DrawLine(p1, p2);

        //Added for cubic
        Handles.DrawLine(p2, p3);


        Handles.color = Color.white;
        Vector3 lineStart = curve.GetPointCubic(0f);


        Handles.color = Color.green;
        Handles.DrawLine(lineStart, lineStart + curve.GetVelocityCubic(0f));
        for (int i = 1; i <= lineSteps; i++)
        {
            Vector3 lineEnd = curve.GetPointCubic(i / (float)lineSteps);
            Handles.color = Color.white;
            Handles.DrawLine(lineStart, lineEnd);
            Handles.color = Color.green;
            Handles.DrawLine(lineEnd, lineEnd + curve.GetVelocityCubic(i / (float)lineSteps));
            lineStart = lineEnd;
        }
    }
    private void BezierCubicEqualSteps(MyVector3 posA, MyVector3 posB, MyVector3 handleA, MyVector3 handleB)
    {
        //Store the interpolated values so we later can display them
        List <Vector3> actualPositions = new List <Vector3>();

        //Create a curve which is the data structure used in the following calculations
        BezierCubic bezierCubic = new BezierCubic(posA, posB, handleA, handleB);


        //Step 1. Calculate the length of the entire curve
        //This is needed to so we know how long we should walk each step
        float lengthNaive = InterpolationHelpMethods.GetLength_Naive(bezierCubic, steps: 20, tEnd: 1f);

        float lengthExact = InterpolationHelpMethods.GetLength_SimpsonsRule(bezierCubic, tStart: 0f, tEnd: 1f);

        Debug.Log("Naive length: " + lengthNaive + " Exact length: " + lengthExact);



        int steps = 5;

        //Important not to confuse this with the step size we use to iterate t
        //This step size is distance in m
        float length = lengthNaive;

        float lengthStepSize = length / (float)steps;

        float stepSize = 1f / (float)steps;

        float t = 0f;

        float distanceTravelled = 0f;

        for (int i = 0; i < steps + 1; i++)
        {
            //MyVector3 inaccuratePos = bezierCubic.GetInterpolatedValue(t);



            //Calculate t to get to this distance
            //Method 1
            //float actualT = InterpolationHelpMethods.Find_t_FromDistance_Iterative(bezierCubic, distanceTravelled, length);
            //Method 2
            float actualT = InterpolationHelpMethods.Find_t_FromDistance_Lookup(bezierCubic, distanceTravelled, accumulatedDistances: null);

            MyVector3 actualPos = bezierCubic.GetInterpolatedValue(actualT);

            actualPositions.Add(actualPos.ToVector3());



            //Test that the derivative calculations are working
            float dEst = InterpolationHelpMethods.EstimateDerivative(bezierCubic, t);
            float dAct = bezierCubic.ExactDerivative(t);

            Debug.Log("Estimated derivative: " + dEst + " Actual derivative: " + dAct);



            //Debug.Log("Distance " + distanceTravelled);

            //Move on to next iteration
            distanceTravelled += lengthStepSize;

            t += stepSize;
        }

        //List<MyVector3> positionsOnCurve = InterpolationHelpMethods.SplitCurve(bezierCubic, 20, tEnd: 1f);

        //foreach (MyVector3 p in positionsOnCurve)
        //{
        //    Gizmos.DrawWireSphere(p.ToVector3(), 0.1f);
        //}

        DisplayInterpolatedValues(actualPositions, useRandomColor: true);

        //Display the start and end values and the handle points
        DisplayHandle(handleA.ToVector3(), posA.ToVector3());
        DisplayHandle(handleB.ToVector3(), posB.ToVector3());


        //Display the actual Bezier cubic for reference
        Handles.DrawBezier(posA.ToVector3(), posB.ToVector3(), handleA.ToVector3(), handleB.ToVector3(), Color.blue, EditorGUIUtility.whiteTexture, 1f);
    }
예제 #8
0
    public override void OnInspectorGUI()
    {
        //base.OnInspectorGUI();
        if (GUI.changed)
        {
            // Update lineRenderer
            UpdateLineRenderer(IterationMode.Linear, curve.s_curveResolution);
        }

        if (curve == null)
        {
            curve = (BezierCubic)target;
        }
        SetToggleButtonStyles();

        // Instructions foldout (may be redundant - consider removing based on user editing controls)
        if (GUILayout.Button("Edit Curve", isEditing == true ? ToggleButtonStyleOn : ToggleButtonStyleOff))
        {
            isEditing = !isEditing;
            Debug.Log("Clicked Edit Curve!");
        }
        addMode = (AddMode)EditorGUILayout.EnumPopup("Add Mode: ", addMode);
        GUILayout.Space(5);
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("Undo"))
        {
            Debug.Log("Clicked Undo!");
        }
        if (GUILayout.Button("Redo"))
        {
            Debug.Log("Clicked Redo!");
        }
        GUILayout.EndHorizontal();

        #region Display Settings
        expandDisplaySettings = EditorGUILayout.Foldout(expandDisplaySettings, "Display Settings");
        if (expandDisplaySettings == true)
        {
            EditorGUI.indentLevel++;

            // Display metrics
            expandDisplaySettingsMetric = EditorGUILayout.Foldout(expandDisplaySettingsMetric, "Display Metrics");
            if (expandDisplaySettingsMetric == true)
            {
                EditorGUILayout.LabelField("Display resolution");
                EditorGUI.BeginChangeCheck();
                curve.s_curveResolution = EditorGUILayout.IntSlider("Curve Resolution", curve.s_curveResolution, 1, 100);
                EditorGUI.EndChangeCheck();
                EditorGUILayout.LabelField("Control Point Radii");
                curve.s_handlePointRadiusFixed   = EditorGUILayout.Toggle("Enforce Uniform Radii", curve.s_handlePointRadiusFixed);
                curve.s_handlePointUniformRadius = EditorGUILayout.FloatField("Uniform Radius", curve.s_handlePointUniformRadius);
                EditorGUILayout.Space();
                curve.s_handlePointAnchorRadius = EditorGUILayout.FloatField("Anchor Point Radius", curve.s_handlePointAnchorRadius);
                curve.s_handlePointAnchorDiscontinuousRadius = EditorGUILayout.FloatField("Broken Anchor Point Radius", curve.s_handlePointAnchorDiscontinuousRadius);
                curve.s_handlePointHandleRadius = EditorGUILayout.FloatField("Handle Point Radius", curve.s_handlePointHandleRadius);
                EditorGUILayout.LabelField("Widths");
                curve.s_displayWidthFixed   = EditorGUILayout.Toggle("Enforce Uniform Widths", curve.s_displayWidthFixed);
                curve.s_displayWidthUniform = EditorGUILayout.FloatField("Uniform Width", curve.s_displayWidthUniform);
                EditorGUILayout.Space();
                curve.s_displayWidthCurve     = EditorGUILayout.FloatField("Curve Width", curve.s_displayWidthCurve);
                curve.s_displayWidthTangent   = EditorGUILayout.FloatField("Tangent Width", curve.s_displayWidthTangent);
                curve.s_displayWidthNormal    = EditorGUILayout.FloatField("Normal Width", curve.s_displayWidthNormal);
                curve.s_displayWidthBitangent = EditorGUILayout.FloatField("Bitangent Width", curve.s_displayWidthBitangent);
                EditorGUILayout.LabelField("Lengths");
                curve.s_displayLengthFixed   = EditorGUILayout.Toggle("Enforce Uniform Lengths", curve.s_displayLengthFixed);
                curve.s_displayLengthUniform = EditorGUILayout.FloatField("Uniform Length", curve.s_displayLengthUniform);
                EditorGUILayout.Space();
                curve.s_displayLengthTangent   = EditorGUILayout.FloatField("Tangent Length", curve.s_displayLengthTangent);
                curve.s_displayLengthNormal    = EditorGUILayout.FloatField("Normal Length", curve.s_displayLengthNormal);
                curve.s_displayLengthBitangent = EditorGUILayout.FloatField("Bitangent Length", curve.s_displayLengthBitangent);
            }

            // Colors
            expandDisplaySettingsColor = EditorGUILayout.Foldout(expandDisplaySettingsColor, "Colors");
            if (expandDisplaySettingsColor == true)
            {
                EditorGUILayout.LabelField("Curve Colors");
                curve.s_colorCurveDefault  = EditorGUILayout.ColorField("Curve Default", curve.s_colorCurveDefault);
                curve.s_colorCurveHover    = EditorGUILayout.ColorField("Curve Hover", curve.s_colorCurveHover);
                curve.s_colorCurveClick    = EditorGUILayout.ColorField("Curve Clicked", curve.s_colorCurveClick);
                curve.s_colorCurveDisabled = EditorGUILayout.ColorField("Curve Disabled", curve.s_colorCurveDisabled);
                EditorGUILayout.LabelField("Tangent Colors");
                curve.s_colorTangentDefault  = EditorGUILayout.ColorField("Tangent Default", curve.s_colorTangentDefault);
                curve.s_colorTangentHover    = EditorGUILayout.ColorField("Tangent Hover", curve.s_colorTangentHover);
                curve.s_colorTangentClick    = EditorGUILayout.ColorField("Tangent Clicked", curve.s_colorTangentClick);
                curve.s_colorTangentDisabled = EditorGUILayout.ColorField("Tangent Disabled", curve.s_colorTangentDisabled);
                EditorGUILayout.LabelField("Normal Colors");
                curve.s_colorNormalDefault  = EditorGUILayout.ColorField("Normal Default", curve.s_colorNormalDefault);
                curve.s_colorNormalHover    = EditorGUILayout.ColorField("Normal Hover", curve.s_colorNormalHover);
                curve.s_colorNormalClick    = EditorGUILayout.ColorField("Normal Clicked", curve.s_colorNormalClick);
                curve.s_colorNormalDisabled = EditorGUILayout.ColorField("Normal Disabled", curve.s_colorNormalDisabled);
                EditorGUILayout.LabelField("Bitangent Colors");
                curve.s_colorBitangentDefault  = EditorGUILayout.ColorField("Bitangent Default", curve.s_colorBitangentDefault);
                curve.s_colorBitangentHover    = EditorGUILayout.ColorField("Bitangent Hover", curve.s_colorBitangentHover);
                curve.s_colorBitangentClick    = EditorGUILayout.ColorField("Bitangent Clicked", curve.s_colorBitangentClick);
                curve.s_colorBitangentDisabled = EditorGUILayout.ColorField("Bitangent Disabled", curve.s_colorBitangentDisabled);
                EditorGUILayout.LabelField("Anchor Point Colors");
                curve.s_colorPointAnchorDefault  = EditorGUILayout.ColorField("Anchor Point Default", curve.s_colorPointAnchorDefault);
                curve.s_colorPointAnchorHover    = EditorGUILayout.ColorField("Anchor Point Hover", curve.s_colorPointAnchorHover);
                curve.s_colorPointAnchorClick    = EditorGUILayout.ColorField("Anchor Point Clicked", curve.s_colorPointAnchorClick);
                curve.s_colorPointAnchorDisabled = EditorGUILayout.ColorField("Anchor Point Default", curve.s_colorPointAnchorDisabled);
                EditorGUILayout.LabelField("Broken Anchor Point Colors");
                curve.s_colorPointAnchorDiscontinuousDefault  = EditorGUILayout.ColorField("Broken Anchor Point Default", curve.s_colorPointAnchorDiscontinuousDefault);
                curve.s_colorPointAnchorDiscontinuousHover    = EditorGUILayout.ColorField("Broken Anchor Point Hover", curve.s_colorPointAnchorDiscontinuousHover);
                curve.s_colorPointAnchorDiscontinuousClick    = EditorGUILayout.ColorField("Broken Anchor Point Clicked", curve.s_colorPointAnchorDiscontinuousClick);
                curve.s_colorPointAnchorDiscontinuousDisabled = EditorGUILayout.ColorField("Broken Anchor Point Default", curve.s_colorPointAnchorDiscontinuousDisabled);
                EditorGUILayout.LabelField("Handle Point Colors");
                curve.s_colorPointHandleDefault  = EditorGUILayout.ColorField("Handle Point Default", curve.s_colorPointHandleDefault);
                curve.s_colorPointHandleHover    = EditorGUILayout.ColorField("Handle Point Hover", curve.s_colorPointHandleHover);
                curve.s_colorPointHandleClick    = EditorGUILayout.ColorField("Handle Point Clicked", curve.s_colorPointHandleClick);
                curve.s_colorPointHandleDisabled = EditorGUILayout.ColorField("Handle Point Disabled", curve.s_colorPointHandleDisabled);
                EditorGUILayout.LabelField("Control Polygon Colors");
                curve.s_colorControlPolygon = EditorGUILayout.ColorField("Control Polygon", curve.s_colorControlPolygon);
                curve.s_colorControlHull    = EditorGUILayout.ColorField("Control Convex Hull", curve.s_colorControlHull);
            }

            EditorGUI.indentLevel--;

            // Checking for changes
            if (GUI.changed == true)
            {
                UpdateLineRenderer(IterationMode.Linear, curve.s_curveResolution);
            }
        }
        #endregion

        GUILayout.Space(10);
        // Consider giving red color, hatched pattern, etc. to convey danger
        if (GUILayout.Button("Reset Curve"))
        {
            curve.ResetToTemplate(Vector3.zero);
            UpdateLineRendererDefault();

            SceneView.RepaintAll();
            Debug.Log("Clicked Reset Curve!");
        }
        GUI.backgroundColor = new Color(255 / 255f, 235 / 255f, 235 / 255f, 1.0f);
        if (GUILayout.Button("Remove Component"))
        {
            if (lineRenderer != null)
            {
                DestroyImmediate(lineRenderer);
            }
            DestroyImmediate(curve);

            SceneView.RepaintAll();
            Debug.Log("Clicked Remove Component!");
        }
    }
예제 #9
0
    //Uses transforms as start and end position, the length of the handles is determines by the z scale of each transform
    private void BezierCubicTest_Transform(InterpolationTransform transA, InterpolationTransform transB, float scaleA, float scaleB)
    {
        MyVector3 posA = transA.position;
        MyVector3 posB = transB.position;

        //The forward vector should move along from a to b
        MyVector3 handleA = posA + transA.Forward * scaleA;
        MyVector3 handleB = posB + -transB.Forward * scaleB;

        BezierCubic curve = new BezierCubic(posA, posB, handleA, handleB);

        //The interpolated values
        List <Vector3> positions = new List <Vector3>();
        List <float>   tValues   = new List <float>();

        //Loop between 0 and 1 in steps, where 1 step is minimum
        //So if steps is 5 then the line will be cut in 5 sections
        int steps = 30;

        float t_stepSize = 1f / (float)steps;

        float t = 0f;

        //+1 becuase wa also have to include the first point
        for (int i = 0; i < steps + 1; i++)
        {
            //Debug.Log(t);

            MyVector3 interpolatedPos = BezierCubic.GetPosition(posA, posB, handleA, handleB, t);

            positions.Add(interpolatedPos.ToVector3());

            tValues.Add(t);

            t += t_stepSize;
        }

        //Different orientation algorithms
        List <InterpolationTransform> transforms = InterpolationTransform.GetTransforms_InterpolateBetweenUpVectors(curve, tValues, transA.Up, transB.Up);

        //List<InterpolationTransform> transforms = InterpolationTransform.GetTransforms_UpRef(curve, tValues, transA.Up);

        //List<InterpolationTransform> transforms = InterpolationTransform.GetTransforms_FrenetNormal(curve, tValues);

        //List<InterpolationTransform> transforms = InterpolationTransform.GetTransforms_RotationMinimisingFrame(curve, tValues, transA.Up);


        //The curve
        DisplayInterpolation.DisplayCurve(positions, useRandomColor: true);

        //The start and end values and the handle points
        DisplayInterpolation.DisplayHandle(handleA.ToVector3(), posA.ToVector3());
        DisplayInterpolation.DisplayHandle(handleB.ToVector3(), posB.ToVector3());

        //Display transform
        DisplayInterpolation.DisplayOrientations(transforms, 1f);

        //Mesh
        Mesh extrudedMesh = ExtrudeMeshAlongCurve.GenerateMesh(transforms, meshProfile, 0.25f);

        if (extrudedMesh != null && displayMeshFilter != null)
        {
            displayMeshFilter.sharedMesh = extrudedMesh;
        }
    }
예제 #10
0
    private void BezierCubicTest_EqualSteps(MyVector3 posA, MyVector3 posB, MyVector3 handleA, MyVector3 handleB)
    {
        //Create a curve which is the data structure used in the following calculations
        BezierCubic bezierCubic = new BezierCubic(posA, posB, handleA, handleB);


        //Step 1. Calculate the length of the entire curve
        //This is needed so we know for how long we should walk each step
        float lengthNaive = InterpolationHelpMethods.GetLength_Naive(bezierCubic, steps: 20, tEnd: 1f);

        float lengthExact = InterpolationHelpMethods.GetLength_SimpsonsRule(bezierCubic, tStart: 0f, tEnd: 1f);

        //Debug.Log("Naive length: " + lengthNaive + " Exact length: " + lengthExact);


        //Step 2. Convert the t's to be percentage along the curve
        //Save the accurate t at each position on the curve
        List <float> accurateTs = new List <float>();

        //The number of sections we want to divide the curve into
        int steps = 20;

        //Important not to confuse this with the step size we use to iterate t
        //This step size is distance in m
        float curveLength = lengthNaive;

        float curveLength_stepSize = curveLength / (float)steps;

        float t_stepSize = 1f / (float)steps;

        float t = 0f;

        float distanceTravelled = 0f;

        for (int i = 0; i < steps + 1; i++)
        {
            //MyVector3 inaccuratePos = bezierCubic.GetPosition(t);

            //Calculate the t needed to get to this distance along the curve
            //Method 1
            //float accurateT = InterpolationHelpMethods.Find_t_FromDistance_Iterative(bezierCubic, distanceTravelled, length);
            //Method 2
            float accurateT = InterpolationHelpMethods.Find_t_FromDistance_Lookup(bezierCubic, distanceTravelled, accumulatedDistances: null);

            accurateTs.Add(accurateT);

            //Debug.Log(accurateT);


            //Test that the derivative calculations are working
            //float dEst = InterpolationHelpMethods.EstimateDerivative(bezierCubic, t);
            //float dAct = bezierCubic.ExactDerivative(t);

            //Debug.Log("Estimated derivative: " + dEst + " Actual derivative: " + dAct);

            //Debug.Log("Distance " + distanceTravelled);


            //Move on to next iteration
            distanceTravelled += curveLength_stepSize;

            t += t_stepSize;
        }


        //Step3. Use the new t's to get information from the curve

        //The interpolated positions
        List <Vector3> actualPositions = new List <Vector3>();
        //Save the tangent at each position on the curve
        List <Vector3> tangents = new List <Vector3>();

        //Save the orientation, which includes the tangent
        //List<InterpolationTransform> orientations = new List<InterpolationTransform>();

        for (int i = 0; i < accurateTs.Count; i++)
        {
            float accurateT = accurateTs[i];

            //Position on the curve
            MyVector3 actualPos = bezierCubic.GetPosition(accurateT);

            actualPositions.Add(actualPos.ToVector3());

            //Tangent at each position
            MyVector3 tangentDir = BezierCubic.GetTangent(posA, posB, handleA, handleB, accurateT);

            tangents.Add(tangentDir.ToVector3());

            //Orientation, which includes both position and tangent
            //InterpolationTransform orientation = InterpolationTransform.GetTransform(bezierCubic, accurateT);

            //orientations.Add(orientation);
        }


        //The orientation at each t position
        MyVector3 startUpRef = MyVector3.Up;

        List <InterpolationTransform> orientationsFrames = InterpolationTransform.GetTransforms_RotationMinimisingFrame(bezierCubic, accurateTs, startUpRef);


        //Display stuff

        //The curve which is split into steps
        //DisplayInterpolation.DisplayCurve(actualPositions, useRandomColor: true);
        DisplayInterpolation.DisplayCurve(actualPositions, Color.gray);

        //The start and end values and the handle points
        DisplayInterpolation.DisplayHandle(handleA.ToVector3(), posA.ToVector3());
        DisplayInterpolation.DisplayHandle(handleB.ToVector3(), posB.ToVector3());

        //The actual Bezier cubic for reference
        DisplayInterpolation.DisplayCurve(bezierCubic, Color.black);
        //Handles.DrawBezier(posA.ToVector3(), posB.ToVector3(), handleA.ToVector3(), handleB.ToVector3(), Color.black, EditorGUIUtility.whiteTexture, 1f);

        //The tangents
        //DisplayInterpolation.DisplayDirections(actualPositions, tangents, 1f, Color.red);

        //The orientation
        //DisplayInterpolation.DisplayOrientations(orientations, 1f);
        DisplayInterpolation.DisplayOrientations(orientationsFrames, 1f);

        //Extrude mesh along the curve
        //InterpolationTransform testTrans = orientationsFrames[1];

        //MyVector3 pos = testTrans.LocalToWorld(MyVector3.Up * 2f);
        //MyVector3 pos = testTrans.LocalToWorld(MyVector3.Right * 2f);

        //Gizmos.DrawSphere(pos.ToVector3(), 0.1f);

        //DisplayInterpolation.DisplayExtrudedMesh(orientationsFrames, meshProfile);
    }