|
|
On Fri, 22 Dec 2000 23:53:52 +0100, Tor Olav Kristensen wrote:
>
>Ron Parker wrote:
>>
>> On Thu, 21 Dec 2000 22:23:23 +0100, Rune wrote:
>> >How do I find the distance from the point P to the nearest point in the line
>> >segment defined by point A and point B?
>>
>> The distance to the line defined by A and B is given by
>>
>> P-A-vdot(P-A,B-A)/vlength(B-A)
>
>It seems like you are subtracting
>a scalar from a vector expression.
>
>Are you that this is the right thing
>to do here ?
Nope. That's what I get for posting without testing. The scalar should be
multiplied by the unit vector in the direction of B-A, or by (B-A)/vlength(B-A).
--
Ron Parker http://www2.fwi.com/~parkerr/traces.html
My opinions. Mine. Not anyone else's.
Post a reply to this message
|
|