/// <summary> 两个方向矢量是否共线(方向相同或者相反)。。容差为用户指定的角度容差。 </summary> /// <param name="v2"></param> /// <param name="tolerance">用户指定的角度容差</param> /// <returns></returns> public bool IsCollinearWith(XY v2, double tolerance) { if ((this.AngleTo(v2) <= tolerance) || (this.AngleTo(v2.Reverse()) <= tolerance)) { return(true); } return(false); }
/// <summary> /// 无限长或者有限长的射线所代表的二维矩形方框是否能够框住指定的点 /// </summary> /// <param name="point"></param> /// <returns></returns> public bool Contains(XY point) { if (InfiniteLength) { return(InfiniteRayContains(point)); } else { Ray2D reversedRay = new Ray2D(EndPoint, Direction.Reverse(), InfiniteLength); return(reversedRay.InfiniteRayContains(point)); } }