def bezier_point(p, t):
<EOL>try:<EOL><INDENT>p.large_arc<EOL>return p.point(t)<EOL><DEDENT>except:<EOL><INDENT>pass<EOL><DEDENT>deg = len(p) - <NUM_LIT:1><EOL>if deg == <NUM_LIT:3>:<EOL><INDENT>return p[<NUM_LIT:0>] + t*(<EOL><NUM_LIT:3>*(p[<NUM_LIT:1>] - p[<NUM_LIT:0>]) + t*(<EOL><NUM_LIT:3>*(p[<NUM_LIT:0>] + p[<NUM_LIT:2>]) - <NUM_LIT:6>*p[<NUM_LIT:1>] + t*(<EOL>-p[<NUM_LIT:0>] + <NUM_LIT:3>*(p[<NUM_LIT:1>] - p[<NUM_LIT:2>]) + p[<NUM_LIT:3>])))<EOL><DEDENT>elif deg == <NUM_LIT:2>:<EOL><INDENT>return p[<NUM_LIT:0>] + t*(<EOL><NUM_LIT:2>*(p[<NUM_LIT:1>] - p[<NUM_LIT:0>]) + t*(<EOL>p[<NUM_LIT:0>] - <NUM_LIT:2>*p[<NUM_LIT:1>] + p[<NUM_LIT:2>]))<EOL><DEDENT>elif deg == <NUM_LIT:1>:<EOL><INDENT>return p[<NUM_LIT:0>] + t*(p[<NUM_LIT:1>] - p[<NUM_LIT:0>])<EOL><DEDENT>elif deg == <NUM_LIT:0>:<EOL><INDENT>return p[<NUM_LIT:0>]<EOL><DEDENT>else:<EOL><INDENT>bern = bernstein(deg, t)<EOL>return sum(bern[k]*p[k] for k in range(deg+<NUM_LIT:1>))<EOL><DEDENT>
Evaluates the Bezier curve given by it's control points, p, at t.
    Note: Uses Horner's rule for cubic and lower order Bezier curves.
    Warning:  Be concerned about numerical stability when using this function
    with high order curves.