Exemple #1
0
        //finds if line is horizontal or vertical
        public static bool CheckLineOrthogonal(Line2d line, double eps = 0)
        {
            bool    check = false;
            Point2d p1    = line.StartPoint;
            Point2d p2    = line.EndPoint;
            double  xDiff = p1.X - p2.X;
            double  yDiff = p1.Y - p2.Y;

            if (eps == 0)
            {
                if (xDiff == 0 || yDiff == 0)
                {
                    check = true;
                }
            }
            else
            {
                if (BasicUtility.CheckWithinRange(0, xDiff, eps) == -1 || BasicUtility.CheckWithinRange(0, yDiff, eps) == -1)
                {
                    check = true;
                }
                else
                {
                    check = false;
                }
            }
            return(check);
        }