FindIntersections() public method

public FindIntersections ( ILineSegment testSegment ) : Point>.Dictionary
testSegment ILineSegment
return Point>.Dictionary
Ejemplo n.º 1
0
        public ILineSegment Resize(IntersectionDetector detector)
        {
            LineSegment lineSegment = new LineSegment(PointA, PointB, new Point(0, 0));

            lineSegment.Id = Id;
            Dictionary <ILineSegment, Point> intersections = detector.FindIntersections(lineSegment);

            foreach (KeyValuePair <ILineSegment, Point> intersection in intersections)
            {
                if (intersection.Key.TriangulationPoint.X != 0 && intersection.Key.TriangulationPoint.Y != 0)
                {
                    Point closestPoint;

                    if (intersection.Key.TriangulateClosestEndPoint(this, out closestPoint))
                    {
                        if (lineSegment.PointA == closestPoint)
                        {
                            lineSegment.PointA = intersection.Value;
                        }
                        else
                        {
                            lineSegment.PointB = intersection.Value;
                        }
                    }
                }
            }

            return(lineSegment);
        }
Ejemplo n.º 2
0
        public ILineSegment Resize(IntersectionDetector detector)
        {
            LineSegment lineSegment = new LineSegment(PointA, PointB, new Point(0, 0));
            lineSegment.Id = Id;
            Dictionary<ILineSegment, Point> intersections = detector.FindIntersections(lineSegment);

            foreach (KeyValuePair<ILineSegment, Point> intersection in intersections)
            {
                if (intersection.Key.TriangulationPoint.X != 0 && intersection.Key.TriangulationPoint.Y != 0)
                {
                    Point closestPoint;

                    if (intersection.Key.TriangulateClosestEndPoint(this, out closestPoint))
                    {
                        if (lineSegment.PointA == closestPoint)
                        {
                            lineSegment.PointA = intersection.Value;
                        }
                        else
                        {
                            lineSegment.PointB = intersection.Value;
                        }
                    }
                }
            }

            return lineSegment;
        }