Bug={{3,6},{3,9},{3.5`,9},{4,8},{6,12},{10,15},{15,16},{17,20},{20,20.5`},{23,21},{28,20.5`},{32,19},{36,16},{39,12},{40,11.6`},{40.7`,11},{39.5`,10.8`},{41,8},{41.5`,9},{42,9},{42,6},{36,6},{35.8`,5},{35,3.5`},{34,2.5`},{32,2},{30,2.5`},{29,3.5`},{28.2`,5},{28,6},{20,6},{19.8`,5},{19,3.5`},{18,2.5`},{16,2},{14,2.5`},{13,3.5`},{12.2`,5},{12,6},{3,6}};

Manipulate[
(A:={{k,0},{0,k}})//MatrixForm;

Show[Graphics[Line[Transpose[A.Transpose[Bug]]]],PlotRange->{{-50,90},{-50,50}},PlotLabel->A."Bug"]

(*Manipulate Controllers*)
, Style["Scale the Bug by k",Bold,12],(*Title*)
{{k,1},0,2},ImageSize->Small,ControlPlacement->Left]

Manipulate[
(F:={{x[[1]],0},{0,x[[2]]}})//MatrixForm;

Show[Graphics[Line[Transpose[F.Transpose[Bug]]]],PlotRange->{{-50,90},{-50,50}},PlotLabel->F."Bug"]

(*Manipulate Controllers*)
, Style["Scale the Bug by (k,l)",Bold,12],(*Title*)
{{x,{1,1}},-1,2,ControlType->Slider2D},ImageSize->Small,ControlPlacement->Left]

Manipulate[
(G:={{x[[1]],0},{0,x[[2]]}})//MatrixForm;

Show[Graphics[Line[Transpose[G.Transpose[Bug]]]],PlotRange->{{-50,90},{-50,50}},PlotLabel->G."Bug"]

(*Manipulate Controllers*)
, Style["Bug Reflections",Bold,12],(*Title*)
{{x,{1,1}},-1,1,2,ControlType->Slider2D},ImageSize->Small,ControlPlacement->Left]

Manipulate[
(B:={{Cos[θ],-Sin[θ]},{Sin[θ],Cos[θ]}})//MatrixForm;

Show[Graphics[Line[Transpose[ B.Transpose[Bug]]]],PlotRange->{{-50,90},{-50,50}},PlotLabel-> B."Bug"]

(*Manipulate Controllers*)
, Style["Rotate the Bug by θ",Bold,12],(*Title*)
{{θ,0},-π,2π,(π/24)},ImageSize->Small,ControlPlacement->Left]

Manipulate[
(H:={{1,k},{l,1}})//MatrixForm;

Show[Graphics[Line[Transpose[H.Transpose[Bug]]]],PlotRange->{{-50,90},{-50,50}},PlotLabel->H."Bug"]

(*Manipulate Controllers*)
, Style["Bug Shear",Bold,12],(*Title*)
{{k,0,"horizontal"},0,2},{{l,0,"vertical"},0,2},ImageSize->Small,ControlPlacement->Left]

T={{{k,0},{0,k}},{{Cos[θ],-Sin[θ]},{Sin[θ],Cos[θ]}},{{1,m},{0,1}}};
Opts=Drop[Permutations[{1,2,3},3],1]
nOpts=Length[Opts];
blah={"scale","rotate","shear"};

Manipulate[
Temp=MatrixForm[T[[Opts[[i,1]]]]/.{k->x,θ->y,m->z}];
Combined=T[[Opts[[i,1]]]]/.{k->x,θ->y,m->z};
Title=blah[[Opts[[i,1]]]];

For[j=2,j≤Dimensions[Opts[[i]]][[1]],j++,

Temp=HoldForm[Evaluate[MatrixForm[T[[Opts[[i,j]]]]/.{k->x,θ->y,m->z}]]].Temp;
Combined=T[[Opts[[i,j]]]].Combined;
Title=Title<>" then "<>blah[[Opts[[i,j]]]]

];

Title="Combine transformations as follows: "<>Title;

Show[Graphics[{Line[Transpose[(Combined/.{k->x,θ->y,m->z}).Transpose[Bug]]],Text[Title,{20,-40},{0,0}]}],PlotRange->{{-50,90},{-50,50}},PlotLabel->Temp."Bug"]

(*Manipulate Controllers*)
, Style["Combine Transformations",Bold,12],(*Title*)
{{i,6,"combine"},1,nOpts,1},
{{x,1,"scale"},0,2},
{{y,0,"rotate"},0,2π},
{{z,0,"shearX"},0,2π},
ControlPlacement->Left,ImageSize->Small]

Manipulate[
u:=((p2-p1)/(Sqrt[(p2-p1).(p2-p1)]));
Proj:={{((u[[1]])^2),u[[1]]u[[2]]},{u[[1]]u[[2]],((u[[2]])^2)}};


Graphics[{Line[{p1,p2}],{Dashed, Gray,Line[Bug]}(*,{Red,Arrow[{p1,10u}]}*),{Green,Thick,Line[Transpose[Proj.Transpose[Bug]]]}},PlotRange->{{-50,90},{-50,50}},PlotLabel->Proj."Bug"],

{{p1,{0,0}},Locator},{{p2,{80,0}},Locator}, Style["Projection of the Bug onto the Line",Bold,12]]

Manipulate[
u:=((p2-p1)/(Sqrt[(p2-p1).(p2-p1)]));
Ref:={{((u[[1]])^2)-((u[[2]])^2),2u[[1]]u[[2]]},{2u[[1]]u[[2]],((u[[2]])^2)-((u[[1]])^2)}};


Graphics[{Line[{p1,p2}],{Dashed, Gray,Line[Bug]}(*,{Red,Arrow[{p1,10u}]}*),{Green,Thick,Line[Transpose[Ref.Transpose[Bug]]]}},PlotRange->{{-50,90},{-50,50}},PlotLabel->Ref."Bug"],

{{p1,{0,0}},Locator},{{p2,{80,0}},Locator}, Style["Projection of the Bug onto the Line",Bold,12]]