Define an ellips. Rotated and moved.
In[]:=
Clear[ell,ellR,ellRV]ell[f_,a_,b_]:={aCos[f],bSin[f]};ellR[f_,a_,b_,rot_]:=RotationMatrix[rot].ell[f,a,b]ellRV[f_,a_,b_,rot_,v_]:=ellR[f,a,b,rot]+vfoc1[a_,b_,rot_,v_]:=RotationMatrix[rot].-,0+v
2
a
2
b
Determine the ellips: p2 and v1 are focii. Point p1 lies on the ellips. Calculate 30 points of it.
In[]:=
bepEll1L[p1_,p2_]:=Module[{sys,sol},sys={ellRV[f,a,b,rot,(p2+v1)/2]p1,foc1[a,b,rot,(p2+v1)/2]v1};sol=Chop@FindRoot[sys,{{f,0},{a,50},{b,60},{rot,0}}];Table[ellRV[ff,a,b,rot,(p2+v1)/2]/.sol,{ff,Subdivide[0,2π,30]}]]
Test: give the points. Calculate the points of ellips, and draw an image. Everything OK
In[]:=
v1={160,-25};v2={160,-100};p1={15,0};p2={65,0};
In[]:=
bepEll1L[p1,p2]
Graphics[{Line[{p1,p2}],Line[{v1,v2}],Blue,Line[bepEll1L[p1,p2]]},ImageSize200]
I wanted to see the ellips adapting when I move the point p1 or p2. This manipulate works.
In[]:=
Manipulate[Graphics[{Line[{p1,p2}],Line[{v1,v2}](*,bepEll1L[p1,p2]*)}],{{p1,{15,0}},Locator},{{p2,{65,0}},Locator}]
This manipulate (with the function active) crashes the kernel. (sometimes also the frontend)
Manipulate[Graphics[{Line[{p1,p2}],Line[{v1,v2}],Line[bepEll1L[p1,p2]]}],{{p1,{15,0}},Locator},{{p2,{65,0}},Locator}]