Answer to a question no one asked

Dar Scott dsc at swcp.com
Thu Jan 6 13:03:00 EST 2005


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.

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.

Rats.  I couldn't find any divide-by-zero problems.

Dar

**********************************************
     DSC (Dar Scott Consulting & Dar's Lab)
     http://www.swcp.com/dsc/
     Programming Services and Software
**********************************************



More information about the use-livecode mailing list