ConicSection2=Module[{zoom,scale,center,lambda,Xmin,Xmax,Ymin,Ymax,Z,x,y,z,n,epsilon,theta,phi,F1x,F2x,PlotFocalPoints,PlotCircle,PlotRays,},
Manipulate[
scale=zoom/100;
Xmin=-center-1-3/scale;
Xmax=-center-1+3/scale;
Ymin=-3/scale;
Ymax=+3/scale;
y=Table[0.1 n,{n,1,9}];
If[epsilon==1,F1x=-1/2;F2x=-1/2,F1x=-1/(1+epsilon);F2x=-1/(1-epsilon)];
PlotFocalPoints=ListPlot[{{F1x,0},{F2x,0}},PlotMarkers->Automatic,PlotStyle->{Cyan}];
PlotCircle=ParametricPlot[{Cos[z]-1,Sin[z]},{z,-Pi, Pi},PlotRange->{{Xmin,Xmax},{Ymin,Ymax}},PlotStyle->{Dashed},AspectRatio->Automatic,ImageSize->Full];
If[epsilon==0,
theta=Table[2 ArcTan[(1-Sqrt[1-(1-epsilon^2)y[[n]]^2])/((1-epsilon)y[[n]])],{n,1,9}];
x=Table[Cos[theta[[n]]]/(1+epsilon Cos[theta[[n]]])-1/(1+epsilon),{n,1,9}];
phi=Table[2 ArcTan[Sin[theta[[n]]]/(Cos[theta[[n]]]+epsilon)],{n,1,9}];
PlotRays={
Graphics[{Red,Thickness[0.001],Arrowheads[0.015],Arrow[{{Xmin,0},{0,0}}]}],Graphics[{Red,Thickness[0.001],Arrowheads[0.015],Arrow[{{0,0},{-3,0}}]}]
};
Do[AppendTo[PlotRays,
{Graphics[{Red,Thickness[0.001],Arrowheads[0.015],Arrow[{{Xmin,y[[n]]},{x[[n]],y[[n]]}}]}],
Graphics[{Red,Thickness[0.001],Arrowheads[0.015],Arrow[{{Xmin,-y[[n]]},{x[[n]],-y[[n]]}}]}],
Graphics[{Red,Thickness[0.001],Arrowheads[0.015],Arrow[{{x[[n]],y[[n]]},{x[[n]]-(3-x[[n]])Cos[phi[[n]]],y[[n]]-(3-x[[n]])Sin[phi[[n]]]}}]}],
Graphics[{Red,Thickness[0.001],Arrowheads[0.015],Arrow[{{x[[n]],-y[[n]]},{x[[n]]-(3-x[[n]])Cos[phi[[n]]],-y[[n]]+(3-x[[n]])Sin[phi[[n]]]}}]}]
}
],{n,1,9}];
Show[
ParametricPlot[{Cos[z]/(1+epsilon Cos[z])-1/(1+epsilon),Sin[z]/(1+epsilon Cos[z])},{z,-Pi, Pi},Exclusions->{1+epsilon Cos[z]==0},PlotRange->{{Xmin,Xmax},{Ymin,Ymax}},PlotLabel->"Circle"],
PlotCircle,
PlotRays,
PlotFocalPoints,
ParametricPlot[
If[lambda<Cos[Z]/(1+epsilon Cos[Z])-1/(1+epsilon),{lambda,Sin[Z]/(1+epsilon Cos[Z])},
{Cos[Z]/(1+epsilon Cos[Z])+(lambda-(Cos[Z]/(1+epsilon Cos[Z]))+1/(1+epsilon)) ((Sin[Z]^2-(Cos[Z]+epsilon)^2)/(Sin[Z]^2+(Cos[Z]+epsilon)^2))-1/(1+epsilon),Sin[Z]/(1+epsilon Cos[Z])-(lambda-(Cos[Z]/(1+epsilon Cos[Z]))+1/(1+epsilon)) (2 Sin[Z](Cos[Z]+epsilon)/(Sin[Z]^2+(Cos[Z]+epsilon)^2))}],
{Z,-Pi/2,Pi/2},
PlotStyle->Green
],
ImageSize->Large
],
If[epsilon<1,
theta=Table[2 ArcTan[(1-Sqrt[1-(1-epsilon^2)y[[n]]^2])/((1-epsilon)y[[n]])],{n,1,9}];
x=Table[Cos[theta[[n]]]/(1+epsilon Cos[theta[[n]]])-1/(1+epsilon),{n,1,9}];
phi=Table[2 ArcTan[Sin[theta[[n]]]/(Cos[theta[[n]]]+epsilon)],{n,1,9}];
PlotRays={
Graphics[{Red,Thickness[0.001],Arrowheads[0.015],Arrow[{{Xmin,0},{0,0}}]}],Graphics[{Red,Thickness[0.001],Arrowheads[0.015],Arrow[{{0,0},{-3,0}}]}]
};
Do[AppendTo[PlotRays,
{Graphics[{Red,Thickness[0.001],Arrowheads[0.015],Arrow[{{Xmin,y[[n]]},{x[[n]],y[[n]]}}]}],
Graphics[{Red,Thickness[0.001],Arrowheads[0.015],Arrow[{{Xmin,-y[[n]]},{x[[n]],-y[[n]]}}]}],
Graphics[{Red,Thickness[0.001],Arrowheads[0.015],Arrow[{{x[[n]],y[[n]]},{x[[n]]-(3-x[[n]])Cos[phi[[n]]],y[[n]]-(3-x[[n]])Sin[phi[[n]]]}}]}],
Graphics[{Red,Thickness[0.001],Arrowheads[0.015],Arrow[{{x[[n]],-y[[n]]},{x[[n]]-(3-x[[n]])Cos[phi[[n]]],-y[[n]]+(3-x[[n]])Sin[phi[[n]]]}}]}]
}
],{n,1,9}];
Show[
ParametricPlot[{Cos[z]/(1+epsilon Cos[z])-1/(1+epsilon),Sin[z]/(1+epsilon Cos[z])},{z,-Pi, Pi},Exclusions->{1+epsilon Cos[z]==0},PlotRange->{{Xmin,Xmax},{Ymin,Ymax}},PlotLabel->"Ellipse"],
PlotCircle,
PlotRays,
PlotFocalPoints,
ParametricPlot[
If[lambda<Cos[Z]/(1+epsilon Cos[Z])-1/(1+epsilon),{lambda,Sin[Z]/(1+epsilon Cos[Z])},
{Cos[Z]/(1+epsilon Cos[Z])+(lambda-(Cos[Z]/(1+epsilon Cos[Z]))+1/(1+epsilon)) ((Sin[Z]^2-(Cos[Z]+epsilon)^2)/(Sin[Z]^2+(Cos[Z]+epsilon)^2))-1/(1+epsilon),Sin[Z]/(1+epsilon Cos[Z])-(lambda-(Cos[Z]/(1+epsilon Cos[Z]))+1/(1+epsilon)) (2 Sin[Z](Cos[Z]+epsilon)/(Sin[Z]^2+(Cos[Z]+epsilon)^2))}],
{Z,-Pi/2,Pi/2},
PlotStyle->Green
],
ImageSize->Large
],
If[epsilon>1,
Asymp=Sqrt[epsilon^2-1];
theta=Table[2 ArcTan[(1-Sqrt[1-(1-epsilon^2)y[[n]]^2])/((1-epsilon)y[[n]])],{n,1,9}];
x=Table[Cos[theta[[n]]]/(1+epsilon Cos[theta[[n]]])-1/(1+epsilon),{n,1,9}];
phi=Table[2 ArcTan[Sin[theta[[n]]]/(Cos[theta[[n]]]+epsilon)],{n,1,9}];
PlotRays={
Graphics[{Red,Thickness[0.001],Arrowheads[0.015],Arrow[{{Xmin,0},{0,0}}]}],Graphics[{Red,Thickness[0.001],Arrowheads[0.015],Arrow[{{0,0},{-3,0}}]}]
};
Do[AppendTo[PlotRays,
{Graphics[{Red,Thickness[0.001],Arrowheads[0.015],Arrow[{{Xmin,y[[n]]},{x[[n]],y[[n]]}}]}],
Graphics[{Red,Thickness[0.001],Arrowheads[0.015],Arrow[{{Xmin,-y[[n]]},{x[[n]],-y[[n]]}}]}],
Graphics[{Red,Thickness[0.001],Arrowheads[0.015],Arrow[{{x[[n]],y[[n]]},{x[[n]]-(3-x[[n]])Cos[phi[[n]]],y[[n]]-(3-x[[n]])Sin[phi[[n]]]}}]}],
Graphics[{Red,Thickness[0.001],Arrowheads[0.015],Arrow[{{x[[n]],-y[[n]]},{x[[n]]-(3-x[[n]])Cos[phi[[n]]],-y[[n]]+(3-x[[n]])Sin[phi[[n]]]}}]}]
}
],{n,1,9}];
Show[
ParametricPlot[{Cos[z]/(1+epsilon Cos[z])-1/(1+epsilon),Sin[z]/(1+epsilon Cos[z])},{z,-Pi, Pi},Exclusions->{1+epsilon Cos[z]==0},PlotRange->{{Xmin,Xmax},{Ymin,Ymax}},PlotLabel->"Hyperbola"],
PlotCircle,
Plot[{Asymp(X-(F2x+F1x)/2),-Asymp(X-(F2x+F1x)/2) },{X,Xmin,Xmax},PlotStyle->{{Green,Dashed},{Green,Dashed}}],
PlotRays,
PlotFocalPoints,
ParametricPlot[
If[lambda<Cos[Z]/(1+epsilon Cos[Z])-1/(1+epsilon),{lambda,Sin[Z]/(1+epsilon Cos[Z])},
{Cos[Z]/(1+epsilon Cos[Z])+(lambda-(Cos[Z]/(1+epsilon Cos[Z]))+1/(1+epsilon)) ((Sin[Z]^2-(Cos[Z]+epsilon)^2)/(Sin[Z]^2+(Cos[Z]+epsilon)^2))-1/(1+epsilon),Sin[Z]/(1+epsilon Cos[Z])-(lambda-(Cos[Z]/(1+epsilon Cos[Z]))+1/(1+epsilon)) (2 Sin[Z](Cos[Z]+epsilon)/(Sin[Z]^2+(Cos[Z]+epsilon)^2))}],
{Z,-Pi/2,Pi/2},
PlotStyle->Green
],
ImageSize->Large
],
theta=Table[ArcTan[2y[[n]]/(1-y[[n]]^2)],{n,1,9}];
x=Table[-y[[n]]^2/2,{n,1,9}];
phi=Table[2 ArcTan[Sin[theta[[n]]]/(Cos[theta[[n]]]+1)],{n,1,9}];
PlotRays={
Graphics[{Red,Thickness[0.001],Arrowheads[0.015],Arrow[{{Xmin,0},{0,0}}]}],Graphics[{Red,Thickness[0.001],Arrowheads[0.015],Arrow[{{0,0},{-3,0}}]}]
};
Do[AppendTo[PlotRays,
{Graphics[{Red,Thickness[0.001],Arrowheads[0.015],Arrow[{{Xmin,y[[n]]},{x[[n]],y[[n]]}}]}],
Graphics[{Red,Thickness[0.001],Arrowheads[0.015],Arrow[{{Xmin,-y[[n]]},{x[[n]],-y[[n]]}}]}],
Graphics[{Red,Thickness[0.001],Arrowheads[0.015],Arrow[{{x[[n]],y[[n]]},{x[[n]]-(3-x[[n]])Cos[phi[[n]]],y[[n]]-(3-x[[n]])Sin[phi[[n]]]}}]}],
Graphics[{Red,Thickness[0.001],Arrowheads[0.015],Arrow[{{x[[n]],-y[[n]]},{x[[n]]-(3-x[[n]])Cos[phi[[n]]],-y[[n]]+(3-x[[n]])Sin[phi[[n]]]}}]}]
}
],{n,1,9}];
Show[
ParametricPlot[{-Y^2/2,Y},{Y,Ymin, Ymax},PlotRange->{{Xmin,Xmax},{Ymin,Ymax}},PlotLabel->"Parabola"],
PlotCircle,
ParametricPlot[{0.5,Y},{Y,Ymin,Ymax},PlotStyle->{{Green,Dashed}}],
PlotRays,
PlotFocalPoints,
ParametricPlot[
If[lambda<Cos[Z]/(1+epsilon Cos[Z])-1/(1+epsilon),{lambda,Sin[Z]/(1+epsilon Cos[Z])},
{Cos[Z]/(1+epsilon Cos[Z])+(lambda-(Cos[Z]/(1+epsilon Cos[Z]))+1/(1+epsilon)) ((Sin[Z]^2-(Cos[Z]+epsilon)^2)/(Sin[Z]^2+(Cos[Z]+epsilon)^2))-1/(1+epsilon),Sin[Z]/(1+epsilon Cos[Z])-(lambda-(Cos[Z]/(1+epsilon Cos[Z]))+1/(1+epsilon)) (2 Sin[Z](Cos[Z]+epsilon)/(Sin[Z]^2+(Cos[Z]+epsilon)^2))}],
{Z,-Pi/2,Pi/2},
PlotStyle->Green
],
ImageSize->Large
]
]]],
{{epsilon,0,"Eccentricity ϵ"},0,5,0.01,Appearance->"Labeled"},
{{lambda,-5,"Wave Front Location"},-5,3},
{{zoom,100,"Zoom (%)"},100,500,1,Appearance->"Labeled"},
{{center,0,"horizontal shift"},-1,1},LabelStyle->{Directive[12],FontFamily->"Arial"},ControlPlacement->Right,ContinuousAction->True
]
]

Export["ConicSection2.cdf",ConicSection2,"CDF"]