Maple-Files

Bernsteinpolynome

restart: with(linalg): with(plots):
n:=20;
bern:=[seq(binomial(n,i)*t^i*(1-t)^(n-i), i=0..n)];
plot(bern, t=0..1, thickness=2, color=black);

Rationale Bezierkurve / Veränderung eines Gewichtes

restart: with(linalg): with(plots):
b0:=[0,0]: b1:=[0,1]: b2:=[1,2]: b3:=[3,0]:

poly:=[b0,b1,b2,b3]:
x0:=(1-t)^3+3*t*(1-t)^2+s*3*t^2*(1-t)+t^3;
x:=evalm(((1-t)^3*b0+3*t*(1-t)^2*b1+s*3*t^2*(1-t)*b2+t^3*b3)/x0):
p1:=plot(poly, thickness=3, color=black);
p2:=animate(plot,[[x[1],x[2],t=0..1], thickness=3, color=green],s=-1.4..10,
frames=100);
p3:=animate(plot,[[seq(subs(t=i/10, [x[1],x[2]]), i=0..10)], thickness=3,
color=red, style=point,symbol=circle, symbolsize=20],s=-1.4..10, frames=100);
#Nenner:
animate(plot,[x0, t=0..1, -1..6], s=-1.4..10, thickness=3);
# Basisfunktionen
animate(plot,[[t^3/x0, s*3*t^2*(1-t)/x0, 3*t*(1-t)^2/x0, (1-t)^3/x0],
t=0..1, -1..1, thickness=3, color=[red,green,blue,cyan]], s=-1.4..10,
frames=100);
# Kurve
display(p1,p2,p3,scaling=constrained, view=[-1..4, -3..3]);

Bezierkurven - Algorithmus von de Casteljau

restart: with(linalg): with(plots):
b:=array(0..3);
for i from 0 to 3 do
b[0][i]:=[rand(50)()+200*cos(i), rand(100)()+200*sin(i)];
od;
p1:=plot([b[0][0],b[0][1],b[0][2],b[0][3]], thickness=3, color=black):
for i from 1 to 3 do
for j from 0 to 3-i do
b[i][j]:=convert(evalm((1-t)*b[i-1][j]+t*b[i-1][j+1]), list);
od;
od;
evalm(b[0][2]);
evalm(b[1][0]);
p2:=animate(plot,[[b[1][0],b[1][1],b[1][2]], thickness=3, color=blue], t=0..1,
frames=100):
p3:=animate(plot,[[b[2][0],b[2][1]], thickness=3, color=green], t=0..1,
frames=100):
p4:=plot([b[3][0][1],b[3][0][2], t=0..1], color=red, thickness=3):
p5:=animate(plot,[[b[3][0][1]+5*cos(s),b[3][0][2]+5*sin(s), s=0..2*Pi],
color=red, thickness=3], t=0..1, frames=100):
display(p1,p2,p3,p4, p5,scaling=constrained);

Evolute eine Kurve

restart: with(linalg): with(plots):
b:=array(0..3);
for i from 0 to 3 do
b[i]:=[20*i+rand(40)()-20, rand(80)()-40];
od;
x:=convert(evalm(sum(binomial(3,ii)*t^ii*(1-t)^(3-ii)*b[ii], ii=0..3)),list);
xd:=map(diff,x,t);xdd:=map(diff,xd,t);
kappa:=(xd[1]*xdd[2]-xd[2]*xdd[1])/sqrt(xd[1]^2+xd[2]^2)^3:
n:=evalm([-xd[2],xd[1]]/sqrt(xd[1]^2+xd[2]^2)):
m:=convert(evalm(x+1/kappa*n),list):
p1:=plot([[x[1],x[2], t=0..1],[m[1],m[2],t=0..1]], view=[-20..80, -40..40],
scaling=constrained, thickness=3):
p2:=animate(plot,[[m[1]+cos(s)/kappa, m[2]+sin(s)/kappa, s=0..2*Pi],
color=blue, thickness=3], t=0..1, frames=100):
p3:=animate(plot,[[m[1]+1*cos(s), m[2]+1*sin(s), s=0..2*Pi], color=blue,
thickness=3], t=0..1, frames=100):
display(p1,p2,p3, axes=boxed);

Parallelkurven und Evolute einer Parabel - Animation

restart: with(linalg): with(plots):
x:=[t,0.5*t^2]:
xd:=map(diff,x,t): xdd:=map(diff,x,t$2):
kappa:=(xd[1]*xdd[2]-xd[2]*xdd[1])/sqrt(xd[1]^2+xd[2]^2)^3:
n:=evalm([-xd[2],xd[1]]/sqrt(xd[1]^2+xd[2]^2)):
m:=convert(evalm(x+1/kappa*n),list);
p1:=plot({[x[1],x[2],t=-2..2], [m[1],m[2],t=-1..1]}, thickness=3,
scaling=constrained, color=[red,green]);
xo:=evalm(x+d*n):
p2:=animate(plot,[[xo[1],xo[2],t=-2..2], thickness=3, color=black], d=-1..2.5,
frames=100);
display3d(p1,p2);

Bezierkurven - Veränderung des Kontrollpolygons und Vergleich mit Lagrange-Kurven (Animation)

restart: with(linalg): with(plots):
b0:=[0,0]: b1:=[0,1]: b2:=[1,1]: b3:=[1+1.5*cos(s),1.5*sin(s)]:
#b0:=[0,0]: b1:=[0,1]: b2:=[1+1.5*cos(s),1+1.5*sin(s)]: b3:=[1,0]:
poly:=[b0,b1,b2,b3]:
x:=evalm((1-t)^3*b0+2*t*(1-t)^2*b1+2*t^2*(1-t)*b2+t^3*b3):
f0:=(t-1/3)*(t-2/3)*(t-3/3)/(0-1/3)/(0-2/3)/(0-3/3);
f1:=(t-0)*(t-2/3)*(t-3/3)/(1/3-0)/(1/3-2/3)/(1/3-3/3);
f2:=(t-0)*(t-1/3)*(t-3/3)/(2/3-0)/(2/3-1/3)/(2/3-3/3);
f3:=(t-0)*(t-1/3)*(t-2/3)/(3/3-0)/(3/3-1/3)/(3/3-2/3);
y:=evalm(f0*b0+f1*b1+f2*b2+f3*b3):
p1:=animate(plot,[poly, thickness=3, color=black],s=0..2*Pi, frames=100):
p2:=animate(plot,[[x[1],x[2],t=0..1], thickness=3, color=green],s=0..2*Pi,
frames=100):
p3:=animate(plot,[[y[1],y[2],t=0..1], thickness=3, color=red],s=0..2*Pi,
frames=100):
display(p1,p2,p3,scaling=constrained);


Johannes Kepler Universität Linz, Institut für Angewandte Geometrie, Altenberger Str.69, 4040 Linz