export module Bezier {

    export function GetPoint(p0: console.Vec2, p1: console.Vec2, p2: console.Vec2, p3: console.Vec2, t: number): console.Vec2 {
        if (t < 0) {
            t = 0;
        }
        else if (t > 1) {
            t = 1
        }
        let OneMinusT = 1 - t;
        return p0.mul(OneMinusT * OneMinusT * OneMinusT)
            .add(p1.mul(3 * OneMinusT * OneMinusT * t))
            .add(p2.mul(3 * OneMinusT * t * t))
            .add(p3.mul(t * t * t));
    }
}