Пример #1
0
        public static bool IsBetweenLines(double x, double y, LineC l1, LineC l2)
        {
            int a = l1.ReturnBetweenes(x, y);
            int b = l2.ReturnBetweenes(x, y);

            return((a > 0 && b < 0) || (a < 0 && b > 0));
        }
Пример #2
0
        public bool ChooseFriendTrue(NodeC n1, NodeC n2, double x, double y)
        {
            LineC l1 = new LineC(n1.x, n1.y, n2.x, n2.y); //line between nodes
            LineC l2 = new LineC(n1.x, n1.y, l1);         //line normal to l1 through n1
            LineC l3 = new LineC(n2.x, n2.y, l1);         //line normal to l1 through n2

            return(LineC.IsBetweenLines(x, y, l2, l3) && LineC.IsOnLine(x, y, 5000, l1));
        }
Пример #3
0
        public static bool IsOnLine(double x, double y, int delta, LineC l)
        {
            double line = l.A * x + l.B * y + l.C;

            return(-delta < line && line < delta);
        }
Пример #4
0
 public LineC(double x, double y, LineC normline)
 {
     A = -(1 / normline.A);
     B = normline.B;
     C = -(A * x + B * y);
 }