Answer to a question no one asked
Dar Scott
dsc at swcp.com
Tue Jan 25 13:59:10 EST 2005
On Jan 6, 2005, at 8:40 AM, James Hurley wrote:
> What is the perpendicular distance between a point and a line?
I was grading my daughter's math papers and thought of a couple things
related to this.
1. It is possible to create the general line parameters A, B and C of
Ax + By + C =0 without any division, so no 'if' is needed. This can be
normalized by dividing by sqrt( A^2 + B^2 ), and since both A and B
can't be 0 (assuming the two points defining the line are not
identical), there is no division by zero here either.
2
If you save the line description in normal form at mouse down then you
can calculate the distance at mouseMove faster. It is simply Ax + By +
C, where (x,y) is the point of interest. This is the normalized A, B,
& C where A = cos(omega) etc., the form you mentioned in other mail.
Dar Scott
**********************************************
DSC (Dar Scott Consulting & Dar's Lab)
http://www.swcp.com/dsc/
Programming Services and Software
**********************************************
More information about the Use-livecode
mailing list