예제 #1
0
        public static Arc2D FromLinesCircle(LineSeg2D line1, LineSeg2D line2, Circle2D c, int decimals = -1)
        {
            Point2D[] intersects1 = null;
            Point2D[] intersects2 = null;

            intersects1 = c.GetIntersect(line1, decimals);
            intersects2 = c.GetIntersect(line2, decimals);

            throw new NotImplementedException();
        }
예제 #2
0
        /// <summary>
        /// Returns circles that are tangent to two other circles.
        /// </summary>
        /// <param name="circle1">Circle that returned circles should be tangent to.</param>
        /// <param name="circle2">Circle that returned circles should be tangent to.</param>
        /// <param name="radius">Radius of new circles.</param>
        /// <returns>External tangent circles are listed first.</returns>
        public static  Circle2D[] FromTangentTangentRadius(Circle2D circle1, Circle2D circle2, decimal radius)
        {
            Circle2D            outerOrbit1    = default(Circle2D);
            Circle2D            outerOrbit2    = default(Circle2D);
            Nullable <Circle2D> innerOrbit1    = null;
            Nullable <Circle2D> innerOrbit2    = null;
            List <Point2D>      centerPoints   = new List <Point2D>();
            List <Circle2D>     tangentCircles = new List <Circle2D>();

            outerOrbit1 = new Circle2D(circle1.X, circle1.Y, circle1.Radius + radius);
            if (radius < circle1.Radius)
            {
                innerOrbit1 = new Circle2D(circle1.X, circle1.Y, circle1.Radius - radius);
            }

            outerOrbit2 = new Circle2D(circle2.X, circle2.Y, circle2.Radius + radius);
            if (radius < circle2.Radius)
            {
                innerOrbit2 = new Circle2D(circle2.X, circle2.Y, circle2.Radius - radius);
            }

            // Add intersections of outer orbits
            centerPoints.AddRange(outerOrbit1.GetIntersect(outerOrbit2));

            // Add intersections of outer orbit with the other's inner orbit
            if (innerOrbit2.HasValue)
            {
                centerPoints.AddRange(outerOrbit1.GetIntersect(innerOrbit2.Value));
            }
            if (innerOrbit1.HasValue)
            {
                centerPoints.AddRange(outerOrbit2.GetIntersect(innerOrbit1.Value));
            }

            // Add intersections of inner orbits

            if (innerOrbit1.HasValue && innerOrbit2.HasValue)
            {
                centerPoints.AddRange(innerOrbit1.Value.GetIntersect(innerOrbit2.Value));
            }

            // Now render center points to circles

            for (int i = 0; i <= centerPoints.Count - 1; i++)
            {
                tangentCircles.Add(new Circle2D(centerPoints[i].X, centerPoints[i].Y, radius));
            }

            return(tangentCircles.ToArray());
        }
예제 #3
0
        public         Point2D[] GetIntersect(Circle2D c, int decimals = -1)
        {
            _CheckIsValid();

            return(c.GetIntersect(this, decimals));
        }