Esempio n. 1
0
        private Point FindLineAndCircleInterception(Point c1, double r1, Point c2, Vertex.Tags tag, Point c3)
        {
            int x = 0, y = 0;

            if (tag == Vertex.Tags.VerticalLine)
            {
                int dx = c2.X - c1.X;
                if (Math.Abs(dx) > r1)
                {
                    throw new IncompatibleTagsException();
                }
                int dy = (int)Math.Sqrt(r1 * r1 - dx * dx);
                y = c3.Y > c1.Y ? c1.Y + dy : c1.Y - dy;
                x = c2.X;
            }
            else if (tag == Vertex.Tags.HorizontalLine)
            {
                int dy = c2.Y - c1.Y;
                if (Math.Abs(dy) > r1)
                {
                    throw new IncompatibleTagsException();
                }
                int dx = (int)Math.Sqrt(r1 * r1 - dy * dy);
                x = c3.X > c1.X ? c1.X + dx : c1.X - dx;
                y = c2.Y;
            }
            return(new Point(x, y));
        }
Esempio n. 2
0
 public bool IsTagged(int vertexBeforeIndex, Vertex.Tags tag)
 {
     if (Vertices[vertexBeforeIndex].Tag == tag)
     {
         return(true);
     }
     return(false);
 }