Bézierova aproximačná kubická krivka
Author: Daniela Velichova

BÉZIERova kubika je aproximačná krivka 
určená riadiacim polygónom, ktorý tvoria  
štyri body P_0, P_1, P_2, P_3, 
a štyrmi Bernsteinovými polynómami tretieho stupňa
 p_0(t), p_1(t), p_2(t), p_3(t).
Analytická reprezentácia Bézierovej kubiky je
vektorová funkcia r(t) definovaná na jednotkovom intervale v R. 

r(t) = \sum_{i=0 }^{ 3} P_i p_i(t) =P_0 (-t³ + 3 t² - 3 t + 1) + P_1 (3 t³ - 6 t² + 3 t) + P_2 (-3 t³ + 3 t²) + P_3 t³ = (x(t), y(t))

xp_3 = 2.631111111111111 (slider from 0 to 5, step 0.1)
yp_3 = 1.8839506172839506 (slider from 0 to 5, step 0.1)
yp_1 = 1.4019753086419753 (slider from 0 to 5, step 0.1)
xp_1 = 0.9125925925925926 (slider from 0 to 5, step 0.1)
yp_2 = 2.057777777777778 (slider from 0 to 5, step 0.1)
xp_2 = 1.0192592592592593 (slider from 0 to 5, step 0.1)
yp_0 = 0.8 (slider from 0 to 5, step 0.1)
xp_0 = 1.4000000000000001 (slider from 0 to 5, step 0.1)
f(x) = -x^(3.0) + 3.0 * x^(2.0) - 3.0 * x + 1.0
p_0 = Function(f, 0.0, 1.0)
f1(x) = 3.0 * x^(3.0) - 6.0 * x^(2.0) + 3.0 * x
p_1 = Function(f1, 0.0, 1.0)
f2(x) = -3.0 * x^(3.0) + 3.0 * x^(2.0)
p_2 = Function(f2, 0.0, 1.0)
f3(x) = x^(3.0)
p_3 = Function(f3, 0.0, 1.0)
r = CurveCartesian(xp_0 * (-t^(3.0) + 3.0 * t^(2.0) - 3.0 * t + 1.0) + xp_1 * (3.0 * t^(3.0) - 6.0 * t^(2.0) + 3.0 * t) + xp_2 * (-3.0 * t^(3.0) + 3.0 * t^(2.0)) + xp_3 * t^(3.0), yp_0 * (-t^(3.0) + 3.0 * t^(2.0) - 3.0 * t + 1.0) + yp_1 * (3.0 * t^(3.0) - 6.0 * t^(2.0) + 3.0 * t) + yp_2 * (-3.0 * t^(3.0) + 3.0 * t^(2.0)) + yp_3 * t^(3.0), t, 0.0, 1.0)
P = Point(r)
t = Tangent(P, r)
E = Point(t)
w = Vector(P, E)
P_0: (xp_0, yp_0)
P_1: (xp_1, yp_1)
a_1 = Segment(P_0, P_1)
P_2: (xp_2, yp_2)
b = Segment(P_1, P_2)
P_3: (xp_3, yp_3)
d = Segment(P_2, P_3)
B = Point(t)
a = Vector(P, B)
text3: "x(t)  =  " + xp_0 + "(-t^3+3t^2+3t+1)+ " + xp_1 + "(3t^3-6t^2+3t)+ " + xp_2 + "(-3t^3+3t^2)+ " + xp_3 + "t^3  "
text4: "y(t) = " + yp_0 + "(-t^3+3t^2+3t+1) + " + yp_1 + "(3t^3-6t^2+3t) + " + yp_2 + "(-3t^3+3t^2)+ " + yp_3 + "t^3"