(* equazione parametrica di un'ellisse generica con 
semiassi paralleli agli assi coordinati    *)

ellisse[{x0_,y0_}][a_,b_][t_]:={x0+a*Cos[t],y0+b*Sin[t]}

ellisse[{0,0}][2,1][t]

ParametricPlot[ellisse[{0,0}][2,1][t],{t,0,2Pi}]

Manipulate[ParametricPlot[ellisse[{x0,y0}][a,b][t],{t,0,2Pi},PlotRange->{{-5,5},{-5,5}}],{{x0,0},-5,5},{{y0,0},-5,5},{{a,2},0,5},{{b,1},0,5},ControlPlacement->Right]

img1=Import["/Users/falco/Desktop/san carlino ultimi/sancarlino/foto mie/IMG_1728.JPG"]

ImageDimensions[img1]

Manipulate[ParametricPlot[ellisse[{x0,y0}][a,b][t],{t,0,2Pi},PlotRange->{{-5,5},{-5*3000/4000,5*3000/4000}}],{{x0,0},-5,5},{{y0,0},-5,5},{{a,2},0,5},{{b,1},0,5},ControlPlacement->Right]

Manipulate[GraphicsRow[{img1,ParametricPlot[ellisse[{x0,y0}][a,b][t],{t,0,2Pi},PlotRange->{{-5,5},{-5*3000/4000,5*3000/4000}}]},Spacings->-360],{{x0,0},-5,5},{{y0,0},-5,5},{{a,2},0,5},{{b,1},0,5},ControlPlacement->Right]

Manipulate[GraphicsRow[{img1,Show[{ParametricPlot[ellisse[{x0,y0}][a,b][t],{t,0,2Pi},PlotRange->{{-5,5},{-5*3000/4000,5*3000/4000}}],Plot[x^2,{x,-5,5}]}]},Spacings->-360],{{x0,0},-5,5},{{y0,0},-5,5},{{a,2},0,5},{{b,1},0,5},ControlPlacement->Right]

(* equazione parametrica della sfera di raggio 1 e centrata nell'origine: 0≤u<2Pi, -Pi/2≤v≤Pi/2 *)

sfera[u_,v_]:={Cos[u]Cos[v],Sin[u]Cos[v],Sin[v]}

sfera[u,0]

sfera[0,v]

sfera[Pi/2,v]

sfera[.3,-1.]

sfera[u,v]

{RandomReal[{0,2Pi}],RandomReal[{-Pi/2,Pi/2}]}

sfera[RandomReal[{0,2Pi}],RandomReal[{-Pi/2,Pi/2}]]

ParametricPlot3D[sfera[u,v],{u,0,2Pi},{v,-Pi/2,Pi/2}]

?Table

Table[k^2,{k,1,10}]

Graphics3D[Sphere[{0,0,0},1],Axes->True]

Graphics3D[Sphere[Table[{0,0,k},{k,1,2}],.1],Axes->True]

Graphics3D[{Red,Sphere[Table[sfera[RandomReal[{0,2Pi}],RandomReal[{-Pi/2,Pi/2}]],{k,1,500}],.02]}]

Show[{ParametricPlot3D[sfera[u,v],{u,0,2Pi},{v,-Pi/2,Pi/2}],Graphics3D[{Red,Sphere[Table[sfera[RandomReal[{0,2Pi}],RandomReal[{-Pi/2,Pi/2}]],{k,1,500}],.01]}]}]

Graphics3D[{Red,Sphere[Table[sfera[RandomReal[{0,2Pi}],RandomReal[{-Pi/2,Pi/2}]],{k,1,1000}],.01]}]

pianoxz[u_,v_]:={u,0,v}

sfera[u_,v_]:={Cos[u]Cos[v],Sin[u]Cos[v],Sin[v]}

Show[{Graphics3D[{Red,Sphere[Table[pianoxz[RandomReal[{0,2Pi}],RandomReal[{0,Pi/2}]],{k,1,100}],.1]},PlotRange->{{-2Pi,2Pi},{-2Pi,2Pi},{-2Pi,2Pi}},Axes->True,ImageSize->200],ParametricPlot3D[pianoxz[u,v],{u,-2Pi,2Pi},{v,-2Pi,2Pi},Mesh->None],ParametricPlot3D[pianoxz[0,v],{v,-2Pi,2Pi}],ParametricPlot3D[pianoxz[u,0],{u,-2Pi,2Pi}]}]

Show[{Graphics3D[{Red,Sphere[Table[2Pi*sfera[RandomReal[{-2Pi,2Pi}],RandomReal[{-2Pi,2Pi}]],{k,1,100}],.1]},PlotRange->{{-2Pi,2Pi},{-2Pi,2Pi},{-2Pi,2Pi}},Axes->True,ImageSize->200],ParametricPlot3D[2Pi*sfera[u,v],{u,-2Pi,2Pi},{v,-2Pi,2Pi},Mesh->None],ParametricPlot3D[Table[2Pi*sfera[k,v],{k,-2Pi,2Pi}],{v,-2Pi,2Pi}],ParametricPlot3D[Table[2Pi*sfera[u,k],{k,-2Pi,2Pi}],{u,-2Pi,2Pi}]}]

Show[{Graphics3D[{Red,Sphere[Table[2Pi*sfera[RandomReal[{-2Pi,2Pi}],RandomReal[{-2Pi,2Pi}]],{k,1,100}],.1]},PlotRange->{{-2Pi,2Pi},{-2Pi,2Pi},{-2Pi,2Pi}},Axes->True,ImageSize->200],ParametricPlot3D[2Pi*sfera[u,v],{u,-2Pi,2Pi},{v,-2Pi,2Pi},Mesh->None],ParametricPlot3D[Table[2Pi*sfera[k,v],{k,0,2Pi,Pi/2}],{v,-Pi/2,Pi/2}],ParametricPlot3D[Table[2Pi*sfera[u,k],{k,-2Pi,2Pi}],{u,-2Pi,2Pi}]}]

Show[{Graphics3D[{Red,Sphere[Table[pianoxz[RandomReal[{-2Pi,2Pi}],RandomReal[{-2Pi,2Pi}]],{k,1,100}],.1]},PlotRange->{{-2Pi,2Pi},{-2Pi,2Pi},{-2Pi,2Pi}},Axes->True,ImageSize->200],ParametricPlot3D[pianoxz[u,v],{u,-2Pi,2Pi},{v,-2Pi,2Pi},Mesh->None],ParametricPlot3D[Table[pianoxz[k,v],{k,-2Pi,2Pi}],{v,-2Pi,2Pi}],ParametricPlot3D[Table[pianoxz[u,k],{k,-2Pi,2Pi}],{u,-2Pi,2Pi}]}]

Show[{Graphics3D[{Red,Sphere[Table[pianoxz[RandomReal[{-2Pi,2Pi}],RandomReal[{-2Pi,2Pi}]],{k,1,100}],.1]},PlotRange->{{-2Pi,2Pi},{-2Pi,2Pi},{-2Pi,2Pi}},Axes->True,ImageSize->200],ParametricPlot3D[pianoxz[u,v],{u,-2Pi,2Pi},{v,-2Pi,2Pi},Mesh->None],ParametricPlot3D[pianoxz[0,v],{v,-2Pi,2Pi}],ParametricPlot3D[pianoxz[u,0],{u,-2Pi,2Pi}]}]

Show[{Graphics3D[{Red,Sphere[Table[pianoxz[RandomReal[{0,2Pi}],RandomReal[{0,Pi/2}]],{k,1,100}],.05]},PlotRange->{{-2Pi,2Pi},{-2Pi,2Pi},{-2Pi,Pi}},Axes->True,ImageSize->300],ParametricPlot3D[pianoxz[u,v],{u,-2Pi,2Pi},{v,-2Pi,2Pi}]}]

Graphics3D[{Red,Sphere[Table[pianoxz[RandomReal[{0,2Pi}],RandomReal[{0,Pi/2}]],{k,1,10000}],.005]}]

Graphics3D[{Red,Sphere[Table[pianoxz[RandomReal[{0,2Pi}],RandomReal[{0,Pi/2}]],{k,1,100}],.05]},PlotRange->{{-2Pi,2Pi},{-2Pi,2Pi},{-2Pi,Pi}},Axes->True,ImageSize->300]

Graphics3D[{Red,Sphere[Table[sfera[RandomReal[{0,2Pi}],RandomReal[{0,Pi/2}]],{k,1,10000}],.005]}]

dist[{x0_,y0_,z0_},{a_,b_,c_,d_}]:=Abs[a*x0+b*y0+c*z0+d]/Sqrt[a^2+b^2+c^2]

dist[{1,2,3},{0,1,0,0}]

dist[{0,0,0},{0,1,0,0}]

dist[{0,5,0},{0,1,0,0}]

nuvola=Table[sfera[RandomReal[{0,2Pi}],RandomReal[{0,Pi/2}]],{k,1,10}]

dist[{x0_,y0_,z0_},{a_,b_,c_,d_}]:=Abs[a*x0+b*y0+c*z0+d]/Sqrt[a^2+b^2+c^2]

nuvola=Table[sfera[RandomReal[{0,2Pi}],RandomReal[{0,Pi/2}]],{k,1,10000}];

sel=Select[nuvola,dist[#,{0,1,0,0}]<.0001&]

Graphics3D[{Red,Sphere[sel,.005]}]

sel=Select[nuvola,dist[#,{0,1,0,0}]<.1&];

sel[[1]]

Length[sel]

selxz=Map[Drop[#,{2}]&,sel];

selxz[[1]]

Graphics[{Red,PointSize[.001],Point[selxz]},Axes->True]

Graphics3D[{Red,Sphere[sel,.005]}]

sfera[u_,v_]:={Cos[u]Cos[v],Sin[u]Cos[v],Sin[v]}

Show[{Graphics3D[{Red,Sphere[Table[sfera[RandomReal[{0,2Pi}],RandomReal[{0,Pi/2}]],{k,1,10000}],.005]}],
ParametricPlot3D[{u,0,v},{u,-1,1},{v,0,1},Mesh->None]
}]

RandomReal[1,{3}]

Show[{ParametricPlot3D[sfera[u,v],{u,0,2Pi},{v,-Pi/2,Pi/2},PlotStyle->Opacity[.5],Mesh->None],Graphics3D[{Red,Sphere[Table[Normalize[RandomReal[{-1,1},{3}]],{k,1,10000}],.01]}]}]

ParametricPlot3D[sfera[u,v],{u,0,2Pi},{v,-Pi/2,Pi/2}]

Manipulate[ParametricPlot[ellisse[{x0,y0}][a,b][t],{t,0,2Pi},PlotRange->{{-5,5},{-5,5}},ImageSize->150],{{x0,0},-5,5},{{y0,0},-5,5},{{a,2},0,5},{{b,1},0,5}]

ParametricPlot[ellisse[{0,0}][3,2][t],{t,0,2Pi},PlotRange->{{-5,5},{-5,5}},Epilog->Point[ellisse[{0,0}][3,2][Pi/3]]]

Manipulate[ParametricPlot[ellisse[{0,0}][3,2][t],{t,0,2Pi},PlotRange->{{-5,5},{-5,5}},Epilog->Point[ellisse[{0,0}][3,2][k]]],{k,0,2Pi}]

Manipulate[ParametricPlot[ellisse[{0,0}][3,2][t],{t,0,2Pi},PlotRange->{{-5,5},{-5,5}},Epilog->{Red,PointSize[.02],Point[ellisse[{0,0}][3,2][k]]}],{k,0,2Pi}]