Kardioide.
En kardioide er den kurve, der beskrives af et fast punkt på en cirkel, når den ruller uden på en anden cirkel med samme radius. Navnet kommer af, at kurven er “hjerteformet”. Du kan starte rulningen ved at trykke på “PLAY”.
Figure figure = Position [0,0] Size[x,y] Origin[x/2,y/2] Unit x/10 Color "white";
Axes axes = Color "black";
Grid grid = Color "blue";
//Units units = Color "black";
Timer tid = From 0 To 2*pi Step pi/360 Tick 10;
RadioButton playbutton = Text [ "Play"; "Stop" ] Action [ start tid; stop tid ]
Position [20,20] Size [80,25];
PushButton resetbutton = Text "Rewind" Action reset tid, reset playbutton Position [20,60] Size [80,25];
Variable R = 1;
Variable r = 1;
Circle wheel1 = Center [0,0] Radius R Size 1.5 Color "blue";
Point center1 = [0,0] Size 2.5 Color "blue";
Circle wheel2 = Center [cos(tid),sin(tid)]*(R+r) Radius r Size 1.5 Color "blue";
Point center2 = [cos(tid),sin(tid)]*(R+r) Size 2.5 Color "blue";
Point tracer = [cos(tid),sin(tid)]*(R+r)+[cos((R/r+1)*tid),sin((R/r+1)*tid)]*r Size 2.5 Color "red";
//Line l1 = Start center1 Dir center2-center1 Size 1.5 Color "blue";
Line l2 = Start center2 Dir tracer-center2 Size 1.5 Color "blue";
ParametricCurve epicykloid = [cos(t),sin(t)]*(R+r) + [cos((R/r+1)*t),sin((R/r+1)*t)]*r From 0 To tid Size 1.5 Color "red";