MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: point in convex hull


Close Ray,
works for anti-clockwise orientation, not for clockwise.

Alternative:
h = pts[[ConvexHull[pts]]];

ins[w_List,ch:{__List}] := Block[{w3=PadRight[w,3],ch3=PadRight[#,3]&/@ ch},
   SameQ @@ Sign[Last/@ (Cross @@@ Partition[((#-w3)&/@ ch3),2,1,1])]]

Check: say h = {{0,0}, {0,10}, {10,10}, {10,0}}

Table[{k,ins[{k,3},h], ins[{k,3},Reverse[h]]},{k,-5,15}]

{{-5,False,False},{-4,False,False},{-3,False,False},{-2,False,False},{-1,False,False},{0,False,False},{1,True,True},{2,True,True},{3,True,True},{4,True,True},{5,True,True},{6,True,True},{7,True,True},{8,True,True},{9,True,True},{10,False,False},{11,False,False},{12,False,False},{13,False,False},{14,False,False},{15,False,False}}

Wouter.


  • Prev by Date: Questions about Abs[_]
  • Next by Date: Re: numerical solutions to two non algebraic equations.
  • Previous by thread: Re: point in convex hull
  • Next by thread: Re: point in convex hull