Orchard visibility problem
Orchard visibility problem
Diego Ramos
In[]:=
OrchartVisibilityProblem[]=Manipulate[Graphics[{{Black,Point[{0,0}]},{RGBColor[0.94,0.89,0.19],Disk[#,r]&/@TreePositions},{Brown,Circle[#,r]&/@TreePositions},Circle[{0,0},13],If[highlight,{Pink,Opacity[.5],Disk[#,.5]&/@(Which[0<=t<π/2||3π/2<t<=2π,Select[TreePositions,Tan[t]#[[1]]+r/Cos[t]>#[[2]]>Tan[t]#[[1]]-r/Cos[t]&],t==π/2||t==3π/2,Select[TreePositions,#[[1]]==0&],π/2<t<π||π<=t<3π/2,Select[TreePositions,Tan[t]#[[1]]+r/Cos[t]<#[[2]]<Tan[t]#[[1]]-r/Cos[t]&]])},{}],{Orange,Dashed,InfiniteLine[{0,0},{Cos[t],Sin[t]}]}},PlotRange->15,Background->LightGreen,AspectRatio->Automatic,ImageSize->420,PlotLabel->Column[{Row[{Style["threshold for non existence of visibility lines:",Bold]," radii of trees > "<>ToString[1/13//N]}],Row[{Style["threshold for existence of visibility lines:",Bold]," radii of trees < "<>ToString[1/Sqrt[13^2+1]//N]}]}]],{{t,0,"angle of sight"},0,2π,ImageSize->Small},{{r,.08,"radii of trees"},0.01,.49,ImageSize->Small},{{highlight,True,"highlight blocking trees"},{True,False}},Initialization:>(TreePositions=DeleteCases[Select[Flatten[Outer[List,Range[-13,13],Range[-13,13]],1],Norm[#]<=13&],{0,0}]),ControlPlacement->Left]
Out[]=

