// public bool PointInObject(RgPoint point) { float thWidth = 1; for (int i = 1; i < Vertices.Count; i++) { RgPoint m_p1 = Vertices[i]; RgPoint m_p2 = Vertices[i - 1]; return(HitUtil.IsPointInLine(m_p1, m_p2, point, thWidth)); } return(false); }
/// <summary> /// 当前对象是否在包围盒内 /// </summary> /// <param name="rect"></param> /// <param name="anyPoint"></param> /// <returns></returns> public bool ObjectInRectangle(BoundingBox rect, bool anyPoint) { BoundingBox boundingrect = GetBoundingBox(); if (anyPoint) { for (int i = 1; i < Vertices.Count; i++) { RgPoint m_p1 = Vertices[i]; RgPoint m_p2 = Vertices[i - 1]; return(HitUtil.LineIntersectWithRect(m_p1, m_p2, rect)); } } return(rect.Contains(boundingrect)); }