Answer to a question no one asked

James Hurley jhurley at infostations.com
Fri Jan 7 10:36:46 EST 2005


>
>Message: 2
>Date: Thu, 6 Jan 2005 11:03:00 -0700
>From: Dar Scott <dsc at swcp.com>
>Subject: Re: Answer to a question no one asked
>To: How to use Revolution <use-revolution at lists.runrev.com>
>Message-ID: <33D04AFA-600D-11D9-8927-000A9567A3E6 at swcp.com>
>Content-Type: text/plain; charset=US-ASCII; format=flowed
>
>
>On Jan 6, 2005, at 8:40 AM, James Hurley wrote:
>
>>  What is the perpendicular distance between a point and a line?
>
>This is a nice example of breaking out a small general problem into a
>separate function.  Good work.
>
>
>Some nit-picking (without trying it):
>
>I think of distance as always positive.  If the abs() is needed, then
>maybe it should be pushed into the function.  The alternative of
>defining the special meaning of "distance" in this case is more work.


Dar,

Good point. One might call this signedPerpDist.

In the example given the function was used to draw a circle centered 
on a given point and tangent to a given line. Only the absolute value 
is needed there. But if one wanted to know whether an object had 
crossed a line or when two objects were on either side of a line, the 
signed distance is helpful. Never give up information. One never 
knows how it might be useful.

(The meaning of the sign is not clear, only that it is of different 
sign on either side of the line.)

>
>The names p1, p2 and p3 look like peer names, but p2 and p3 are bound
>together by being the end points of the same line segment.
>
>I stumble over abbreviations such as grc.  I'll get over it.

I have the same problem with cr.

Jim


More information about the use-livecode mailing list