Advertisement
Guest User

Untitled

a guest
Aug 2nd, 2015
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. n = 1000;
  2. pts = {#[[1]] Cos[#[[2]]], #[[1]] Sin[#[[2]]]} & /@
  3. Transpose[{RandomReal[{4, 6}, n], RandomReal[{0, 2 Pi}, n]}];
  4.  
  5. Needs["ComputationalGeometry`"]
  6. out = ConvexHull[pts];
  7.  
  8. q = -3 Pi/4; (*Direction*)
  9. dq = Pi/10; (*Span*)
  10.  
  11. pts1 = Select[pts[[out]], q - dq < ArcTan @@ # < q + dq &];
  12.  
  13. Graphics[{LightBlue, Disk[{0, 0}, 6, {q - dq, q + dq}],
  14. PointSize[Large], Green, Point[pts1],
  15. PointSize[Small], Black, Point[pts],
  16. Dashed, Red, Circle[{0, 0}, 4], Circle[{0, 0}, 6]}]
  17.  
  18. n2 = 40;
  19. in = Sort[pts, Norm[#1] < Norm[#2] &][[1 ;; n2]];
  20. pts2 = Select[in, q - dq < ArcTan @@ # < q + dq &];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement