From: Roger Stafford on 9 Jul 2010 13:25 Torsten Hennig <Torsten.Hennig(a)umsicht.fhg.de> wrote in message <1987639511.93716.1278674049147.JavaMail.root(a)gallium.mathforum.org>... > In the notation of the link above, if > v1 = (v11,v12), v2 = (v21,v22), pt = (pt1,pt2) > then the point with the smallest distance to pt on > the line through v1 and v2 lies on the line segment > (v1v2) if the quantity > lambda = ((v11-v21)*(v11-pt1)+(v12-v22)*(v12-pt2))/ > ((v11-v21)^2 + (v12-v22)^2) > is between 0 and 1. > > Best wishes > Torsten. - - - - - - - - Or equivalently, if the two angles CAB and CBA I referred to earlier are each no greater than pi/2, which can be tested by: dot(C-A,B-A) >= 0 and dot(C-B,A-B) >= 0 Roger Stafford
|
Pages: 1 Prev: Convert image to binary Next: does anyone want a little Matlab work (remotely)? |