public double Dist(clsLine l1) { clsLine l2 = default(clsLine); clsLine l3 = default(clsLine); l2 = l1.Normal(); l3 = new clsLine(l1.P1, this); return(Abs(l2.Dot(l3))); }
public static double Dist(clsPoint p1, clsLine l1) { //+ve for outside the wall, left handed; Also, +ve for above straight. clsLine l2 = new clsLine(); clsLine l3 = new clsLine(); l2 = (clsLine)l1.Normal(); l3 = new clsLine(l1.P1, p1); return(l2.Dot(l3)); }
public static clsPoint ProjectPoint(clsPoint p1, clsLine l1) { double d = 0; clsPoint pt1 = new clsPoint(); clsLine l2 = new clsLine(); d = Dist(p1, l1); pt1 = p1.Copy(); l2 = (clsLine)l1.Normal(); l2.Normalise(); l2.Scale(-d); pt1.Move(l2.P2.X, l2.P2.Y); return(pt1); }