贝塞尔曲线

1.自动驾驶轨迹生成-贝塞尔(Bézier)曲线



%贝塞尔曲线

P0 = [0 1]
P1 = [1 3]
P2 = [4 6]
plot(0,1,'*');
hold on;
plot(1,3,'*');
hold on
plot(4,6,'*');
hold on

X_Res = [];
Y_Res = [];
for i =1:1:100
i = i/100;
B_X = (1-i*i)*P0(1) + 2*i*(1-i)*P1(1) + i*i*P2(1);
B_Y = (1-i*i)*P0(2) + 2*i*(1-i)*P1(2) + i*i*P2(2);
X_Res = [X_Res B_X];
Y_Res = [Y_Res B_Y];
end
plot(X_Res,Y_Res);

你可能感兴趣的:(自动驾驶,算法)