public bool IsOnShortLine(clsPoint pt1, double aTol = 0, bool excludeEnds = false) { clsLine l1 = default(clsLine); clsLine l2 = default(clsLine); double d = 0; if (aTol == 0) { aTol = mdlGeometry.myTol; } if (Abs(pt1.Dist(this)) > aTol) { return(false); } l1 = new clsLine(P1, pt1); l2 = Copy(); l2.Normalise(); d = l1.Dot(l2); if (d < -aTol) { return(false); } if (d > Length + aTol) { return(false); } if (excludeEnds && (P1 == pt1 | P2 == pt1)) { return(false); } return(true); }
public clsPoint DistanceAlongLine(double d) { clsLine l1 = default(clsLine); l1 = Copy(); l1.Normalise(); return(new clsPoint(X1 + d * l1.DX(), Y1 + d * l1.DY())); }
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); }
public double VerticalHeight(clsPoint pt1) { //Returns the height of the line where is passes over p1 clsLine l1 = default(clsLine); clsLine l2 = default(clsLine); double d = 0; double d1 = 0; double d2 = 0; l1 = new clsLine(P1.X, P1.Y, P2.X, P2.Y); if (l1.IsOnLine(pt1) == false) { return(0); } d1 = l1.Length; l1.Normalise(); l2 = new clsLine(l1.P1, pt1); d2 = l1.Dot(l2); d = d2 / d1; return(P1.Z + (P2.Z - P1.Z) * d); }
public bool IsOnHalfLine(clsPoint pt1, double aTol = 0) { clsLine l1 = default(clsLine); clsLine l2 = default(clsLine); double d = 0; if (aTol == 0) { aTol = mdlGeometry.myTol; } if (Abs(pt1.Dist(this)) > aTol) { return(false); } l1 = new clsLine(P1, pt1); l2 = Copy(); l2.Normalise(); d = l1.Dot(l2); if (d < -aTol) { return(false); } return(true); }