public bool IsPointSetCross(Point2DSet pSet) { double delta = 0.1; for (double d = 0; d < pSet.Count - 1 + delta; d += delta) { if (this.IsPointIn(pSet[d])) { return(true); } } return(false); }
public Point2DSet GetOffset(double offset) { List <Point2D> listPt = new List <Point2D>(); if (points.Count <= 0) { //return null; } else if (points.Count == 1) { Point2D pt = new Point2D(points[0].x + offset, points[0].y); listPt.Add(pt); } else if (points.Count == 2) { listPt = GetOffsetSeg(points[0], points[1], offset); } else { Point2D pt1 = GetOffsetSeg(points[0], points[1], offset)[0]; listPt.Add(pt1); for (int count = 1; count <= points.Count - 1; count++) { if (count == points.Count - 1) { Point2D pt = GetOffsetSeg(points[count - 1], points[count], offset)[1]; listPt.Add(pt); } else { Point2D p10 = GetOffsetSeg(points[count - 1], points[count], offset)[0]; Point2D p11 = GetOffsetSeg(points[count - 1], points[count], offset)[1]; Point2D p20 = GetOffsetSeg(points[count], points[count + 1], offset)[0]; Point2D p21 = GetOffsetSeg(points[count], points[count + 1], offset)[1]; Point2D d0 = new Point2D(p11.x - p10.x, p11.y - p10.y); Point2D d1 = new Point2D(p20.x - p21.x, p20.y - p21.y); listPt.Add(GetIntersection(p10, p21, d0, d1)); } } } Point2DSet ptSet = new Point2DSet(listPt); return(ptSet); }