MathGroup Archive 2005

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

Search the Archive

Re: point in convex hull

  • To: mathgroup at smc.vnet.net
  • Subject: [mg55508] Re: point in convex hull
  • From: wouter meeussen <wouter.meeussen at pandora.be>
  • Date: Sun, 27 Mar 2005 02:42:40 -0500 (EST)
  • References: <d1tvc0$rli$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

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