Section.getCoordAtT C# (CSharp) Method

getCoordAtT() public method

public getCoordAtT ( float absoluteTime ) : Vector3
absoluteTime float
return Vector3
    public Vector3 getCoordAtT(float absoluteTime)
    {
        float relativeTime = absoluteTime - t_upToHere; // within section
        float s_add = 0;

        switch (type) {
            case Type.ACCELERATION:
                s_add = velocReducer * v_max * relativeTime + 0.5f * accel * (float) Math.Pow (relativeTime, 2);
                break;
            case Type.DECELERATION:
                s_add = v_max * relativeTime + 0.5f * accel * (float) Math.Pow (relativeTime, 2);
                break;
            case Type.CONSTANT:
                s_add = v_max * relativeTime;
                break;
            /*case Type.WAIT: //is the default case anyway
                s_add = 0;
                break;*/
        }
        float s_relative = type == Type.WAIT ? 0f : s_add / s_inSection;
        return Vector3.Lerp (sectionStartCoord, sectionEndCoord, s_relative);
    }