//---------------------------------------------fix_degenerate_bisectrix_end
        public static void FixDegenerateBisectrixEnd(LineParameters lp,
                                                     ref int x, ref int y)
        {
            int d = Basics.RoundInt(((double)(x - lp.X2) * (double)(lp.Y2 - lp.Y1) -
                                     (double)(y - lp.Y2) * (double)(lp.X2 - lp.X1)) / lp.Len);

            if (d < LineSubPixelScale / 2)
            {
                x = lp.X2 + (lp.Y2 - lp.Y1);
                y = lp.Y2 - (lp.X2 - lp.X1);
            }
        }
        //---------------------------------------------------------------------
        public void Divide(LineParameters lp1, LineParameters lp2)
        {
            int xmid = (X1 + X2) >> 1;
            int ymid = (Y1 + Y2) >> 1;
            int len2 = Len >> 1;

            lp1 = this; // it is a struct so this is a copy
            lp2 = this; // it is a struct so this is a copy

            lp1.X2  = xmid;
            lp1.Y2  = ymid;
            lp1.Len = len2;
            lp1.dX  = Math.Abs(lp1.X2 - lp1.X1);
            lp1.dY  = Math.Abs(lp1.Y2 - lp1.Y1);

            lp2.X1  = xmid;
            lp2.Y1  = ymid;
            lp2.Len = len2;
            lp2.dX  = Math.Abs(lp2.X2 - lp2.X1);
            lp2.dY  = Math.Abs(lp2.Y2 - lp2.Y1);
        }
 //---------------------------------------------------------------------
 public bool SameDiagonalQuadrant(LineParameters lp)
 {
     return(SDiagonalQuadrant[Octant] == SDiagonalQuadrant[lp.Octant]);
 }
 //---------------------------------------------------------------------
 public bool SameOrthogonalQuadrant(LineParameters lp)
 {
     return(SOrthogonalQuadrant[Octant] == SOrthogonalQuadrant[lp.Octant]);
 }