示例#1
0
        public override void IntersectWith(GShape gShape)
        {
            if (gShape is GCircle)
            {
                var res = Intersection.CircleLine((GCircle)gShape, this);

                if (res.IntersectionPoints.Count > 0)
                {
                    IntersectionResults.Add(res);
                }
            }
            else if (gShape is GLine)
            {
                var res = Intersection.LineLine((GLine)gShape, this);

                if (res.IntersectionPoints.Count > 0)
                {
                    IntersectionResults.Add(res);
                }
            }

            else if (gShape is GRectangle)
            {
                foreach (var line in ((GRectangle)gShape).Lines)
                {
                    var res = Intersection.LineLine(line, this);

                    if (res.IntersectionPoints.Count > 0)
                    {
                        IntersectionResults.Add(res);
                    }
                }
            }
            else if (gShape is GPolyLine)
            {
                foreach (var line in ((GPolyLine)gShape).Lines)
                {
                    var res = Intersection.LineLine(line, this);

                    if (res.IntersectionPoints.Count > 0)
                    {
                        IntersectionResults.Add(res);
                    }
                }
            }
            else if (gShape is GCurve)
            {
                var res = Intersection.CurveLine((GCurve)gShape, this);
                if (res.IntersectionPoints.Count == 0)
                {
                    return;
                }
                IntersectionResults.Add(res);
            }
        }
示例#2
0
        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);
            }
        }