示例#1
0
        private static Point NearestToCenterPoint(Point p, Size s, Point c)
        {
            var angle = p.AngleWith(c);

            var x = p.X + (s.Width / 2d) * Math.Cos(angle);
            var y = p.Y + (s.Height / 2d) * -Math.Sign(angle);

            return(new Point(x, y));
        }
示例#2
0
        private static Point GetAttachPoint(Point s, Size size, Point t)
        {
            var angle = s.AngleWith(t);

            var halfWidth  = size.Width / 2d;
            var halfHeight = size.Height / 2d;

            var x = s.X + halfWidth * Math.Cos(angle);
            var y = s.Y + halfHeight * -Math.Sin(angle);

            return(new Point(x, y));
        }