VS:PtOnLine
.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix
Description
Determines if a point is on a line. The 1st test is: if AB + BC = AC, B is on AC.
This method is very fast, but produces an elliptical fuzz zone.
The second test measures the actual distance from the test point to the nearest point on the line. This eliminates the elliptical bulge in the fuzz zone.
FUNCTION PtOnLine(
ptX, ptY, ptZ :REAL;
begPtX, begPtY, begPtZ :REAL;
endPtX, endPtY, endPtZ :REAL;
tolerance :REAL) :BOOLEAN;
def vs.PtOnLine(pt, begPt, endPt, tolerance): return BOOLEAN
Parameters
ptX, ptY, ptZ REAL begPtX, begPtY, begPtZ REAL endPtX, endPtY, endPtZ REAL tolerance REAL
Example
PROCEDURE Example; VAR pt, beg_pt, END_pt :VECTOR; BEGIN CallTool(-221); GetLocPt(FSActLayer, pt.x, pt.y); CallTool(-201); GetSegPt1(FSActLayer, beg_pt.x, beg_pt.y); GetSegPt2(FSActLayer, END_pt.x, END_pt.y); Message(PtOnLine(pt, beg_pt, end_pt, RealDialog('Fuzz:', '1'))); END; RUN(Example);
Version
Availability: from All Versions
This is drop-in function.