Ejemplo n.º 1
0
        /// <summary>
        /// Returns an array of two points, or null if tangent not possible.
        /// Never returns a single point, even if booth points are equal.
        /// </summary>
        public static Point2d[] CirclePoint(Circle2d ci, Point2d pt)
        {
            Circle2d tc = Circle2d.From2Points(ci.Center, pt);

            Point2d[] pts = Intersect2d.CircleCircle(tc, ci);
            if (pts == null)
            {
                return(null);
            }
            if (pts.Length == 1)
            {
                Array.Resize(ref pts, 2); pts[1] = pts[0];
            }
            return(pts);
        }