public override void IntersectWith(GShape gShape) { IntersectionResult res; if (gShape is GLine) { res = Intersection.CurveLine(this, (GLine)gShape); if (res.IntersectionPoints.Count == 0) { return; } IntersectionResults.Add(res); } else if (gShape is GRectangle) { res = Intersection.CurveRectangle(this, (GRectangle)gShape); if (res.IntersectionPoints.Count == 0) { return; } IntersectionResults.Add(res); } else if (gShape is GCurve) { res = Intersection.CurveCurve(this, (GCurve)gShape); if (res.IntersectionPoints.Count == 0) { return; } IntersectionResults.Add(res); } }
public override void IntersectWith(GShape gShape) { IntersectionResult result; if (gShape is GLine) { foreach (var line in Lines) { result = Intersection.LineLine((GLine)gShape, line); if (result.IntersectionPoints.Count > 0) { IntersectionResults.Add(result); } } } else if (gShape is GCircle) { foreach (var line in Lines) { result = Intersection.CircleRectangle((GCircle)gShape, this); if (result.IntersectionPoints.Count == 0) { return; } IntersectionResults.Add(result); } } else if (gShape is GRectangle) { foreach (var line in Lines) { foreach (var recLine in ((GRectangle)gShape).Lines) { result = Intersection.LineLine(line, recLine); if (result.IntersectionPoints.Count == 0) { continue; } IntersectionResults.Add(result); } } } else if (gShape is GPolyLine) { foreach (var line in Lines) { foreach (var pLine in ((GPolyLine)gShape).Lines) { result = Intersection.LineLine(line, pLine); if (result.IntersectionPoints.Count == 0) { continue; } IntersectionResults.Add(result); } } } else if (gShape is GCurve) { result = Intersection.CurveRectangle((GCurve)gShape, this); if (result.IntersectionPoints.Count == 0) { return; } IntersectionResults.Add(result); } }